equalizer: port to 0.11
authorMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
Thu, 30 Jun 2011 08:30:16 +0000 (10:30 +0200)
committerMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
Thu, 30 Jun 2011 08:30:16 +0000 (10:30 +0200)
gst/equalizer/gstiirequalizer.c
gst/equalizer/gstiirequalizer10bands.c
gst/equalizer/gstiirequalizer3bands.c
gst/equalizer/gstiirequalizernbands.c

index 0b767489ea8c0f26105ed7144d00195f9ecefd93..86b168d0cd9159e18c5ed2c340ca393e9d066caf 100644 (file)
@@ -61,21 +61,12 @@ static GstFlowReturn gst_iir_equalizer_transform_ip (GstBaseTransform * btrans,
     " rate=(int)[1000,MAX],"                                          \
     " channels=(int)[1,MAX]"
 
-static void
-_do_init (GType object_type)
-{
-  const GInterfaceInfo child_proxy_interface_info = {
-    (GInterfaceInitFunc) gst_iir_equalizer_child_proxy_interface_init,
-    NULL,                       /* interface_finalize */
-    NULL                        /* interface_data */
-  };
-
-  g_type_add_interface_static (object_type, GST_TYPE_CHILD_PROXY,
-      &child_proxy_interface_info);
-}
+#define gst_iir_equalizer_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstIirEqualizer, gst_iir_equalizer,
+    GST_TYPE_AUDIO_FILTER,
+    G_IMPLEMENT_INTERFACE (GST_TYPE_CHILD_PROXY,
+        gst_iir_equalizer_child_proxy_interface_init));
 
-GST_BOILERPLATE_FULL (GstIirEqualizer, gst_iir_equalizer,
-    GstAudioFilter, GST_TYPE_AUDIO_FILTER, _do_init);
 
 /* child object */
 
@@ -363,31 +354,25 @@ gst_iir_equalizer_child_proxy_interface_init (gpointer g_iface,
 
 /* equalizer implementation */
 
-static void
-gst_iir_equalizer_base_init (gpointer g_class)
-{
-  GstAudioFilterClass *audiofilter_class = GST_AUDIO_FILTER_CLASS (g_class);
-  GstCaps *caps;
-
-  caps = gst_caps_from_string (ALLOWED_CAPS);
-  gst_audio_filter_class_add_pad_templates (audiofilter_class, caps);
-  gst_caps_unref (caps);
-}
-
 static void
 gst_iir_equalizer_class_init (GstIirEqualizerClass * klass)
 {
   GstAudioFilterClass *audio_filter_class = (GstAudioFilterClass *) klass;
   GstBaseTransformClass *btrans_class = (GstBaseTransformClass *) klass;
   GObjectClass *gobject_class = (GObjectClass *) klass;
+  GstCaps *caps;
 
   gobject_class->finalize = gst_iir_equalizer_finalize;
   audio_filter_class->setup = gst_iir_equalizer_setup;
   btrans_class->transform_ip = gst_iir_equalizer_transform_ip;
+
+  caps = gst_caps_from_string (ALLOWED_CAPS);
+  gst_audio_filter_class_add_pad_templates (audio_filter_class, caps);
+  gst_caps_unref (caps);
 }
 
 static void
-gst_iir_equalizer_init (GstIirEqualizer * eq, GstIirEqualizerClass * g_class)
+gst_iir_equalizer_init (GstIirEqualizer * eq)
 {
   eq->bands_lock = g_mutex_new ();
   eq->need_new_coefficients = TRUE;
@@ -832,6 +817,8 @@ gst_iir_equalizer_transform_ip (GstBaseTransform * btrans, GstBuffer * buf)
   GstAudioFilter *filter = GST_AUDIO_FILTER (btrans);
   GstIirEqualizer *equ = GST_IIR_EQUALIZER (btrans);
   GstClockTime timestamp;
+  guint8 *data;
+  gsize size;
 
   if (G_UNLIKELY (filter->format.channels < 1 || equ->process == NULL))
     return GST_FLOW_NOT_NEGOTIATED;
@@ -853,8 +840,9 @@ gst_iir_equalizer_transform_ip (GstBaseTransform * btrans, GstBuffer * buf)
   if (GST_CLOCK_TIME_IS_VALID (timestamp))
     gst_object_sync_values (G_OBJECT (equ), timestamp);
 
-  equ->process (equ, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf),
-      filter->format.channels);
+  data = gst_buffer_map (buf, &size, NULL, GST_MAP_WRITE);
+  equ->process (equ, data, size, filter->format.channels);
+  gst_buffer_unmap (buf, data, size);
 
   return GST_FLOW_OK;
 }
index b39515c8a8a92bad3ae990e2b68756e1c4dd8e0d..5dc790b85e2a5dd8d40359c02bd5a3829f67eeaa 100644 (file)
@@ -62,39 +62,17 @@ GST_DEBUG_CATEGORY_EXTERN (equalizer_debug);
 #define GST_CAT_DEFAULT equalizer_debug
 
 
-static void
-_do_init (GType object_type)
-{
-  const GInterfaceInfo preset_interface_info = {
-    NULL,                       /* interface_init */
-    NULL,                       /* interface_finalize */
-    NULL                        /* interface_data */
-  };
-
-  g_type_add_interface_static (object_type, GST_TYPE_PRESET,
-      &preset_interface_info);
-}
-
-GST_BOILERPLATE_FULL (GstIirEqualizer10Bands, gst_iir_equalizer_10bands,
-    GstIirEqualizer, GST_TYPE_IIR_EQUALIZER, _do_init);
+#define gst_iir_equalizer_10bands_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstIirEqualizer10Bands, gst_iir_equalizer_10bands,
+    GST_TYPE_IIR_EQUALIZER, G_IMPLEMENT_INTERFACE (GST_TYPE_PRESET, NULL));
 
 /* equalizer implementation */
 
-static void
-gst_iir_equalizer_10bands_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_set_details_simple (element_class, "10 Band Equalizer",
-      "Filter/Effect/Audio",
-      "Direct Form 10 band IIR equalizer",
-      "Stefan Kost <ensonic@users.sf.net>");
-}
-
 static void
 gst_iir_equalizer_10bands_class_init (GstIirEqualizer10BandsClass * klass)
 {
   GObjectClass *gobject_class = (GObjectClass *) klass;
+  GstElementClass *gstelement_class = (GstElementClass *) klass;
 
   gobject_class->set_property = gst_iir_equalizer_10bands_set_property;
   gobject_class->get_property = gst_iir_equalizer_10bands_get_property;
@@ -149,11 +127,15 @@ gst_iir_equalizer_10bands_class_init (GstIirEqualizer10BandsClass * klass)
           "gain for the frequency band 15011 Hz, ranging from -24 dB to +12 dB",
           -24.0, 12.0, 0.0,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
+
+  gst_element_class_set_details_simple (gstelement_class, "10 Band Equalizer",
+      "Filter/Effect/Audio",
+      "Direct Form 10 band IIR equalizer",
+      "Stefan Kost <ensonic@users.sf.net>");
 }
 
 static void
-gst_iir_equalizer_10bands_init (GstIirEqualizer10Bands * equ_n,
-    GstIirEqualizer10BandsClass * g_class)
+gst_iir_equalizer_10bands_init (GstIirEqualizer10Bands * equ_n)
 {
   GstIirEqualizer *equ = GST_IIR_EQUALIZER (equ_n);
 
index 733c5b883b47442989533b17a9fb91c1ff900374..513b9204df332828196efea9dfff594335c59932 100644 (file)
@@ -53,39 +53,17 @@ static void gst_iir_equalizer_3bands_get_property (GObject * object,
 GST_DEBUG_CATEGORY_EXTERN (equalizer_debug);
 #define GST_CAT_DEFAULT equalizer_debug
 
-
-static void
-_do_init (GType object_type)
-{
-  const GInterfaceInfo preset_interface_info = {
-    NULL,                       /* interface_init */
-    NULL,                       /* interface_finalize */
-    NULL                        /* interface_data */
-  };
-
-  g_type_add_interface_static (object_type, GST_TYPE_PRESET,
-      &preset_interface_info);
-}
-
-GST_BOILERPLATE_FULL (GstIirEqualizer3Bands, gst_iir_equalizer_3bands,
-    GstIirEqualizer, GST_TYPE_IIR_EQUALIZER, _do_init);
+#define gst_iir_equalizer_3bands_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstIirEqualizer3Bands, gst_iir_equalizer_3bands,
+    GST_TYPE_IIR_EQUALIZER, G_IMPLEMENT_INTERFACE (GST_TYPE_PRESET, NULL));
 
 /* equalizer implementation */
 
-static void
-gst_iir_equalizer_3bands_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_set_details_simple (element_class, "3 Band Equalizer",
-      "Filter/Effect/Audio",
-      "Direct Form 3 band IIR equalizer", "Stefan Kost <ensonic@users.sf.net>");
-}
-
 static void
 gst_iir_equalizer_3bands_class_init (GstIirEqualizer3BandsClass * klass)
 {
   GObjectClass *gobject_class = (GObjectClass *) klass;
+  GstElementClass *gstelement_class = (GstElementClass *) klass;
 
   gobject_class->set_property = gst_iir_equalizer_3bands_set_property;
   gobject_class->get_property = gst_iir_equalizer_3bands_get_property;
@@ -105,11 +83,14 @@ gst_iir_equalizer_3bands_class_init (GstIirEqualizer3BandsClass * klass)
           "gain for the frequency band 11 kHz, ranging from -24.0 to +12.0",
           -24.0, 12.0, 0.0,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
+
+  gst_element_class_set_details_simple (gstelement_class, "3 Band Equalizer",
+      "Filter/Effect/Audio",
+      "Direct Form 3 band IIR equalizer", "Stefan Kost <ensonic@users.sf.net>");
 }
 
 static void
-gst_iir_equalizer_3bands_init (GstIirEqualizer3Bands * equ_n,
-    GstIirEqualizer3BandsClass * g_class)
+gst_iir_equalizer_3bands_init (GstIirEqualizer3Bands * equ_n)
 {
   GstIirEqualizer *equ = GST_IIR_EQUALIZER (equ_n);
 
index b5071953a223119a6e2c5fe514c92b3da7d3aa01..3ea40a292f0d56156733a2de2e4512a226933d87 100644 (file)
@@ -97,26 +97,17 @@ static void gst_iir_equalizer_nbands_get_property (GObject * object,
 GST_DEBUG_CATEGORY_EXTERN (equalizer_debug);
 #define GST_CAT_DEFAULT equalizer_debug
 
-GST_BOILERPLATE (GstIirEqualizerNBands, gst_iir_equalizer_nbands,
-    GstIirEqualizer, GST_TYPE_IIR_EQUALIZER);
+#define gst_iir_equalizer_nbands_parent_class parent_class
+G_DEFINE_TYPE (GstIirEqualizerNBands, gst_iir_equalizer_nbands,
+    GST_TYPE_IIR_EQUALIZER);
 
 /* equalizer implementation */
 
-static void
-gst_iir_equalizer_nbands_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_set_details_simple (element_class, "N Band Equalizer",
-      "Filter/Effect/Audio",
-      "Direct Form IIR equalizer",
-      "Benjamin Otte <otte@gnome.org>," " Stefan Kost <ensonic@users.sf.net>");
-}
-
 static void
 gst_iir_equalizer_nbands_class_init (GstIirEqualizerNBandsClass * klass)
 {
   GObjectClass *gobject_class = (GObjectClass *) klass;
+  GstElementClass *gstelement_class = (GstElementClass *) klass;
 
   gobject_class->set_property = gst_iir_equalizer_nbands_set_property;
   gobject_class->get_property = gst_iir_equalizer_nbands_get_property;
@@ -125,11 +116,15 @@ gst_iir_equalizer_nbands_class_init (GstIirEqualizerNBandsClass * klass)
       g_param_spec_uint ("num-bands", "num-bands",
           "number of different bands to use", 1, 64, 10,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT));
+
+  gst_element_class_set_details_simple (gstelement_class, "N Band Equalizer",
+      "Filter/Effect/Audio",
+      "Direct Form IIR equalizer",
+      "Benjamin Otte <otte@gnome.org>," " Stefan Kost <ensonic@users.sf.net>");
 }
 
 static void
-gst_iir_equalizer_nbands_init (GstIirEqualizerNBands * equ_n,
-    GstIirEqualizerNBandsClass * g_class)
+gst_iir_equalizer_nbands_init (GstIirEqualizerNBands * equ_n)
 {
   GstIirEqualizer *equ = GST_IIR_EQUALIZER (equ_n);