From 7fb7129a832b4f69800eb4b49ed2a99904ed2e7c Mon Sep 17 00:00:00 2001 From: Guillaume Emont Date: Wed, 13 Oct 2010 21:38:06 +0200 Subject: [PATCH] mpeg2dec: fix position query by trusting upstream Position queries are badly handled for DVDs (probably due to the division in chapters): the time returned was the time since the start of chapter. Now ask upstream for position queries, fall back to the old code if upstream cannot answer the query. --- ext/mpeg2dec/gstmpeg2dec.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ext/mpeg2dec/gstmpeg2dec.c b/ext/mpeg2dec/gstmpeg2dec.c index acd4846dd4..f13778f67c 100644 --- a/ext/mpeg2dec/gstmpeg2dec.c +++ b/ext/mpeg2dec/gstmpeg2dec.c @@ -1525,8 +1525,18 @@ gst_mpeg2dec_src_query (GstPad * pad, GstQuery * query) case GST_QUERY_POSITION: { GstFormat format; + GstPad *peer; gint64 cur; + /* First, we try to ask upstream, which might know better, especially in + * the case of DVDs, with multiple chapter */ + if ((peer = gst_pad_get_peer (mpeg2dec->sinkpad)) != NULL) { + res = gst_pad_query (peer, query); + gst_object_unref (peer); + if (res) + break; + } + /* save requested format */ gst_query_parse_position (query, &format, NULL); -- 2.34.1