[0.11] gst-plugins-base: controller: adapt to control-source type changes

Stefan Kost ensonic at kemper.freedesktop.org
Tue Jan 31 03:30:46 PST 2012


Module: gst-plugins-base
Branch: 0.11
Commit: ace90e6e2bc8336e2550fceac34bcc303b558fe1
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=ace90e6e2bc8336e2550fceac34bcc303b558fe1

Author: Stefan Sauer <ensonic at users.sf.net>
Date:   Tue Jan 31 12:28:30 2012 +0100

controller: adapt to control-source type changes

---

 tests/check/elements/volume.c |   32 +++++++++++++++-----------------
 tests/icles/audio-trickplay.c |   40 +++++++++++++++++++---------------------
 2 files changed, 34 insertions(+), 38 deletions(-)

diff --git a/tests/check/elements/volume.c b/tests/check/elements/volume.c
index 04e675f..260c948 100644
--- a/tests/check/elements/volume.c
+++ b/tests/check/elements/volume.c
@@ -1695,25 +1695,24 @@ GST_END_TEST;
 
 GST_START_TEST (test_controller_usability)
 {
-  GstInterpolationControlSource *csource;
-  GstTimedValueControlSource *cs;
+  GstControlSource *cs;
+  GstTimedValueControlSource *tvcs;
   GstElement *volume;
 
   volume = setup_volume ();
 
   /* this shouldn't crash, whether this mode is implemented or not */
-  csource = gst_interpolation_control_source_new ();
-  g_object_set (csource, "mode", GST_INTERPOLATION_MODE_CUBIC, NULL);
+  cs = gst_interpolation_control_source_new ();
+  g_object_set (cs, "mode", GST_INTERPOLATION_MODE_CUBIC, NULL);
   gst_object_add_control_binding (GST_OBJECT_CAST (volume),
-      gst_direct_control_binding_new (GST_OBJECT_CAST (volume), "volume",
-          GST_CONTROL_SOURCE (csource)));
+      gst_direct_control_binding_new (GST_OBJECT_CAST (volume), "volume", cs));
 
-  cs = (GstTimedValueControlSource *) csource;
-  gst_timed_value_control_source_set (cs, 0 * GST_SECOND, 0.0);
-  gst_timed_value_control_source_set (cs, 5 * GST_SECOND, 1.0);
-  gst_timed_value_control_source_set (cs, 10 * GST_SECOND, 0.0);
+  tvcs = (GstTimedValueControlSource *) cs;
+  gst_timed_value_control_source_set (tvcs, 0 * GST_SECOND, 0.0);
+  gst_timed_value_control_source_set (tvcs, 5 * GST_SECOND, 1.0);
+  gst_timed_value_control_source_set (tvcs, 10 * GST_SECOND, 0.0);
 
-  gst_object_unref (csource);
+  gst_object_unref (cs);
 
   cleanup_volume (volume);
 }
@@ -1722,7 +1721,7 @@ GST_END_TEST;
 
 GST_START_TEST (test_controller_processing)
 {
-  GstInterpolationControlSource *csource;
+  GstControlSource *cs;
   GstElement *volume;
   GstBuffer *inbuffer, *outbuffer;
   GstCaps *caps;
@@ -1731,11 +1730,10 @@ GST_START_TEST (test_controller_processing)
 
   volume = setup_volume ();
 
-  csource = gst_interpolation_control_source_new ();
-  g_object_set (csource, "mode", GST_INTERPOLATION_MODE_CUBIC, NULL);
+  cs = gst_interpolation_control_source_new ();
+  g_object_set (cs, "mode", GST_INTERPOLATION_MODE_CUBIC, NULL);
   gst_object_add_control_binding (GST_OBJECT_CAST (volume),
-      gst_direct_control_binding_new (GST_OBJECT_CAST (volume), "volume",
-          GST_CONTROL_SOURCE (csource)));
+      gst_direct_control_binding_new (GST_OBJECT_CAST (volume), "volume", cs));
 
   fail_unless (gst_element_set_state (volume,
           GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
@@ -1762,7 +1760,7 @@ GST_START_TEST (test_controller_processing)
   fail_unless (memcmp (map.data, in, 4) == 0);
   gst_buffer_unmap (outbuffer, &map);
 
-  gst_object_unref (csource);
+  gst_object_unref (cs);
   cleanup_volume (volume);
 }
 
diff --git a/tests/icles/audio-trickplay.c b/tests/icles/audio-trickplay.c
index 20139b8..3665faa 100644
--- a/tests/icles/audio-trickplay.c
+++ b/tests/icles/audio-trickplay.c
@@ -49,8 +49,8 @@ main (gint argc, gchar ** argv)
   gint res = 1;
   GstElement *src, *mix = NULL, *sink;
   GstElement *bin;
-  GstInterpolationControlSource *csource1, *csource2;
-  GstTimedValueControlSource *cs;
+  GstControlSource *cs1, *cs2;
+  GstTimedValueControlSource *tvcs;
   GstClock *clock;
   GstClockID clock_id;
   GstClockReturn wait_ret;
@@ -125,34 +125,32 @@ main (gint argc, gchar ** argv)
       NULL);
   gst_object_unref (src_pad);
 
-  csource1 = gst_interpolation_control_source_new ();
-  csource2 = gst_interpolation_control_source_new ();
+  cs1 = gst_interpolation_control_source_new ();
+  cs2 = gst_interpolation_control_source_new ();
 
   gst_object_add_control_binding (GST_OBJECT_CAST (src),
-      gst_direct_control_binding_new (GST_OBJECT_CAST (src), "volume",
-          GST_CONTROL_SOURCE (csource1)));
+      gst_direct_control_binding_new (GST_OBJECT_CAST (src), "volume", cs1));
   gst_object_add_control_binding (GST_OBJECT_CAST (src),
-      gst_direct_control_binding_new (GST_OBJECT_CAST (src), "freq",
-          GST_CONTROL_SOURCE (csource2)));
+      gst_direct_control_binding_new (GST_OBJECT_CAST (src), "freq", cs2));
 
   /* Set interpolation mode */
 
-  g_object_set (csource1, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
-  g_object_set (csource2, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
+  g_object_set (cs1, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
+  g_object_set (cs2, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
 
   /* set control values */
-  cs = (GstTimedValueControlSource *) csource1;
-  gst_timed_value_control_source_set (cs, 0 * GST_SECOND, 0.0);
-  gst_timed_value_control_source_set (cs, 5 * GST_SECOND, 1.0);
+  tvcs = (GstTimedValueControlSource *) cs1;
+  gst_timed_value_control_source_set (tvcs, 0 * GST_SECOND, 0.0);
+  gst_timed_value_control_source_set (tvcs, 5 * GST_SECOND, 1.0);
 
-  gst_object_unref (csource1);
+  gst_object_unref (cs1);
 
-  cs = (GstTimedValueControlSource *) csource2;
-  gst_timed_value_control_source_set (cs, 0 * GST_SECOND, 20000.0 / 220.0);
-  gst_timed_value_control_source_set (cs, 2 * GST_SECOND, 20000.0 / 3520.0);
-  gst_timed_value_control_source_set (cs, 6 * GST_SECOND, 20000.0 / 440.0);
+  tvcs = (GstTimedValueControlSource *) cs2;
+  gst_timed_value_control_source_set (tvcs, 0 * GST_SECOND, 20000.0 / 220.0);
+  gst_timed_value_control_source_set (tvcs, 2 * GST_SECOND, 20000.0 / 3520.0);
+  gst_timed_value_control_source_set (tvcs, 6 * GST_SECOND, 20000.0 / 440.0);
 
-  gst_object_unref (csource2);
+  gst_object_unref (cs2);
 
   /* prepare events */
   flags = use_flush ? GST_SEEK_FLAG_FLUSH : GST_SEEK_FLAG_NONE;
@@ -248,8 +246,8 @@ main (gint argc, gchar ** argv)
 
   /* cleanup */
   gst_query_unref (pos);
-  gst_object_unref (G_OBJECT (clock));
-  gst_object_unref (G_OBJECT (bin));
+  gst_object_unref (clock);
+  gst_object_unref (bin);
   res = 0;
 Error:
   return (res);



More information about the gstreamer-commits mailing list