summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDmytro Poplavskiy <dmytro.poplavskiy@nokia.com>2010-04-21 01:31:35 (GMT)
committerDmytro Poplavskiy <dmytro.poplavskiy@nokia.com>2010-04-21 01:57:28 (GMT)
commit84c0fb3a16a36704631738e98cac3f1a90330647 (patch)
treedd1be3d6636dede5b7a797403d706ed7a69fb0de /src
parent537594d794c9e5eb379e4a099781b4857e91cd68 (diff)
downloadQt-84c0fb3a16a36704631738e98cac3f1a90330647.zip
Qt-84c0fb3a16a36704631738e98cac3f1a90330647.tar.gz
Qt-84c0fb3a16a36704631738e98cac3f1a90330647.tar.bz2
Gstreamer media backend: preserve playback rate after seeks and media
changes. Reviewed-by: Andrew den Exter
Diffstat (limited to 'src')
-rw-r--r--src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp
index 724a595..6a44aa1 100644
--- a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp
+++ b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp
@@ -182,7 +182,7 @@ void QGstreamerPlayerSession::setPlaybackRate(qreal rate)
m_playbackRate = rate;
if (m_playbin) {
gst_element_seek(m_playbin, rate, GST_FORMAT_TIME,
- GstSeekFlags(GST_SEEK_FLAG_ACCURATE | GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_SEGMENT),
+ GstSeekFlags(GST_SEEK_FLAG_ACCURATE | GST_SEEK_FLAG_FLUSH),
GST_SEEK_TYPE_NONE,0,
GST_SEEK_TYPE_NONE,0 );
}
@@ -464,8 +464,16 @@ bool QGstreamerPlayerSession::seek(qint64 ms)
{
//seek locks when the video output sink is changing and pad is blocked
if (m_playbin && !m_pendingVideoSink && m_state != QMediaPlayer::StoppedState) {
+
gint64 position = qMax(ms,qint64(0)) * 1000000;
- return gst_element_seek_simple(m_playbin, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, position);
+ return gst_element_seek(m_playbin,
+ m_playbackRate,
+ GST_FORMAT_TIME,
+ GstSeekFlags(GST_SEEK_FLAG_ACCURATE | GST_SEEK_FLAG_FLUSH),
+ GST_SEEK_TYPE_SET,
+ position,
+ GST_SEEK_TYPE_NONE,
+ 0);
}
return false;
@@ -666,8 +674,11 @@ void QGstreamerPlayerSession::busMessage(const QGstreamerMessage &message)
setSeekable(true);
- if (!qFuzzyCompare(m_playbackRate, qreal(1.0)))
- setPlaybackRate(m_playbackRate);
+ if (!qFuzzyCompare(m_playbackRate, qreal(1.0))) {
+ qreal rate = m_playbackRate;
+ m_playbackRate = 1.0;
+ setPlaybackRate(rate);
+ }
if (m_renderer)
m_renderer->precessNewStream();