controller: adapt to control-source type changes
This commit is contained in:
parent
1dc8b0eab8
commit
cf0f205cca
@ -37,8 +37,8 @@ main (int argc, char **argv)
|
|||||||
GstElement *pitch;
|
GstElement *pitch;
|
||||||
GstElement *sink;
|
GstElement *sink;
|
||||||
GstElement *pipeline;
|
GstElement *pipeline;
|
||||||
GstInterpolationControlSource *csource;
|
GstControlSource *cs;
|
||||||
GstTimedValueControlSource *cs;
|
GstTimedValueControlSource *tvcs;
|
||||||
|
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
g_printerr ("Usage: %s <audiosink>\n", argv[0]);
|
g_printerr ("Usage: %s <audiosink>\n", argv[0]);
|
||||||
@ -68,19 +68,18 @@ main (int argc, char **argv)
|
|||||||
sink, NULL);
|
sink, NULL);
|
||||||
|
|
||||||
/* set up a controller */
|
/* set up a controller */
|
||||||
csource = gst_interpolation_control_source_new ();
|
cs = gst_interpolation_control_source_new ();
|
||||||
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
|
g_object_set (cs, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
|
||||||
|
|
||||||
gst_object_add_control_binding (pitch,
|
gst_object_add_control_binding (pitch,
|
||||||
gst_direct_control_binding_new (pitch, "pitch",
|
gst_direct_control_binding_new (pitch, "pitch", cs));
|
||||||
GST_CONTROL_SOURCE (csource)));
|
tvcs = (GstTimedValueControlSource *) cs;
|
||||||
cs = (GstTimedValueControlSource *) csource;
|
|
||||||
|
|
||||||
for (i = 0; i < 100; ++i) {
|
for (i = 0; i < 100; ++i) {
|
||||||
if (i % 2)
|
if (i % 2)
|
||||||
gst_timed_value_control_source_set (cs, i * GST_SECOND, 0.5);
|
gst_timed_value_control_source_set (tvcs, i * GST_SECOND, 0.5);
|
||||||
else
|
else
|
||||||
gst_timed_value_control_source_set (cs, i * GST_SECOND, 1.5);
|
gst_timed_value_control_source_set (tvcs, i * GST_SECOND, 1.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
||||||
@ -88,7 +87,7 @@ main (int argc, char **argv)
|
|||||||
g_main_loop_run (loop);
|
g_main_loop_run (loop);
|
||||||
|
|
||||||
/* clean up nicely */
|
/* clean up nicely */
|
||||||
gst_object_unref (csource);
|
gst_object_unref (cs);
|
||||||
g_print ("Returned, stopping playback\n");
|
g_print ("Returned, stopping playback\n");
|
||||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
gst_element_set_state (pipeline, GST_STATE_NULL);
|
||||||
g_print ("Deleting pipeline\n");
|
g_print ("Deleting pipeline\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user