mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
dvdemux: First query the peer duration in the requested format before converting to BYTES
Fixes usage of dvdemux after another demuxer, e.g. mxfdemux. Fixes bug #650503.
This commit is contained in:
parent
e376913fc3
commit
252c1afcc2
1 changed files with 9 additions and 14 deletions
|
@ -574,26 +574,23 @@ gst_dvdemux_src_query (GstPad * pad, GstQuery * query)
|
|||
GstFormat format;
|
||||
GstFormat format2;
|
||||
gint64 end;
|
||||
GstPad *peer;
|
||||
|
||||
/* get target format */
|
||||
gst_query_parse_duration (query, &format, NULL);
|
||||
/* First ask the peer in the original format */
|
||||
if (!gst_pad_peer_query (dvdemux->sinkpad, query)) {
|
||||
/* get target format */
|
||||
gst_query_parse_duration (query, &format, NULL);
|
||||
|
||||
/* change query to bytes to perform on peer */
|
||||
gst_query_set_duration (query, GST_FORMAT_BYTES, -1);
|
||||
/* change query to bytes to perform on peer */
|
||||
gst_query_set_duration (query, GST_FORMAT_BYTES, -1);
|
||||
|
||||
if ((peer = gst_pad_get_peer (dvdemux->sinkpad))) {
|
||||
/* ask peer for total length */
|
||||
if (!(res = gst_pad_query (peer, query))) {
|
||||
gst_object_unref (peer);
|
||||
/* Now ask the peer in BYTES format and try to convert */
|
||||
if (!gst_pad_peer_query (dvdemux->sinkpad, query)) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* get peer total length */
|
||||
gst_query_parse_duration (query, NULL, &end);
|
||||
|
||||
gst_object_unref (peer);
|
||||
|
||||
/* convert end to requested format */
|
||||
if (end != -1) {
|
||||
format2 = format;
|
||||
|
@ -601,11 +598,9 @@ gst_dvdemux_src_query (GstPad * pad, GstQuery * query)
|
|||
GST_FORMAT_BYTES, end, &format2, &end))) {
|
||||
goto error;
|
||||
}
|
||||
gst_query_set_duration (query, format, end);
|
||||
}
|
||||
} else {
|
||||
end = -1;
|
||||
}
|
||||
gst_query_set_duration (query, format, end);
|
||||
break;
|
||||
}
|
||||
case GST_QUERY_CONVERT:
|
||||
|
|
Loading…
Reference in a new issue