mxfdemux: Implement SEEKING query

This commit is contained in:
Sebastian Dröge 2009-07-21 13:51:20 +02:00
parent 95e50d3598
commit 86af4924cc

View file

@ -3453,6 +3453,7 @@ gst_mxf_demux_src_query_type (GstPad * pad)
static const GstQueryType types[] = {
GST_QUERY_POSITION,
GST_QUERY_DURATION,
GST_QUERY_SEEKING,
0
};
@ -3545,6 +3546,33 @@ gst_mxf_demux_src_query (GstPad * pad, GstQuery * query)
ret = TRUE;
break;
}
case GST_QUERY_SEEKING:{
GstFormat fmt;
ret = TRUE;
gst_query_parse_seeking (query, &fmt, NULL, NULL, NULL);
if (fmt != GST_FORMAT_TIME) {
gst_query_set_seeking (query, fmt, FALSE, -1, -1);
goto done;
}
if (demux->random_access) {
gst_query_set_seeking (query, GST_FORMAT_TIME, TRUE, 0, -1);
} else {
GstQuery *peerquery = gst_query_new_seeking (GST_FORMAT_BYTES);
gboolean seekable;
seekable = gst_pad_peer_query (demux->sinkpad, peerquery);
if (seekable)
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, GST_FORMAT_TIME, FALSE, -1, -1);
}
break;
}
default:
/* else forward upstream */
ret = gst_pad_peer_query (demux->sinkpad, query);
@ -3806,6 +3834,33 @@ gst_mxf_demux_query (GstElement * element, GstQuery * query)
ret = TRUE;
break;
}
case GST_QUERY_SEEKING:{
GstFormat fmt;
ret = TRUE;
gst_query_parse_seeking (query, &fmt, NULL, NULL, NULL);
if (fmt != GST_FORMAT_TIME) {
gst_query_set_seeking (query, fmt, FALSE, -1, -1);
goto done;
}
if (demux->random_access) {
gst_query_set_seeking (query, GST_FORMAT_TIME, TRUE, 0, -1);
} else {
GstQuery *peerquery = gst_query_new_seeking (GST_FORMAT_BYTES);
gboolean seekable;
seekable = gst_pad_peer_query (demux->sinkpad, peerquery);
if (seekable)
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, GST_FORMAT_TIME, FALSE, -1, -1);
}
break;
}
default:
/* else forward upstream */
ret = gst_pad_peer_query (demux->sinkpad, query);