summaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/ivorbis/vorbis.c92
-rw-r--r--ext/ivorbis/vorbisfile.c78
2 files changed, 85 insertions, 85 deletions
diff --git a/ext/ivorbis/vorbis.c b/ext/ivorbis/vorbis.c
index b23bcbea..4098e53f 100644
--- a/ext/ivorbis/vorbis.c
+++ b/ext/ivorbis/vorbis.c
@@ -23,97 +23,31 @@
#include <tremor/ivorbisfile.h>
#include <gst/bytestream/bytestream.h>
-extern GType ivorbisfile_get_type(void);
-
-extern GstElementDetails ivorbisfile_details;
-
-GstPadTemplate *gst_vorbisdec_src_template, *gst_vorbisdec_sink_template;
-
-static GstCaps*
-vorbis_caps_factory (void)
-{
- return
- gst_caps_new (
- "tremor_tremor",
- "application/ogg",
- NULL);
-}
+#include <config.h>
-static GstCaps*
-raw_caps_factory (void)
-{
- return
- gst_caps_new (
- "tremor_raw",
- "audio/x-raw-int",
- gst_props_new (
- "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 (11025, 48000),
- "channels", GST_PROPS_INT_RANGE (1, 2),
- NULL));
-}
+extern GType ivorbisfile_get_type(void);
-static GstCaps*
-raw_caps2_factory (void)
-{
- return
- gst_caps_new (
- "tremor_raw_float",
- "audio/x-raw-float",
- gst_props_new (
- "depth", GST_PROPS_INT (32),
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "rate", GST_PROPS_INT_RANGE (11025, 48000),
- "channels", GST_PROPS_INT (2), /* ?? */
- NULL));
-}
static gboolean
-plugin_init (GModule *module, GstPlugin *plugin)
+plugin_init (GstPlugin *plugin)
{
- GstElementFactory *file;
- GstCaps *raw_caps, *vorbis_caps, *raw_caps2;
-
if (!gst_library_load ("gstbytestream"))
return FALSE;
- gst_plugin_set_longname (plugin, "The OGG Vorbis Codec");
-
- raw_caps = raw_caps_factory ();
- raw_caps2 = raw_caps2_factory ();
- vorbis_caps = vorbis_caps_factory ();
-
- /* register sink pads */
- gst_vorbisdec_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
- GST_PAD_ALWAYS,
- vorbis_caps, NULL);
- raw_caps = gst_caps_prepend (raw_caps, raw_caps2);
- /* register src pads */
- gst_vorbisdec_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
- GST_PAD_ALWAYS,
- raw_caps, NULL);
- /* create an elementfactory for the vorbisfile element */
- file = gst_element_factory_new ("tremor", ivorbisfile_get_type(),
- &ivorbisfile_details);
- g_return_val_if_fail(file != NULL, FALSE);
- gst_element_factory_set_rank (file, GST_ELEMENT_RANK_PRIMARY);
-
- /* register sink pads */
- gst_element_factory_add_pad_template (file, gst_vorbisdec_sink_template);
- /* register src pads */
- gst_element_factory_add_pad_template (file, gst_vorbisdec_src_template);
+ if (!gst_element_register (plugin, "tremor", GST_RANK_PRIMARY, ivorbisfile_get_type ()))
+ return FALSE;
- gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (file));
-
return TRUE;
}
-GstPluginDesc plugin_desc = {
+GST_PLUGIN_DEFINE (
GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"tremor",
- plugin_init
-};
+ "OGG Vorbis Tremor plugins element",
+ plugin_init,
+ VERSION,
+ "LGPL",
+ GST_COPYRIGHT,
+ GST_PACKAGE,
+ GST_ORIGIN)
diff --git a/ext/ivorbis/vorbisfile.c b/ext/ivorbis/vorbisfile.c
index 4e66702b..8e0ee73e 100644
--- a/ext/ivorbis/vorbisfile.c
+++ b/ext/ivorbis/vorbisfile.c
@@ -72,19 +72,16 @@ struct _IvorbisfileClass {
GType ivorbisfile_get_type (void);
-extern GstPadTemplate *gst_vorbisdec_src_template, *gst_vorbisdec_sink_template;
+static GstPadTemplate *gst_vorbisdec_src_template, *gst_vorbisdec_sink_template;
/* elementfactory information */
GstElementDetails ivorbisfile_details =
{
"Ogg Vorbis decoder",
"Codec/Audio/Decoder",
- "LGPL",
"Decodes OGG Vorbis audio using the Tremor vorbisfile API",
- VERSION,
"Monty <monty@xiph.org>\n"
"Wim Taymans <wim.taymans@chello.be>",
- "(C) 2000",
};
/* Ivorbisfile signals and args */
@@ -100,6 +97,7 @@ enum
ARG_STREAMINFO
};
+static void gst_ivorbisfile_base_init (gpointer g_class);
static void
gst_ivorbisfile_class_init (IvorbisfileClass *klass);
static void gst_ivorbisfile_init (Ivorbisfile *ivorbisfile);
@@ -146,6 +144,48 @@ static GstElementClass *parent_class = NULL;
static GstFormat logical_stream_format;
+static GstCaps*
+vorbis_caps_factory (void)
+{
+ return
+ gst_caps_new (
+ "tremor_tremor",
+ "application/ogg",
+ NULL);
+}
+
+static GstCaps*
+raw_caps_factory (void)
+{
+ return
+ gst_caps_new (
+ "tremor_raw",
+ "audio/x-raw-int",
+ gst_props_new (
+ "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 (11025, 48000),
+ "channels", GST_PROPS_INT_RANGE (1, 2),
+ NULL));
+}
+
+static GstCaps*
+raw_caps2_factory (void)
+{
+ return
+ gst_caps_new (
+ "tremor_raw_float",
+ "audio/x-raw-float",
+ gst_props_new (
+ "depth", GST_PROPS_INT (32),
+ "endianness", GST_PROPS_INT (G_BYTE_ORDER),
+ "rate", GST_PROPS_INT_RANGE (11025, 48000),
+ "channels", GST_PROPS_INT (2), /* ?? */
+ NULL));
+}
+
GType
ivorbisfile_get_type (void)
{
@@ -153,7 +193,9 @@ ivorbisfile_get_type (void)
if (!ivorbisfile_type) {
static const GTypeInfo ivorbisfile_info = {
- sizeof (IvorbisfileClass), NULL, NULL,
+ sizeof (IvorbisfileClass),
+ gst_ivorbisfile_base_init,
+ NULL,
(GClassInitFunc) gst_ivorbisfile_class_init, NULL, NULL,
sizeof (Ivorbisfile), 0,
(GInstanceInitFunc) gst_ivorbisfile_init,
@@ -168,6 +210,30 @@ ivorbisfile_get_type (void)
}
static void
+gst_ivorbisfile_base_init (gpointer g_class)
+{
+ GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
+ GstCaps *raw_caps, *vorbis_caps, *raw_caps2;
+
+ raw_caps = raw_caps_factory ();
+ raw_caps2 = raw_caps2_factory ();
+ vorbis_caps = vorbis_caps_factory ();
+
+ /* register sink pads */
+ gst_vorbisdec_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ vorbis_caps, NULL);
+ raw_caps = gst_caps_prepend (raw_caps, raw_caps2);
+ /* register src pads */
+ gst_vorbisdec_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ raw_caps, NULL);
+ gst_element_class_add_pad_template (element_class, gst_vorbisdec_sink_template);
+ gst_element_class_add_pad_template (element_class, gst_vorbisdec_src_template);
+ gst_element_class_set_details (element_class, &ivorbisfile_details);
+}
+
+static void
gst_ivorbisfile_class_init (IvorbisfileClass * klass)
{
GObjectClass *gobject_class;
@@ -585,7 +651,7 @@ gst_ivorbisfile_loop (GstElement *element)
/* if the pad is not usable, don't push it out */
if (GST_PAD_IS_USABLE (ivorbisfile->srcpad)) {
gst_pad_push (ivorbisfile->srcpad,
- GST_BUFFER (gst_event_new (GST_EVENT_EOS)));
+ GST_DATA (gst_event_new (GST_EVENT_EOS)));
}
gst_element_set_eos (element);
return;