GSM updated for new stuff

Original commit message from CVS:
GSM updated for new stuff
This commit is contained in:
Iain Holmes 2003-11-01 16:35:25 +00:00
parent 6d5504f649
commit 0047a122a2
3 changed files with 101 additions and 87 deletions

View file

@ -21,89 +21,25 @@
#include "gstgsmdec.h"
#include "gstgsmenc.h"
/* elementfactory information */
extern GstElementDetails gst_gsmdec_details;
extern GstElementDetails gst_gsmenc_details;
GstPadTemplate *gsmdec_src_template, *gsmdec_sink_template;
GstPadTemplate *gsmenc_src_template, *gsmenc_sink_template;
GST_CAPS_FACTORY (gsm_caps_factory,
GST_CAPS_NEW (
"gsm_gsm",
"audio/x-gsm",
"rate", GST_PROPS_INT_RANGE (1000, 48000),
"channels", GST_PROPS_INT (1)
)
)
GST_CAPS_FACTORY (raw_caps_factory,
GST_CAPS_NEW (
"gsm_raw",
"audio/x-raw-int",
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_INT (16),
"depth", GST_PROPS_INT (16),
"rate", GST_PROPS_INT_RANGE (1000, 48000),
"channels", GST_PROPS_INT (1)
)
)
static gboolean
plugin_init (GModule *module, GstPlugin *plugin)
plugin_init (GstPlugin *plugin)
{
GstElementFactory *dec, *enc;
GstCaps *raw_caps, *gsm_caps;
/* create an elementfactory for the gsmdec element */
enc = gst_element_factory_new("gsmenc",GST_TYPE_GSMENC,
&gst_gsmenc_details);
g_return_val_if_fail(enc != NULL, FALSE);
raw_caps = GST_CAPS_GET (raw_caps_factory);
gsm_caps = GST_CAPS_GET (gsm_caps_factory);
/* register sink pads */
gsmenc_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
GST_PAD_ALWAYS,
raw_caps, NULL);
gst_element_factory_add_pad_template (enc, gsmenc_sink_template);
/* register src pads */
gsmenc_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
GST_PAD_ALWAYS,
gsm_caps, NULL);
gst_element_factory_add_pad_template (enc, gsmenc_src_template);
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (enc));
/* create an elementfactory for the gsmdec element */
dec = gst_element_factory_new("gsmdec",GST_TYPE_GSMDEC,
&gst_gsmdec_details);
g_return_val_if_fail(dec != NULL, FALSE);
gst_element_factory_set_rank (dec, GST_ELEMENT_RANK_PRIMARY);
/* register sink pads */
gsmdec_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
GST_PAD_ALWAYS,
gsm_caps, NULL);
gst_element_factory_add_pad_template (dec, gsmdec_sink_template);
/* register src pads */
gsmdec_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
GST_PAD_ALWAYS,
raw_caps, NULL);
gst_element_factory_add_pad_template (dec, gsmdec_src_template);
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (dec));
if (!gst_element_register (plugin, "gsmenc", GST_RANK_NONE, GST_TYPE_GSMENC))
return FALSE;
if (!gst_element_register (plugin, "gsmdec", GST_RANK_PRIMARY, GST_TYPE_GSMDEC))
return FALSE;
return TRUE;
}
GstPluginDesc plugin_desc = {
GST_PLUGIN_DEFINE (
GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"gsm",
plugin_init
};
"GSM Elements Plugin",
plugin_init,
VERSION,
"LGPL",
GST_COPYRIGHT,
GST_PACKAGE,
GST_ORIGIN)

View file

@ -25,17 +25,14 @@
#include "gstgsmdec.h"
extern GstPadTemplate *gsmdec_src_template, *gsmdec_sink_template;
static GstPadTemplate *gsmdec_src_template, *gsmdec_sink_template;
/* elementfactory information */
GstElementDetails gst_gsmdec_details = {
"gsm audio decoder",
"Codec/Audio/Decoder",
"LGPL",
".gsm",
VERSION,
"Wim Taymans <wim.taymans@chello.be>",
"(C) 2000",
};
/* GSMDec signals and args */
@ -49,6 +46,7 @@ enum {
/* FILL ME */
};
static void gst_gsmdec_base_init (gpointer g_class);
static void gst_gsmdec_class_init (GstGSMDec *klass);
static void gst_gsmdec_init (GstGSMDec *gsmdec);
@ -64,7 +62,8 @@ gst_gsmdec_get_type(void) {
if (!gsmdec_type) {
static const GTypeInfo gsmdec_info = {
sizeof(GstGSMDecClass), NULL,
sizeof(GstGSMDecClass),
gst_gsmdec_base_init,
NULL,
(GClassInitFunc)gst_gsmdec_class_init,
NULL,
@ -78,6 +77,45 @@ gst_gsmdec_get_type(void) {
return gsmdec_type;
}
GST_CAPS_FACTORY (gsm_caps_factory,
GST_CAPS_NEW (
"gsm_gsm",
"audio/x-gsm",
"rate", GST_PROPS_INT_RANGE (1000, 48000),
"channels", GST_PROPS_INT (1)
)
)
GST_CAPS_FACTORY (raw_caps_factory,
GST_CAPS_NEW (
"gsm_raw",
"audio/x-raw-int",
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_INT (16),
"depth", GST_PROPS_INT (16),
"rate", GST_PROPS_INT_RANGE (1000, 48000),
"channels", GST_PROPS_INT (1)
)
)
static void
gst_gsmdec_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
GstCaps *raw_caps, *gsm_caps;
gsmdec_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
GST_PAD_ALWAYS,
gsm_caps, NULL);
gsmdec_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
GST_PAD_ALWAYS,
raw_caps, NULL);
gst_element_class_add_pad_template (element_class, gsmdec_sink_template);
gst_element_class_add_pad_template (element_class, gsmdec_src_template);
gst_element_class_set_details (element_class, &gst_gsmdec_details);
}
static void
gst_gsmdec_class_init (GstGSMDec *klass)
{

View file

@ -25,17 +25,14 @@
#include "gstgsmenc.h"
extern GstPadTemplate *gsmenc_src_template, *gsmenc_sink_template;
static GstPadTemplate *gsmenc_src_template, *gsmenc_sink_template;
/* elementfactory information */
GstElementDetails gst_gsmenc_details = {
"gsm audio encoder",
"Codec/Audio/Encoder",
"LGPL",
".gsm",
VERSION,
"Wim Taymans <wim.taymans@chello.be>",
"(C) 2000",
};
/* GSMEnc signals and args */
@ -50,6 +47,7 @@ enum {
/* FILL ME */
};
static void gst_gsmenc_base_init (gpointer g_class);
static void gst_gsmenc_class_init (GstGSMEnc *klass);
static void gst_gsmenc_init (GstGSMEnc *gsmenc);
@ -67,7 +65,7 @@ gst_gsmenc_get_type (void)
if (!gsmenc_type) {
static const GTypeInfo gsmenc_info = {
sizeof (GstGSMEncClass),
NULL,
gst_gsmenc_base_init,
NULL,
(GClassInitFunc) gst_gsmenc_class_init,
NULL,
@ -81,6 +79,48 @@ gst_gsmenc_get_type (void)
return gsmenc_type;
}
GST_CAPS_FACTORY (gsm_caps_factory,
GST_CAPS_NEW (
"gsm_gsm",
"audio/x-gsm",
"rate", GST_PROPS_INT_RANGE (1000, 48000),
"channels", GST_PROPS_INT (1)
)
)
GST_CAPS_FACTORY (raw_caps_factory,
GST_CAPS_NEW (
"gsm_raw",
"audio/x-raw-int",
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_INT (16),
"depth", GST_PROPS_INT (16),
"rate", GST_PROPS_INT_RANGE (1000, 48000),
"channels", GST_PROPS_INT (1)
)
)
static void
gst_gsmenc_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
GstCaps *raw_caps, *gsm_caps;
raw_caps = GST_CAPS_GET (raw_caps_factory);
gsm_caps = GST_CAPS_GET (gsm_caps_factory);
gsmenc_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
GST_PAD_ALWAYS,
raw_caps, NULL);
gsmenc_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
GST_PAD_ALWAYS,
gsm_caps, NULL);
gst_element_class_add_pad_template (element_class, gsmenc_sink_template);
gst_element_class_add_pad_template (element_class, gsmenc_src_template);
gst_element_class_set_details (element_class, &gst_gsmenc_details);
}
static void
gst_gsmenc_class_init (GstGSMEnc *klass)
{