playbin and volume in C++
Marco Trapanese
marcotrapanese at gmail.com
Sun Jun 29 23:29:10 PDT 2014
Hello,
from command line I type:
gst-launch-1.0 playbin uri=file:///path-to-mp4 audio-sink=alsasink
volume=1.0
and it just works.
Now I want to do the same from a C++ application:
GstElement *pipeline;
GstElement *audiosink;
GstElement *volume;
pipeline = gst_element_factory_make("playbin", "player");
g_object_set(G_OBJECT(pipeline), "uri", "path-to-mp4", NULL);
volume = gst_element_factory_make("volume", "volume");
g_object_set (G_OBJECT(pipeline), "volume", volume, 1.0, NULL);
audiosink = gst_element_factory_make ("alsasink", "audio_sink");
g_object_set (G_OBJECT(pipeline), "audio-sink", audiosink, NULL);
gst_element_set_state(GST_ELEMENT(pipeline), GST_STATE_PLAYING);
But the audio doesn't work. If I remove the two "volume" lines it works.
Where is the mistake?
When the pipeline is playing will I be able to change the volume just
calling again the g_object_set with another volume value?
Thanks!
Marco
More information about the gstreamer-devel
mailing list