mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +00:00
parent
e3f08983aa
commit
1f88ceeba8
1 changed files with 45 additions and 0 deletions
|
@ -2778,9 +2778,54 @@ gst_mpegts_demux_src_pad_query (GstPad * pad, GstQuery * query)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case GST_QUERY_SEEKING:{
|
||||
GstFormat fmt;
|
||||
|
||||
gst_query_parse_seeking (query, &fmt, NULL, NULL, NULL);
|
||||
if (fmt == GST_FORMAT_BYTES) {
|
||||
/* Seeking in BYTES format not supported at all */
|
||||
gst_query_set_seeking (query, fmt, FALSE, -1, -1);
|
||||
} else {
|
||||
GstQuery *peerquery;
|
||||
gboolean seekable;
|
||||
|
||||
/* Then ask upstream */
|
||||
res = gst_pad_peer_query (demux->sinkpad, query);
|
||||
if (res) {
|
||||
/* If upstream can handle seeks we're done, if it
|
||||
* can't we still have our TIME->BYTES conversion seek
|
||||
*/
|
||||
gst_query_parse_seeking (query, NULL, &seekable, NULL, NULL);
|
||||
if (seekable || fmt != GST_FORMAT_TIME)
|
||||
goto beach;
|
||||
}
|
||||
|
||||
/* We can seek if upstream supports BYTES seeks and we
|
||||
* have a bitrate
|
||||
*/
|
||||
peerquery = gst_query_new_seeking (GST_FORMAT_BYTES);
|
||||
res = gst_pad_peer_query (demux->sinkpad, query);
|
||||
if (!res || demux->bitrate == -1) {
|
||||
gst_query_set_seeking (query, fmt, FALSE, -1, -1);
|
||||
} else {
|
||||
gst_query_parse_seeking (peerquery, NULL, &seekable, NULL, NULL);
|
||||
if (seekable)
|
||||
gst_query_set_seeking (query, GST_FORMAT_TIME, TRUE, 0, -1);
|
||||
else
|
||||
gst_query_set_seeking (query, fmt, FALSE, -1, -1);
|
||||
}
|
||||
|
||||
gst_query_unref (peerquery);
|
||||
res = TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
res = gst_pad_query_default (pad, query);
|
||||
break;
|
||||
}
|
||||
|
||||
beach:
|
||||
gst_object_unref (demux);
|
||||
|
||||
return res;
|
||||
|
|
Loading…
Reference in a new issue