summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorVincent Penquerc'h <vincent.penquerch@collabora.co.uk>2011-09-26 13:14:42 +0100
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2011-09-30 15:23:33 +0100
commitf94701261aeba3a9eaa9abee5ff644bcc627fa15 (patch)
treed52e52b5db795ff11a8887066ebe76565376da2d /libs
parenteeed4911700d9bbc58a1893a4886ef5545fe921c (diff)
baseparse: answer position query in stream time and try upstream first
Let the demuxer have first say as well. https://bugzilla.gnome.org/show_bug.cgi?id=659485
Diffstat (limited to 'libs')
-rw-r--r--libs/gst/base/gstbaseparse.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/libs/gst/base/gstbaseparse.c b/libs/gst/base/gstbaseparse.c
index 67e380a25..f95c3aa91 100644
--- a/libs/gst/base/gstbaseparse.c
+++ b/libs/gst/base/gstbaseparse.c
@@ -3148,22 +3148,24 @@ gst_base_parse_query (GstPad * pad, GstQuery * query)
GST_DEBUG_OBJECT (parse, "position query");
gst_query_parse_position (query, &format, NULL);
- GST_OBJECT_LOCK (parse);
- if (format == GST_FORMAT_BYTES) {
- dest_value = parse->priv->offset;
- res = TRUE;
- } else if (format == parse->segment.format &&
- GST_CLOCK_TIME_IS_VALID (parse->segment.last_stop)) {
- dest_value = parse->segment.last_stop;
- res = TRUE;
- }
- GST_OBJECT_UNLOCK (parse);
-
- if (res)
- gst_query_set_position (query, format, dest_value);
- else {
- res = gst_pad_query_default (pad, query);
- if (!res) {
+ /* try upstream first */
+ res = gst_pad_query_default (pad, query);
+ if (!res) {
+ /* Fall back on interpreting segment */
+ GST_OBJECT_LOCK (parse);
+ if (format == GST_FORMAT_BYTES) {
+ dest_value = parse->priv->offset;
+ res = TRUE;
+ } else if (format == parse->segment.format &&
+ GST_CLOCK_TIME_IS_VALID (parse->segment.last_stop)) {
+ dest_value = gst_segment_to_stream_time (&parse->segment,
+ parse->segment.format, parse->segment.last_stop);
+ res = TRUE;
+ }
+ GST_OBJECT_UNLOCK (parse);
+ if (res)
+ gst_query_set_position (query, format, dest_value);
+ else {
/* no precise result, upstream no idea either, then best estimate */
/* priv->offset is updated in both PUSH/PULL modes */
res = gst_base_parse_convert (parse,