From 30bfb777f9870aea7938a12598a57f7882972c4b Mon Sep 17 00:00:00 2001 From: Andras Becsi Date: Mon, 19 Nov 2012 13:59:32 +0100 Subject: 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 Reviewed-by: Yoann Lopes --- .../mediaplayer/qgstreamerplayersession.cpp | 25 ++++++++-------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp') 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 -- cgit v1.2.3