mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
controller: adapt to control-source type changes
This commit is contained in:
parent
1696b14f8f
commit
ace90e6e2b
2 changed files with 34 additions and 38 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue