Hi everybody,<br><br>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. <br>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<br>
<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/qt-gstreamer/html/player_2main_8cpp-example.html">http://gstreamer.freedesktop.org/data/doc/gstreamer/head/qt-gstreamer/html/player_2main_8cpp-example.html</a>)<br>
then create a stream volume and cast the pipeline to stream volume as follows:<br><br><span style="font-family: comic sans ms,sans-serif;">// Don't forget to include the headers first</span><br style="font-family: comic sans ms,sans-serif;">
<b><span style="font-family: comic sans ms,sans-serif;">#include <QGst/Pipeline></span><br style="font-family: comic sans ms,sans-serif;"><span style="font-family: comic sans ms,sans-serif;">#include <QGst/StreamVolume></span></b><br style="font-family: arial black,sans-serif;">
<pre style="font-family: arial black,sans-serif;" class="fragment"><a name="_a1"></a><b><font style="font-family: comic sans ms,sans-serif;" size="2"><a class="code" href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/qt-gstreamer/html/classQGlib_1_1RefPointer.html">QGst::PipelinePtr</a> m_pipeline = QGst::ElementFactory::make(<span class="stringliteral">"playbin2"</span>).dynamicCast<<a name="_a2"></a><a class="code" href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/qt-gstreamer/html/classQGst_1_1Pipeline.html" title="Wrapper class for GstPipeline.">QGst::Pipeline</a>>();<br>
Q</font><span style="font-family: comic sans ms,sans-serif;">Gst::StreamVolumePtr m_streamVolume = m_pipeline.dynamicCast<</span></b><b><b><span style="font-family: comic sans ms,sans-serif;"></span><font style="font-family: comic sans ms,sans-serif;" size="2">Q</font><span style="font-family: comic sans ms,sans-serif;">Gst::StreamVolume</span></b></b><b><span style="font-family: comic sans ms,sans-serif;">>(</span><span style="font-family: comic sans ms,sans-serif;">);</span></b><br>
</pre>Then you can use the stream volume functions setVolume(), volume() and setMuted(), isMuted() to set the volume or mute your audio/video.<br>You can find the last version of the Player example with added volume control here:<br>
<a href="https://bugzilla.gnome.org/show_bug.cgi?id=649040" target="_blank">https://bugzilla.gnome.org/show_bug.cgi?id=649040</a><br><br>Thanks to <span class="bz_comment_user"><span class="vcard"><span class="fn">Marco Ballesio & </span></span></span><span class="bz_comment_user"><span class="vcard"><span class="fn">George Kiagiadakis</span></span></span> for all their help and advice. Hope this would be useful to all. <br>
<br>Mert Tas<font color="#888888"><br></font>