mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-21 15:56:42 +00:00
pitch-test: Don't use deprecated GstController API
This commit is contained in:
parent
2aea590153
commit
f96df5c17a
1 changed files with 19 additions and 3 deletions
|
@ -39,6 +39,7 @@ main (int argc, char **argv)
|
||||||
GstElement *sink;
|
GstElement *sink;
|
||||||
GstElement *pipeline;
|
GstElement *pipeline;
|
||||||
GstController *ctl;
|
GstController *ctl;
|
||||||
|
GstInterpolationControlSource *csource;
|
||||||
GValue val = { 0, };
|
GValue val = { 0, };
|
||||||
|
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
|
@ -69,8 +70,18 @@ main (int argc, char **argv)
|
||||||
gst_element_link_many (audiotestsrc, audioconvert1, pitch, audioconvert2,
|
gst_element_link_many (audiotestsrc, audioconvert1, pitch, audioconvert2,
|
||||||
sink, NULL);
|
sink, NULL);
|
||||||
|
|
||||||
ctl = gst_object_control_properties (G_OBJECT (pitch), "pitch", NULL);
|
if (!(ctl = gst_controller_new (G_OBJECT (pitch), "pitch", NULL))) {
|
||||||
gst_controller_set_interpolation_mode (ctl, "pitch", GST_INTERPOLATE_LINEAR);
|
g_print ("can't control pitch element\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
csource = gst_interpolation_control_source_new ();
|
||||||
|
gst_interpolation_control_source_set_interpolation_mode (csource,
|
||||||
|
GST_INTERPOLATE_LINEAR);
|
||||||
|
|
||||||
|
gst_controller_set_control_source (ctl, "pitch",
|
||||||
|
GST_CONTROL_SOURCE (csource));
|
||||||
|
|
||||||
|
|
||||||
g_value_init (&val, G_TYPE_FLOAT);
|
g_value_init (&val, G_TYPE_FLOAT);
|
||||||
|
|
||||||
|
@ -80,9 +91,11 @@ main (int argc, char **argv)
|
||||||
else
|
else
|
||||||
g_value_set_float (&val, 1.5);
|
g_value_set_float (&val, 1.5);
|
||||||
|
|
||||||
gst_controller_set (ctl, "pitch", i * GST_SECOND, &val);
|
gst_interpolation_control_source_set (csource, i * GST_SECOND, &val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_value_unset (&val);
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
||||||
g_print ("Running\n");
|
g_print ("Running\n");
|
||||||
g_main_loop_run (loop);
|
g_main_loop_run (loop);
|
||||||
|
@ -95,5 +108,8 @@ main (int argc, char **argv)
|
||||||
g_print ("Deleting pipeline\n");
|
g_print ("Deleting pipeline\n");
|
||||||
gst_object_unref (GST_OBJECT (pipeline));
|
gst_object_unref (GST_OBJECT (pipeline));
|
||||||
|
|
||||||
|
g_object_unref (csource);
|
||||||
|
g_object_unref (ctl);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue