controller: adapt to control-source type changes

This commit is contained in:
Stefan Sauer 2012-01-31 12:28:30 +01:00
parent 1696b14f8f
commit ace90e6e2b
2 changed files with 34 additions and 38 deletions

View file

@ -1695,25 +1695,24 @@ GST_END_TEST;
GST_START_TEST (test_controller_usability) GST_START_TEST (test_controller_usability)
{ {
GstInterpolationControlSource *csource; GstControlSource *cs;
GstTimedValueControlSource *cs; GstTimedValueControlSource *tvcs;
GstElement *volume; GstElement *volume;
volume = setup_volume (); volume = setup_volume ();
/* this shouldn't crash, whether this mode is implemented or not */ /* this shouldn't crash, whether this mode is implemented or not */
csource = gst_interpolation_control_source_new (); cs = gst_interpolation_control_source_new ();
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_CUBIC, NULL); g_object_set (cs, "mode", GST_INTERPOLATION_MODE_CUBIC, NULL);
gst_object_add_control_binding (GST_OBJECT_CAST (volume), gst_object_add_control_binding (GST_OBJECT_CAST (volume),
gst_direct_control_binding_new (GST_OBJECT_CAST (volume), "volume", gst_direct_control_binding_new (GST_OBJECT_CAST (volume), "volume", cs));
GST_CONTROL_SOURCE (csource)));
cs = (GstTimedValueControlSource *) csource; tvcs = (GstTimedValueControlSource *) cs;
gst_timed_value_control_source_set (cs, 0 * GST_SECOND, 0.0); gst_timed_value_control_source_set (tvcs, 0 * GST_SECOND, 0.0);
gst_timed_value_control_source_set (cs, 5 * GST_SECOND, 1.0); gst_timed_value_control_source_set (tvcs, 5 * GST_SECOND, 1.0);
gst_timed_value_control_source_set (cs, 10 * GST_SECOND, 0.0); gst_timed_value_control_source_set (tvcs, 10 * GST_SECOND, 0.0);
gst_object_unref (csource); gst_object_unref (cs);
cleanup_volume (volume); cleanup_volume (volume);
} }
@ -1722,7 +1721,7 @@ GST_END_TEST;
GST_START_TEST (test_controller_processing) GST_START_TEST (test_controller_processing)
{ {
GstInterpolationControlSource *csource; GstControlSource *cs;
GstElement *volume; GstElement *volume;
GstBuffer *inbuffer, *outbuffer; GstBuffer *inbuffer, *outbuffer;
GstCaps *caps; GstCaps *caps;
@ -1731,11 +1730,10 @@ GST_START_TEST (test_controller_processing)
volume = setup_volume (); volume = setup_volume ();
csource = gst_interpolation_control_source_new (); cs = gst_interpolation_control_source_new ();
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_CUBIC, NULL); g_object_set (cs, "mode", GST_INTERPOLATION_MODE_CUBIC, NULL);
gst_object_add_control_binding (GST_OBJECT_CAST (volume), gst_object_add_control_binding (GST_OBJECT_CAST (volume),
gst_direct_control_binding_new (GST_OBJECT_CAST (volume), "volume", gst_direct_control_binding_new (GST_OBJECT_CAST (volume), "volume", cs));
GST_CONTROL_SOURCE (csource)));
fail_unless (gst_element_set_state (volume, fail_unless (gst_element_set_state (volume,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, 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); fail_unless (memcmp (map.data, in, 4) == 0);
gst_buffer_unmap (outbuffer, &map); gst_buffer_unmap (outbuffer, &map);
gst_object_unref (csource); gst_object_unref (cs);
cleanup_volume (volume); cleanup_volume (volume);
} }

View file

@ -49,8 +49,8 @@ main (gint argc, gchar ** argv)
gint res = 1; gint res = 1;
GstElement *src, *mix = NULL, *sink; GstElement *src, *mix = NULL, *sink;
GstElement *bin; GstElement *bin;
GstInterpolationControlSource *csource1, *csource2; GstControlSource *cs1, *cs2;
GstTimedValueControlSource *cs; GstTimedValueControlSource *tvcs;
GstClock *clock; GstClock *clock;
GstClockID clock_id; GstClockID clock_id;
GstClockReturn wait_ret; GstClockReturn wait_ret;
@ -125,34 +125,32 @@ main (gint argc, gchar ** argv)
NULL); NULL);
gst_object_unref (src_pad); gst_object_unref (src_pad);
csource1 = gst_interpolation_control_source_new (); cs1 = gst_interpolation_control_source_new ();
csource2 = gst_interpolation_control_source_new (); cs2 = gst_interpolation_control_source_new ();
gst_object_add_control_binding (GST_OBJECT_CAST (src), gst_object_add_control_binding (GST_OBJECT_CAST (src),
gst_direct_control_binding_new (GST_OBJECT_CAST (src), "volume", gst_direct_control_binding_new (GST_OBJECT_CAST (src), "volume", cs1));
GST_CONTROL_SOURCE (csource1)));
gst_object_add_control_binding (GST_OBJECT_CAST (src), gst_object_add_control_binding (GST_OBJECT_CAST (src),
gst_direct_control_binding_new (GST_OBJECT_CAST (src), "freq", gst_direct_control_binding_new (GST_OBJECT_CAST (src), "freq", cs2));
GST_CONTROL_SOURCE (csource2)));
/* Set interpolation mode */ /* Set interpolation mode */
g_object_set (csource1, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL); g_object_set (cs1, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
g_object_set (csource2, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL); g_object_set (cs2, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
/* set control values */ /* set control values */
cs = (GstTimedValueControlSource *) csource1; tvcs = (GstTimedValueControlSource *) cs1;
gst_timed_value_control_source_set (cs, 0 * GST_SECOND, 0.0); gst_timed_value_control_source_set (tvcs, 0 * GST_SECOND, 0.0);
gst_timed_value_control_source_set (cs, 5 * GST_SECOND, 1.0); gst_timed_value_control_source_set (tvcs, 5 * GST_SECOND, 1.0);
gst_object_unref (csource1); gst_object_unref (cs1);
cs = (GstTimedValueControlSource *) csource2; tvcs = (GstTimedValueControlSource *) cs2;
gst_timed_value_control_source_set (cs, 0 * GST_SECOND, 20000.0 / 220.0); gst_timed_value_control_source_set (tvcs, 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 (tvcs, 2 * GST_SECOND, 20000.0 / 3520.0);
gst_timed_value_control_source_set (cs, 6 * GST_SECOND, 20000.0 / 440.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 */ /* prepare events */
flags = use_flush ? GST_SEEK_FLAG_FLUSH : GST_SEEK_FLAG_NONE; flags = use_flush ? GST_SEEK_FLAG_FLUSH : GST_SEEK_FLAG_NONE;
@ -248,8 +246,8 @@ main (gint argc, gchar ** argv)
/* cleanup */ /* cleanup */
gst_query_unref (pos); gst_query_unref (pos);
gst_object_unref (G_OBJECT (clock)); gst_object_unref (clock);
gst_object_unref (G_OBJECT (bin)); gst_object_unref (bin);
res = 0; res = 0;
Error: Error:
return (res); return (res);