mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
dvdemux: Implement SEEKING query so we can actually seek if upstream can't seek in TIME
https://bugzilla.gnome.org/show_bug.cgi?id=767157
This commit is contained in:
parent
2f4b89fffe
commit
479a3bab18
1 changed files with 51 additions and 0 deletions
|
@ -637,6 +637,57 @@ gst_dvdemux_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
|||
gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
|
||||
break;
|
||||
}
|
||||
case GST_QUERY_SEEKING:
|
||||
{
|
||||
GstFormat fmt;
|
||||
GstQuery *peerquery;
|
||||
gboolean seekable;
|
||||
|
||||
gst_query_parse_seeking (query, &fmt, NULL, NULL, NULL);
|
||||
|
||||
/* We can only handle TIME seeks really */
|
||||
if (fmt != GST_FORMAT_TIME) {
|
||||
gst_query_set_seeking (query, fmt, FALSE, -1, -1);
|
||||
break;
|
||||
}
|
||||
|
||||
/* First ask upstream */
|
||||
if (gst_pad_peer_query (dvdemux->sinkpad, query)) {
|
||||
gst_query_parse_seeking (query, NULL, &seekable, NULL, NULL);
|
||||
if (seekable) {
|
||||
res = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
res = TRUE;
|
||||
|
||||
peerquery = gst_query_new_seeking (GST_FORMAT_BYTES);
|
||||
seekable = gst_pad_peer_query (dvdemux->sinkpad, peerquery);
|
||||
|
||||
if (seekable)
|
||||
gst_query_parse_seeking (peerquery, NULL, &seekable, NULL, NULL);
|
||||
gst_query_unref (peerquery);
|
||||
|
||||
if (seekable) {
|
||||
peerquery = gst_query_new_duration (GST_FORMAT_TIME);
|
||||
seekable = gst_dvdemux_src_query (pad, parent, peerquery);
|
||||
|
||||
if (seekable) {
|
||||
gint64 duration;
|
||||
|
||||
gst_query_parse_duration (peerquery, NULL, &duration);
|
||||
gst_query_set_seeking (query, GST_FORMAT_TIME, seekable, 0, duration);
|
||||
} else {
|
||||
gst_query_set_seeking (query, GST_FORMAT_TIME, FALSE, -1, -1);
|
||||
}
|
||||
|
||||
gst_query_unref (peerquery);
|
||||
} else {
|
||||
gst_query_set_seeking (query, GST_FORMAT_TIME, FALSE, -1, -1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
res = gst_pad_query_default (pad, parent, query);
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue