diff options
author | Andras Becsi <andras.becsi@digia.com> | 2012-11-19 13:59:32 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-11-20 11:54:49 +0100 |
commit | 30bfb777f9870aea7938a12598a57f7882972c4b (patch) | |
tree | eedaa74f41824a133f4e234150a421d0498c87b3 /src | |
parent | d00113c6ac5e4fa32acac3bb51589bdb4a5932af (diff) |
Media is always set to be seekable with the gstreamer backend
Since the used mechanism for querying whether the media is seekable
was unreliable the code has been commented out and the media always
set to be seekable.
Query for seeking capabilities after the duration is known in
updateDuration() which retries to determine the duration multiple
times if unsuccessful and use gst_query_parse_seeking to check
if the media is seekable or not.
Change-Id: I141dfb1616dc59f8c92a698ddb2867f63a2656b9
Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp index 081893d73..1c23a6942 100644 --- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp +++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp @@ -1031,23 +1031,9 @@ bool QGstreamerPlayerSession::processBusMessage(const QGstreamerMessage &message //information is ready, GST_MESSAGE_DURATION is not sent by most elements //the duration is queried up to 5 times with increasing delay m_durationQueries = 5; + // This should also update the seekable flag. updateDuration(); - /* - //gst_element_seek_simple doesn't work reliably here, have to find a better solution - - GstFormat format = GST_FORMAT_TIME; - gint64 position = 0; - bool seekable = false; - if (gst_element_query_position(m_playbin, &format, &position)) { - seekable = gst_element_seek_simple(m_playbin, format, GST_SEEK_FLAG_NONE, position); - } - - setSeekable(seekable); - */ - - setSeekable(true); - if (!qFuzzyCompare(m_playbackRate, qreal(1.0))) { qreal rate = m_playbackRate; m_playbackRate = 1.0; @@ -1401,8 +1387,15 @@ void QGstreamerPlayerSession::updateDuration() emit durationChanged(m_duration); } - if (m_duration > 0) + gboolean seekable = false; + if (m_duration > 0) { m_durationQueries = 0; + GstQuery *query = gst_query_new_seeking(GST_FORMAT_TIME); + if (gst_element_query(m_playbin, query)) + gst_query_parse_seeking(query, 0, &seekable, 0, 0); + gst_query_unref(query); + } + setSeekable(seekable); if (m_durationQueries > 0) { //increase delay between duration requests |