diff options
author | Stefan Sauer | 2011-10-27 09:53:44 -0500 |
---|---|---|
committer | Nikhil Devshatwar | 2013-05-17 04:40:46 -0500 |
commit | a45dcef6de2979df86a44bbe78b216affd03be69 (patch) | |
tree | 26b69631563c4c3fe7744e661909db50c46877e9 | |
parent | f2efe6c68a1a40f71b7be332dbcebe20427b94f1 (diff) | |
download | gst-plugins-ugly0-10-a45dcef6de2979df86a44bbe78b216affd03be69.tar.gz gst-plugins-ugly0-10-a45dcef6de2979df86a44bbe78b216affd03be69.tar.xz gst-plugins-ugly0-10-a45dcef6de2979df86a44bbe78b216affd03be69.zip |
siddec: use BOILERPLATE macro and cleanup FIXMEs
-rw-r--r-- | ext/sidplay/gstsiddec.cc | 58 |
1 files changed, 13 insertions, 45 deletions
diff --git a/ext/sidplay/gstsiddec.cc b/ext/sidplay/gstsiddec.cc index 7f0a94ab..82411e8b 100644 --- a/ext/sidplay/gstsiddec.cc +++ b/ext/sidplay/gstsiddec.cc | |||
@@ -87,6 +87,8 @@ static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src", | |||
87 | "rate = (int) [ 8000, 48000 ], " "channels = (int) [ 1, 2 ]") | 87 | "rate = (int) [ 8000, 48000 ], " "channels = (int) [ 1, 2 ]") |
88 | ); | 88 | ); |
89 | 89 | ||
90 | GST_DEBUG_CATEGORY_STATIC (gst_siddec_debug); | ||
91 | #define GST_CAT_DEFAULT gst_siddec_debug | ||
90 | 92 | ||
91 | #define GST_TYPE_SID_CLOCK (gst_sid_clock_get_type()) | 93 | #define GST_TYPE_SID_CLOCK (gst_sid_clock_get_type()) |
92 | static GType | 94 | static GType |
@@ -123,9 +125,6 @@ gst_sid_memory_get_type (void) | |||
123 | return sid_memory_type; | 125 | return sid_memory_type; |
124 | } | 126 | } |
125 | 127 | ||
126 | static void gst_siddec_base_init (gpointer g_class); | ||
127 | static void gst_siddec_class_init (GstSidDec * klass); | ||
128 | static void gst_siddec_init (GstSidDec * siddec); | ||
129 | static void gst_siddec_finalize (GObject * object); | 128 | static void gst_siddec_finalize (GObject * object); |
130 | 129 | ||
131 | static GstFlowReturn gst_siddec_chain (GstPad * pad, GstBuffer * buffer); | 130 | static GstFlowReturn gst_siddec_chain (GstPad * pad, GstBuffer * buffer); |
@@ -141,34 +140,11 @@ static void gst_siddec_get_property (GObject * object, guint prop_id, | |||
141 | static void gst_siddec_set_property (GObject * object, guint prop_id, | 140 | static void gst_siddec_set_property (GObject * object, guint prop_id, |
142 | const GValue * value, GParamSpec * pspec); | 141 | const GValue * value, GParamSpec * pspec); |
143 | 142 | ||
144 | static GstElementClass *parent_class = NULL; | 143 | #define _do_init(bla) \ |
144 | GST_DEBUG_CATEGORY_INIT (gst_siddec_debug, "siddec", 0, "C64 sid song player"); | ||
145 | 145 | ||
146 | GType | 146 | GST_BOILERPLATE_FULL (GstSidDec, gst_siddec, GstElement, GST_TYPE_ELEMENT, |
147 | gst_siddec_get_type (void) | 147 | _do_init); |
148 | { | ||
149 | static GType siddec_type = 0; | ||
150 | |||
151 | if (G_UNLIKELY (siddec_type == 0)) { | ||
152 | static const GTypeInfo siddec_info = { | ||
153 | sizeof (GstSidDecClass), | ||
154 | gst_siddec_base_init, | ||
155 | NULL, | ||
156 | (GClassInitFunc) gst_siddec_class_init, | ||
157 | NULL, | ||
158 | NULL, | ||
159 | sizeof (GstSidDec), | ||
160 | 0, | ||
161 | (GInstanceInitFunc) gst_siddec_init, | ||
162 | NULL | ||
163 | }; | ||
164 | |||
165 | siddec_type = | ||
166 | g_type_register_static (GST_TYPE_ELEMENT, "GstSidDec", &siddec_info, | ||
167 | (GTypeFlags) 0); | ||
168 | } | ||
169 | |||
170 | return siddec_type; | ||
171 | } | ||
172 | 148 | ||
173 | static void | 149 | static void |
174 | gst_siddec_base_init (gpointer g_class) | 150 | gst_siddec_base_init (gpointer g_class) |
@@ -186,14 +162,12 @@ gst_siddec_base_init (gpointer g_class) | |||
186 | } | 162 | } |
187 | 163 | ||
188 | static void | 164 | static void |
189 | gst_siddec_class_init (GstSidDec * klass) | 165 | gst_siddec_class_init (GstSidDecClass * klass) |
190 | { | 166 | { |
191 | GObjectClass *gobject_class; | 167 | GObjectClass *gobject_class; |
192 | 168 | ||
193 | gobject_class = (GObjectClass *) klass; | 169 | gobject_class = (GObjectClass *) klass; |
194 | 170 | ||
195 | parent_class = GST_ELEMENT_CLASS (g_type_class_peek_parent (klass)); | ||
196 | |||
197 | gobject_class->finalize = gst_siddec_finalize; | 171 | gobject_class->finalize = gst_siddec_finalize; |
198 | gobject_class->set_property = gst_siddec_set_property; | 172 | gobject_class->set_property = gst_siddec_set_property; |
199 | gobject_class->get_property = gst_siddec_get_property; | 173 | gobject_class->get_property = gst_siddec_get_property; |
@@ -235,10 +209,9 @@ gst_siddec_class_init (GstSidDec * klass) | |||
235 | } | 209 | } |
236 | 210 | ||
237 | static void | 211 | static void |
238 | gst_siddec_init (GstSidDec * siddec) | 212 | gst_siddec_init (GstSidDec * siddec, GstSidDecClass * klass) |
239 | { | 213 | { |
240 | siddec->sinkpad = gst_pad_new_from_static_template (&sink_templ, "sink"); | 214 | siddec->sinkpad = gst_pad_new_from_static_template (&sink_templ, "sink"); |
241 | gst_pad_set_query_function (siddec->sinkpad, NULL); | ||
242 | gst_pad_set_event_function (siddec->sinkpad, gst_siddec_sink_event); | 215 | gst_pad_set_event_function (siddec->sinkpad, gst_siddec_sink_event); |
243 | gst_pad_set_chain_function (siddec->sinkpad, gst_siddec_chain); | 216 | gst_pad_set_chain_function (siddec->sinkpad, gst_siddec_chain); |
244 | gst_element_add_pad (GST_ELEMENT (siddec), siddec->sinkpad); | 217 | gst_element_add_pad (GST_ELEMENT (siddec), siddec->sinkpad); |
@@ -685,9 +658,7 @@ static void | |||
685 | gst_siddec_set_property (GObject * object, guint prop_id, const GValue * value, | 658 | gst_siddec_set_property (GObject * object, guint prop_id, const GValue * value, |
686 | GParamSpec * pspec) | 659 | GParamSpec * pspec) |
687 | { | 660 | { |
688 | GstSidDec *siddec; | 661 | GstSidDec *siddec = GST_SIDDEC (object); |
689 | |||
690 | siddec = GST_SIDDEC (object); | ||
691 | 662 | ||
692 | switch (prop_id) { | 663 | switch (prop_id) { |
693 | case PROP_TUNE: | 664 | case PROP_TUNE: |
@@ -715,7 +686,7 @@ gst_siddec_set_property (GObject * object, guint prop_id, const GValue * value, | |||
715 | siddec->config->forceSongSpeed = g_value_get_boolean (value); | 686 | siddec->config->forceSongSpeed = g_value_get_boolean (value); |
716 | break; | 687 | break; |
717 | default: | 688 | default: |
718 | /* G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); */ | 689 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
719 | return; | 690 | return; |
720 | } | 691 | } |
721 | siddec->engine->setConfig (*siddec->config); | 692 | siddec->engine->setConfig (*siddec->config); |
@@ -725,9 +696,7 @@ static void | |||
725 | gst_siddec_get_property (GObject * object, guint prop_id, GValue * value, | 696 | gst_siddec_get_property (GObject * object, guint prop_id, GValue * value, |
726 | GParamSpec * pspec) | 697 | GParamSpec * pspec) |
727 | { | 698 | { |
728 | GstSidDec *siddec; | 699 | GstSidDec *siddec = GST_SIDDEC (object); |
729 | |||
730 | siddec = GST_SIDDEC (object); | ||
731 | 700 | ||
732 | switch (prop_id) { | 701 | switch (prop_id) { |
733 | case PROP_TUNE: | 702 | case PROP_TUNE: |
@@ -758,7 +727,7 @@ gst_siddec_get_property (GObject * object, guint prop_id, GValue * value, | |||
758 | g_value_set_boxed (value, NULL); | 727 | g_value_set_boxed (value, NULL); |
759 | break; | 728 | break; |
760 | default: | 729 | default: |
761 | /* G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); */ | 730 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
762 | break; | 731 | break; |
763 | } | 732 | } |
764 | } | 733 | } |
@@ -770,9 +739,8 @@ plugin_init (GstPlugin * plugin) | |||
770 | GST_TYPE_SIDDEC); | 739 | GST_TYPE_SIDDEC); |
771 | } | 740 | } |
772 | 741 | ||
773 | /* FIXME: remove cast to gchar once we depend on core >= 0.10.14.1 */ | ||
774 | GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, | 742 | GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, |
775 | GST_VERSION_MINOR, | 743 | GST_VERSION_MINOR, |
776 | "siddec", | 744 | "siddec", |
777 | (gchar *) "Uses libsidplay to decode .sid files", | 745 | "Uses libsidplay to decode .sid files", |
778 | plugin_init, VERSION, "GPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN); | 746 | plugin_init, VERSION, "GPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN); |