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
This commit is contained in:
Vincent Penquerc'h 2011-09-26 13:14:42 +01:00 committed by Tim-Philipp Müller
parent eeed491170
commit f94701261a

View file

@ -3148,22 +3148,24 @@ gst_base_parse_query (GstPad * pad, GstQuery * query)
GST_DEBUG_OBJECT (parse, "position query"); GST_DEBUG_OBJECT (parse, "position query");
gst_query_parse_position (query, &format, NULL); gst_query_parse_position (query, &format, NULL);
GST_OBJECT_LOCK (parse); /* try upstream first */
if (format == GST_FORMAT_BYTES) { res = gst_pad_query_default (pad, query);
dest_value = parse->priv->offset; if (!res) {
res = TRUE; /* Fall back on interpreting segment */
} else if (format == parse->segment.format && GST_OBJECT_LOCK (parse);
GST_CLOCK_TIME_IS_VALID (parse->segment.last_stop)) { if (format == GST_FORMAT_BYTES) {
dest_value = parse->segment.last_stop; dest_value = parse->priv->offset;
res = TRUE; res = TRUE;
} } else if (format == parse->segment.format &&
GST_OBJECT_UNLOCK (parse); GST_CLOCK_TIME_IS_VALID (parse->segment.last_stop)) {
dest_value = gst_segment_to_stream_time (&parse->segment,
if (res) parse->segment.format, parse->segment.last_stop);
gst_query_set_position (query, format, dest_value); res = TRUE;
else { }
res = gst_pad_query_default (pad, query); GST_OBJECT_UNLOCK (parse);
if (!res) { if (res)
gst_query_set_position (query, format, dest_value);
else {
/* no precise result, upstream no idea either, then best estimate */ /* no precise result, upstream no idea either, then best estimate */
/* priv->offset is updated in both PUSH/PULL modes */ /* priv->offset is updated in both PUSH/PULL modes */
res = gst_base_parse_convert (parse, res = gst_base_parse_convert (parse,