diff options
author | jep <jep@2b0047a9-a6d8-0310-accf-f7200b2a168c> | 2012-10-09 10:44:09 +0000 |
---|---|---|
committer | jep <jep@2b0047a9-a6d8-0310-accf-f7200b2a168c> | 2012-10-09 10:44:09 +0000 |
commit | 45a96c842bb0c040763d1b2bd999747468995ac5 (patch) | |
tree | dfd95f401f3a58fa4d9cc4987fae75e0bf0a7e5a | |
parent | 332a8a56e2c7995c6056e144d084dd5440ca507b (diff) |
* src/flump3dec.c: (gst_flump3dec_change_state),
(gst_flump3dec_class_init), (gst_flump3dec_init):
Drop _base_init and modernize some bits of code.
git-svn-id: https://core.fluendo.com/gstreamer/svn/trunk/gst-fluendo-mp3@2386 2b0047a9-a6d8-0310-accf-f7200b2a168c
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | src/flump3dec.c | 64 |
2 files changed, 24 insertions, 46 deletions
@@ -1,5 +1,11 @@ 2012-10-09 Josep Torra <josep@fluendo.com> + * src/flump3dec.c: (gst_flump3dec_change_state), + (gst_flump3dec_class_init), (gst_flump3dec_init): + Drop _base_init and modernize some bits of code. + +2012-10-09 Josep Torra <josep@fluendo.com> + * configure.ac: * src/Makefile.am: Prepare autotools part to handle 1.0 code. diff --git a/src/flump3dec.c b/src/flump3dec.c index 851bc32..c67a12b 100644 --- a/src/flump3dec.c +++ b/src/flump3dec.c @@ -7,7 +7,8 @@ #include "config.h" #endif -#include "../common/gst-fluendo.h" +#include "gst-compat.h" +#include "gst-fluendo.h" #include "flump3dec.h" @@ -15,10 +16,12 @@ GST_DEBUG_CATEGORY (flump3debug); #define GST_CAT_DEFAULT flump3debug /* static vars */ -static GstElementClass *parent_class = NULL; +static void gst_flump3dec_init (GstFluMp3Dec * dec); +#define parent_class gst_flump3dec_parent_class +G_DEFINE_TYPE (GstFluMp3Dec, gst_flump3dec, GST_TYPE_ELEMENT); /* TODO: Add support for MPEG2 multichannel extension */ -static GstStaticPadTemplate gst_flump3dec_sink_factory = +static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, @@ -29,7 +32,7 @@ GST_STATIC_PAD_TEMPLATE ("sink", ); /* TODO: higher resolution 24 bit decoding */ -static GstStaticPadTemplate gst_flump3dec_src_factory = +static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, @@ -967,7 +970,7 @@ gst_flump3dec_change_state (GstElement * element, GstStateChange transition) break; } - ret = parent_class->change_state (element, transition); + ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); switch (transition) { case GST_STATE_CHANGE_PAUSED_TO_READY: @@ -1009,24 +1012,20 @@ gst_flump3dec_get_query_types (GstPad * pad ATTR_UNUSED) } static void -gst_flump3dec_class_init (GstFluMp3Dec * klass) +gst_flump3dec_class_init (GstFluMp3DecClass * klass) { GObjectClass *gobject_class; - GstElementClass *gstelement_class; + GstElementClass *element_class; gobject_class = (GObjectClass *) klass; - gstelement_class = (GstElementClass *) klass; - parent_class = g_type_class_ref (GST_TYPE_ELEMENT); + element_class = (GstElementClass *) klass; - gobject_class->dispose = gst_flump3dec_dispose; + parent_class = g_type_class_peek_parent (klass); - gstelement_class->change_state = gst_flump3dec_change_state; -} + gobject_class->dispose = gst_flump3dec_dispose; + element_class->change_state = gst_flump3dec_change_state; -static void -gst_flump3dec_base_init (GstFluMp3DecClass * klass) -{ #ifdef USE_IPP #define LONGNAME "Fluendo MP3 Decoder (IPP build)" #else @@ -1037,12 +1036,10 @@ gst_flump3dec_base_init (GstFluMp3DecClass * klass) #endif #endif - GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_flump3dec_src_factory)); + gst_static_pad_template_get (&src_factory)); gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_flump3dec_sink_factory)); + gst_static_pad_template_get (&sink_factory)); gst_element_class_set_details_simple (element_class, LONGNAME, @@ -1058,13 +1055,13 @@ gst_flump3dec_init (GstFluMp3Dec * dec) { /* Create and add pads */ dec->sinkpad = - gst_pad_new_from_static_template (&gst_flump3dec_sink_factory, "sink"); + gst_pad_new_from_static_template (&sink_factory, "sink"); gst_pad_set_event_function (dec->sinkpad, gst_flump3dec_sink_event); gst_pad_set_chain_function (dec->sinkpad, gst_flump3dec_sink_chain); gst_element_add_pad (GST_ELEMENT (dec), dec->sinkpad); dec->srcpad = - gst_pad_new_from_static_template (&gst_flump3dec_src_factory, "src"); + gst_pad_new_from_static_template (&src_factory, "src"); gst_pad_set_query_type_function (dec->srcpad, gst_flump3dec_get_query_types); gst_pad_set_query_function (dec->srcpad, gst_flump3dec_src_query); gst_pad_set_event_function (dec->srcpad, gst_flump3dec_src_event); @@ -1081,31 +1078,6 @@ gst_flump3dec_init (GstFluMp3Dec * dec) } /* Function implementations */ -GType -gst_flump3dec_get_type (void) -{ - static GType gst_flump3dec_type = 0; - - if (!gst_flump3dec_type) { - static const GTypeInfo gst_flump3dec_info = { - sizeof (GstFluMp3DecClass), - (GBaseInitFunc) gst_flump3dec_base_init, - NULL, - (GClassInitFunc) gst_flump3dec_class_init, - NULL, - NULL, - sizeof (GstFluMp3Dec), - 0, - (GInstanceInitFunc) gst_flump3dec_init, - NULL - }; - gst_flump3dec_type = g_type_register_static (GST_TYPE_ELEMENT, - "GstFluMp3Dec", &gst_flump3dec_info, 0); - } - - return gst_flump3dec_type; -} - static gboolean plugin_init (GstPlugin * plugin) { |