From 0ff2df8ec7a7a35c10d336668ef2d754fbe78bc3 Mon Sep 17 00:00:00 2001 From: Iain Holmes Date: Sun, 2 Nov 2003 00:13:26 +0000 Subject: [PATCH] Fixed lame too Original commit message from CVS: Fixed lame too --- ext/lame/gstlame.c | 51 ++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/ext/lame/gstlame.c b/ext/lame/gstlame.c index 1c6801d754..a54de9927a 100644 --- a/ext/lame/gstlame.c +++ b/ext/lame/gstlame.c @@ -28,11 +28,8 @@ static GstElementDetails gst_lame_details = { "L.A.M.E. mp3 encoder", "Codec/Audio/Encoder", - "LGPL", "High-quality free MP3 encoder", - VERSION, "Erik Walthinsen ", - "(C) 2000", }; GST_PAD_TEMPLATE_FACTORY (gst_lame_sink_factory, @@ -188,7 +185,7 @@ enum { ARG_METADATA, }; - +static void gst_lame_base_init (gpointer g_class); static void gst_lame_class_init (GstLameClass *klass); static void gst_lame_init (GstLame *gst_lame); @@ -211,7 +208,7 @@ gst_lame_get_type (void) if (!gst_lame_type) { static const GTypeInfo gst_lame_info = { sizeof (GstLameClass), - NULL, + gst_lame_base_init, NULL, (GClassInitFunc) gst_lame_class_init, NULL, @@ -225,6 +222,16 @@ gst_lame_get_type (void) return gst_lame_type; } +static void +gst_lame_base_init (gpointer g_class) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); + + gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (gst_lame_src_factory)); + gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (gst_lame_sink_factory)); + gst_element_class_set_details (element_class, &gst_lame_details); +} + static void gst_lame_class_init (GstLameClass *klass) { @@ -920,32 +927,22 @@ gst_lame_change_state (GstElement *element) } static gboolean -plugin_init (GModule *module, GstPlugin *plugin) +plugin_init (GstPlugin *plugin) { - GstElementFactory *factory; - - /* create an elementfactory for the gst_lame element */ - factory = gst_element_factory_new ("lame", GST_TYPE_LAME, - &gst_lame_details); - g_return_val_if_fail (factory != NULL, FALSE); - - /* register the source's padtemplate */ - gst_element_factory_add_pad_template (factory, - GST_PAD_TEMPLATE_GET (gst_lame_src_factory)); - - /* register the sink's padtemplate */ - gst_element_factory_add_pad_template (factory, - GST_PAD_TEMPLATE_GET (gst_lame_sink_factory)); - - /* and add the gst_lame element factory to the plugin */ - gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory)); - + if (!gst_element_register (plugin, "lame", GST_RANK_NONE, GST_TYPE_LAME)) + return FALSE; + return TRUE; } -GstPluginDesc plugin_desc = { +GST_PLUGIN_DEFINE ( GST_VERSION_MAJOR, GST_VERSION_MINOR, "lame", - plugin_init -}; + "Encode MP3's with LAME", + plugin_init, + VERSION, + "LGPL", + GST_COPYRIGHT, + GST_PACKAGE, + GST_ORIGIN)