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_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,