basesrc: don't handle SEEKING queries for formats that don't match the one the source...
authorRobin Stocker <robin@nibor.org>
Fri, 24 Jul 2009 08:50:19 +0000 (09:50 +0100)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Fri, 24 Jul 2009 10:54:31 +0000 (11:54 +0100)
Return FALSE in basesrc's default query handler when we get a SEEKING query for
a format that's not the one the source operates in. Previously (ie. before, in
the git version) we would return TRUE in that case and seekable=FALSE, which
is more correct, but causes backwards compatibility problems. (Before that
we would change the format of the query when answering, which was completely
broken since callers don't expect that or check for it). Since the SEEKING
query is a fairly recent addition, not all demuxers, parsers and decoders
implement it yet, in which case any SEEKING query by an application will
just be passed upstream where it will then be handled by basesrc. Now, if
e.g. totem does a SEEKING query for TIME format and we have a demuxer that
doesn't implement the query, basesrc would answer it with seekable=FALSE in
most cases, and totem can only take that as authoritative answer, not knowing
that the demuxer doesn't implement the SEEKING query. To avoid this, we make
basesrc return FALSE to SEEKING queries in unhandled formats. That way
applications like totem can fall back on assuming seekability depending on
whether a duration is available, or somesuch. Downstream elements doing
such queries are likely to equate an unhandled query with a non-seekable
response as well, so this should be an acceptable fix for the time being.

See #584838, #588944, #589423 and #589424.

libs/gst/base/gstbasesrc.c

index 5788706..f0a5287 100644 (file)
@@ -856,10 +856,14 @@ gst_base_src_default_query (GstBaseSrc * src, GstQuery * query)
       if (format == src->segment.format) {
         gst_query_set_seeking (query, src->segment.format,
             gst_base_src_seekable (src), 0, src->segment.duration);
+        res = TRUE;
       } else {
-        gst_query_set_seeking (query, format, FALSE, 0, -1);
+        /* FIXME 0.11: return TRUE + seekable=FALSE for SEEKING query here */
+        /* Don't reply to the query to make up for demuxers which don't
+         * handle the SEEKING query yet. Players like Totem will fall back
+         * to the duration when the SEEKING query isn't answered. */
+        res = FALSE;
       }
-      res = TRUE;
       break;
     }
     case GST_QUERY_SEGMENT: