QGst::StreamVolume usage and example

Mert TAS mert.tas at gmail.com
Mon May 2 01:15:46 PDT 2011


Hi everybody,

If any of you are using the QGst library but could not figure out how to use
the QGst::StreamVolume functionality (like once I did :) this is the right
place.
Using QGst::StreamVolume is fairly simple. You just have to create a
pipeline from the playbin2 element that will play the audio/video (as in the
Player example
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/qt-gstreamer/html/player_2main_8cpp-example.html
)
then create a stream volume and cast the pipeline to stream volume as
follows:

// Don't forget to include the headers first
*#include <QGst/Pipeline>
#include <QGst/StreamVolume>*

*QGst::PipelinePtr
<http://gstreamer.freedesktop.org/data/doc/gstreamer/head/qt-gstreamer/html/classQGlib_1_1RefPointer.html>
m_pipeline  = QGst::ElementFactory::make("playbin2").dynamicCast<QGst::Pipeline
<http://gstreamer.freedesktop.org/data/doc/gstreamer/head/qt-gstreamer/html/classQGst_1_1Pipeline.html>>();
QGst::StreamVolumePtr m_streamVolume =
m_pipeline.dynamicCast<**QGst::StreamVolume**>();*

Then you can use the stream volume functions setVolume(), volume() and
setMuted(), isMuted() to set the volume or mute your audio/video.
You can find the last version of the Player example with added volume
control here:
https://bugzilla.gnome.org/show_bug.cgi?id=649040

Thanks to Marco Ballesio & George Kiagiadakis for all their help and advice.
Hope this would be useful to all.

Mert Tas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20110502/17d3e8d9/attachment.html>


More information about the gstreamer-devel mailing list