Speex compiles

Original commit message from CVS:
Speex compiles
This commit is contained in:
Iain Holmes 2003-11-02 01:58:16 +00:00
parent 7346fb1642
commit 772904f67f
3 changed files with 107 additions and 87 deletions

View file

@ -16,94 +16,31 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#include <config.h>
#include "gstspeexdec.h" #include "gstspeexdec.h"
#include "gstspeexenc.h" #include "gstspeexenc.h"
/* elementfactory information */
extern GstElementDetails gst_speexdec_details;
extern GstElementDetails gst_speexenc_details;
GstPadTemplate *speexdec_src_template, *speexdec_sink_template;
GstPadTemplate *speexenc_src_template, *speexenc_sink_template;
GST_CAPS_FACTORY (speex_caps_factory,
GST_CAPS_NEW (
"speex_speex",
"audio/x-speex",
"rate", GST_PROPS_INT_RANGE (1000, 48000),
"channels", GST_PROPS_INT (1)
)
)
GST_CAPS_FACTORY (raw_caps_factory,
GST_CAPS_NEW (
"speex_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 static gboolean
plugin_init (GModule *module, GstPlugin *plugin) plugin_init (GstPlugin *plugin)
{ {
GstElementFactory *dec, *enc; if (!gst_element_register (plugin, "speexenc", GST_RANK_NONE, GST_TYPE_SPEEXENC))
GstCaps *raw_caps, *speex_caps; return FALSE;
/* create an elementfactory for the speexdec element */ if (!gst_element_register (plugin, "speexdec", GST_RANK_PRIMARY, GST_TYPE_SPEEXDEC))
enc = gst_element_factory_new("speexenc",GST_TYPE_SPEEXENC, return FALSE;
&gst_speexenc_details);
g_return_val_if_fail(enc != NULL, FALSE);
raw_caps = GST_CAPS_GET (raw_caps_factory);
speex_caps = GST_CAPS_GET (speex_caps_factory);
/* register sink pads */
speexenc_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
GST_PAD_ALWAYS,
raw_caps, NULL);
gst_element_factory_add_pad_template (enc, speexenc_sink_template);
/* register src pads */
speexenc_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
GST_PAD_ALWAYS,
speex_caps, NULL);
gst_element_factory_add_pad_template (enc, speexenc_src_template);
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (enc));
/* create an elementfactory for the speexdec element */
dec = gst_element_factory_new("speexdec",GST_TYPE_SPEEXDEC,
&gst_speexdec_details);
g_return_val_if_fail(dec != NULL, FALSE);
gst_element_factory_set_rank (dec, GST_ELEMENT_RANK_PRIMARY);
/* register sink pads */
speexdec_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
GST_PAD_ALWAYS,
speex_caps, NULL);
gst_element_factory_add_pad_template (dec, speexdec_sink_template);
/* register src pads */
speexdec_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
GST_PAD_ALWAYS,
raw_caps, NULL);
gst_element_factory_add_pad_template (dec, speexdec_src_template);
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (dec));
return TRUE; return TRUE;
} }
GstPluginDesc plugin_desc = { GST_PLUGIN_DEFINE (
GST_VERSION_MAJOR, GST_VERSION_MAJOR,
GST_VERSION_MINOR, GST_VERSION_MINOR,
"speex", "speex",
plugin_init "Speex plugin library",
}; plugin_init,
VERSION,
"LGPL",
GST_COPYRIGHT,
GST_PACKAGE,
GST_ORIGIN)

View file

@ -25,17 +25,14 @@
#include "gstspeexdec.h" #include "gstspeexdec.h"
extern GstPadTemplate *speexdec_src_template, *speexdec_sink_template; static GstPadTemplate *speexdec_src_template, *speexdec_sink_template;
/* elementfactory information */ /* elementfactory information */
GstElementDetails gst_speexdec_details = { GstElementDetails gst_speexdec_details = {
"speex audio decoder", "speex audio decoder",
"Codec/Audio/Decoder", "Codec/Audio/Decoder",
"LGPL",
".speex", ".speex",
VERSION,
"Wim Taymans <wim.taymans@chello.be>", "Wim Taymans <wim.taymans@chello.be>",
"(C) 2000",
}; };
/* SpeexDec signals and args */ /* SpeexDec signals and args */
@ -49,6 +46,7 @@ enum {
/* FILL ME */ /* FILL ME */
}; };
static void gst_speexdec_base_init (gpointer g_class);
static void gst_speexdec_class_init (GstSpeexDec *klass); static void gst_speexdec_class_init (GstSpeexDec *klass);
static void gst_speexdec_init (GstSpeexDec *speexdec); static void gst_speexdec_init (GstSpeexDec *speexdec);
@ -64,7 +62,8 @@ gst_speexdec_get_type(void) {
if (!speexdec_type) { if (!speexdec_type) {
static const GTypeInfo speexdec_info = { static const GTypeInfo speexdec_info = {
sizeof(GstSpeexDecClass), NULL, sizeof(GstSpeexDecClass),
gst_speexdec_base_init,
NULL, NULL,
(GClassInitFunc)gst_speexdec_class_init, (GClassInitFunc)gst_speexdec_class_init,
NULL, NULL,
@ -78,6 +77,49 @@ gst_speexdec_get_type(void) {
return speexdec_type; return speexdec_type;
} }
GST_CAPS_FACTORY (speex_caps_factory,
GST_CAPS_NEW (
"speex_speex",
"audio/x-speex",
"rate", GST_PROPS_INT_RANGE (1000, 48000),
"channels", GST_PROPS_INT (1)
)
)
GST_CAPS_FACTORY (raw_caps_factory,
GST_CAPS_NEW (
"speex_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_speexdec_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
GstCaps *raw_caps, *speex_caps;
raw_caps = GST_CAPS_GET (raw_caps_factory);
speex_caps = GST_CAPS_GET (speex_caps_factory);
speexdec_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
GST_PAD_ALWAYS,
speex_caps, NULL);
speexdec_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
GST_PAD_ALWAYS,
raw_caps, NULL);
gst_element_class_add_pad_template (element_class, speexdec_sink_template);
gst_element_class_add_pad_template (element_class, speexdec_src_template);
gst_element_class_set_details (element_class, &gst_speexdec_details);
}
static void static void
gst_speexdec_class_init (GstSpeexDec *klass) gst_speexdec_class_init (GstSpeexDec *klass)
{ {

View file

@ -25,17 +25,14 @@
#include "gstspeexenc.h" #include "gstspeexenc.h"
extern GstPadTemplate *speexenc_src_template, *speexenc_sink_template; static GstPadTemplate *speexenc_src_template, *speexenc_sink_template;
/* elementfactory information */ /* elementfactory information */
GstElementDetails gst_speexenc_details = { GstElementDetails gst_speexenc_details = {
"speex audio encoder", "speex audio encoder",
"Codec/Audio/Encoder", "Codec/Audio/Encoder",
"LGPL",
".speex", ".speex",
VERSION,
"Wim Taymans <wim.taymans@chello.be>", "Wim Taymans <wim.taymans@chello.be>",
"(C) 2000",
}; };
/* SpeexEnc signals and args */ /* SpeexEnc signals and args */
@ -50,6 +47,7 @@ enum {
/* FILL ME */ /* FILL ME */
}; };
static void gst_speexenc_base_init (gpointer g_class);
static void gst_speexenc_class_init (GstSpeexEnc *klass); static void gst_speexenc_class_init (GstSpeexEnc *klass);
static void gst_speexenc_init (GstSpeexEnc *speexenc); static void gst_speexenc_init (GstSpeexEnc *speexenc);
@ -67,7 +65,7 @@ gst_speexenc_get_type (void)
if (!speexenc_type) { if (!speexenc_type) {
static const GTypeInfo speexenc_info = { static const GTypeInfo speexenc_info = {
sizeof (GstSpeexEncClass), sizeof (GstSpeexEncClass),
NULL, gst_speexenc_base_init,
NULL, NULL,
(GClassInitFunc) gst_speexenc_class_init, (GClassInitFunc) gst_speexenc_class_init,
NULL, NULL,
@ -81,6 +79,49 @@ gst_speexenc_get_type (void)
return speexenc_type; return speexenc_type;
} }
GST_CAPS_FACTORY (speex_caps_factory,
GST_CAPS_NEW (
"speex_speex",
"audio/x-speex",
"rate", GST_PROPS_INT_RANGE (1000, 48000),
"channels", GST_PROPS_INT (1)
)
)
GST_CAPS_FACTORY (raw_caps_factory,
GST_CAPS_NEW (
"speex_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_speexenc_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
GstCaps *raw_caps, *speex_caps;
raw_caps = GST_CAPS_GET (raw_caps_factory);
speex_caps = GST_CAPS_GET (speex_caps_factory);
speexenc_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
GST_PAD_ALWAYS,
raw_caps, NULL);
speexenc_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
GST_PAD_ALWAYS,
speex_caps, NULL);
gst_element_class_add_pad_template (element_class, speexenc_sink_template);
gst_element_class_add_pad_template (element_class, speexenc_src_template);
gst_element_class_set_details (element_class, &gst_speexenc_details);
}
static void static void
gst_speexenc_class_init (GstSpeexEnc *klass) gst_speexenc_class_init (GstSpeexEnc *klass)
{ {