From a1694e6f606061388675ea72a7d7eca8dd0aa37e Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Fri, 23 Sep 2011 15:32:01 +0200 Subject: [PATCH] lame: use some more boilerplate --- ext/lame/gstlame.c | 55 +++++++++++------------------------------------------- 1 file changed, 11 insertions(+), 44 deletions(-) diff --git a/ext/lame/gstlame.c b/ext/lame/gstlame.c index 36e4087..c9616f7 100644 --- a/ext/lame/gstlame.c +++ b/ext/lame/gstlame.c @@ -305,10 +305,6 @@ enum #endif }; -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); - static gboolean gst_lame_start (GstAudioEncoder * enc); static gboolean gst_lame_stop (GstAudioEncoder * enc); static gboolean gst_lame_set_format (GstAudioEncoder * enc, @@ -323,48 +319,19 @@ static void gst_lame_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); static gboolean gst_lame_setup (GstLame * lame); -static GstElementClass *parent_class = NULL; - -GType -gst_lame_get_type (void) +static void +gst_lame_add_interfaces (GType lame_type) { - static GType gst_lame_type = 0; - - if (!gst_lame_type) { - static const GTypeInfo gst_lame_info = { - sizeof (GstLameClass), - gst_lame_base_init, - NULL, - (GClassInitFunc) gst_lame_class_init, - NULL, - NULL, - sizeof (GstLame), - 0, - (GInstanceInitFunc) gst_lame_init, - }; - - /* FIXME: remove support for the GstTagSetter interface in 0.11 */ - static const GInterfaceInfo tag_setter_info = { - NULL, - NULL, - NULL - }; - static const GInterfaceInfo preset_info = { - NULL, - NULL, - NULL - }; - - gst_lame_type = - g_type_register_static (GST_TYPE_AUDIO_ENCODER, "GstLame", - &gst_lame_info, 0); - g_type_add_interface_static (gst_lame_type, GST_TYPE_TAG_SETTER, - &tag_setter_info); - g_type_add_interface_static (gst_lame_type, GST_TYPE_PRESET, &preset_info); - } - return gst_lame_type; + static const GInterfaceInfo tag_setter_info = { NULL, NULL, NULL }; + + /* FIXME: remove support for the GstTagSetter interface in 0.11 */ + g_type_add_interface_static (lame_type, GST_TYPE_TAG_SETTER, + &tag_setter_info); } +GST_BOILERPLATE_FULL (GstLame, gst_lame, GstAudioEncoder, + GST_TYPE_AUDIO_ENCODER, gst_lame_add_interfaces); + static void gst_lame_release_memory (GstLame * lame) { @@ -655,7 +622,7 @@ setup_failed: } static void -gst_lame_init (GstLame * lame) +gst_lame_init (GstLame * lame, GstLameClass * klass) { GST_DEBUG_OBJECT (lame, "starting initialization"); -- 2.7.4