diff options
author | Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com> | 2010-03-03 04:22:54 (GMT) |
---|---|---|
committer | Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com> | 2010-03-03 04:22:54 (GMT) |
commit | 0994b819f6cbf550c067146324f24489d0b4fa1d (patch) | |
tree | fb176a30f03c1e21256d5883014fd48abc0aa3a0 /src | |
parent | c92b1da931a56f97bf1812db922d43c8f692de8f (diff) | |
download | Qt-0994b819f6cbf550c067146324f24489d0b4fa1d.zip Qt-0994b819f6cbf550c067146324f24489d0b4fa1d.tar.gz Qt-0994b819f6cbf550c067146324f24489d0b4fa1d.tar.bz2 |
Use mute property instead of setting volume to 0 if playbin2 is used.
Task-number: QTMOBILITY-67
Reviewed-by: Andrew den Exter
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp index e80e820..be2273b 100644 --- a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp +++ b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp @@ -314,21 +314,33 @@ bool QGstreamerPlayerSession::seek(qint64 ms) void QGstreamerPlayerSession::setVolume(int volume) { - m_volume = volume; - emit volumeChanged(m_volume); + if (m_volume != volume) { + m_volume = volume; - if (!m_muted && m_playbin) - g_object_set(G_OBJECT(m_playbin), "volume", m_volume/100.0, NULL); + if (m_playbin) { +#ifndef USE_PLAYBIN2 + if(!m_muted) +#endif + g_object_set(G_OBJECT(m_playbin), "volume", m_volume/100.0, NULL); + } + + emit volumeChanged(m_volume); + } } void QGstreamerPlayerSession::setMuted(bool muted) { - m_muted = muted; + if (m_muted != muted) { + m_muted = muted; - g_object_set(G_OBJECT(m_playbin), "volume", (m_muted ? 0 : m_volume/100.0), NULL); - - emit mutedStateChanged(m_muted); +#ifdef USE_PLAYBIN2 + g_object_set(G_OBJECT(m_playbin), "mute", m_muted, NULL); +#else + g_object_set(G_OBJECT(m_playbin), "volume", (m_muted ? 0 : m_volume/100.0), NULL); +#endif + emit mutedStateChanged(m_muted); + } } static void addTagToMap(const GstTagList *list, |