diff options
author | Seungha Yang <seungha@centricular.com> | 2020-11-11 18:21:25 +0900 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2020-11-23 21:07:39 +0000 |
commit | 42df886601d7b689cc94483f84dbdb952a1ffab8 (patch) | |
tree | 3334d2938aeaba9a4c9158fbcc0e2b64a9db3921 | |
parent | e700b7b4c64732aa40656043660b14992fa0a329 (diff) | |
download | gstreamer-plugins-bad-42df886601d7b689cc94483f84dbdb952a1ffab8.tar.gz |
mpegdemux: Set duration on seeking query if possible
Set duration on seeking query in the same way as duration query handler.
Otherwise application might get confused as if the duration is unknown.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1831>
-rw-r--r-- | gst/mpegdemux/gstmpegdemux.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/gst/mpegdemux/gstmpegdemux.c b/gst/mpegdemux/gstmpegdemux.c index e9003773f..fbf7b6e34 100644 --- a/gst/mpegdemux/gstmpegdemux.c +++ b/gst/mpegdemux/gstmpegdemux.c @@ -1557,10 +1557,14 @@ gst_ps_demux_src_query (GstPad * pad, GstObject * parent, GstQuery * query) if (demux->random_access) { /* In pull mode we can seek in TIME format if we have the SCR */ if (fmt != GST_FORMAT_TIME || demux->scr_rate_n == G_MAXUINT64 - || demux->scr_rate_d == G_MAXUINT64) + || demux->scr_rate_d == G_MAXUINT64) { gst_query_set_seeking (query, fmt, FALSE, -1, -1); - else - gst_query_set_seeking (query, fmt, TRUE, 0, -1); + } else { + gint64 dur = -1; + if (GST_CLOCK_TIME_IS_VALID (demux->src_segment.duration)) + dur = demux->src_segment.duration; + gst_query_set_seeking (query, fmt, TRUE, 0, dur); + } } else { if (fmt == GST_FORMAT_BYTES) { /* Seeking in BYTES format not supported at all */ |