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>
This commit is contained in:
Andras Becsi
2012-11-19 13:59:32 +01:00
committed by The Qt Project
parent d00113c6ac
commit 30bfb777f9

View File

@@ -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