flvdemux: Implement SEEKING query

Also add some more query types to the answer of the query type function.

Fixes bug #589424.
This commit is contained in:
Sebastian Dröge 2009-07-23 11:50:16 +02:00
parent 375976c847
commit aa02444768
2 changed files with 28 additions and 0 deletions

View file

@ -1077,6 +1077,32 @@ gst_flv_demux_query (GstPad * pad, GstQuery * query)
break;
}
case GST_QUERY_SEEKING:{
GstFormat fmt;
gst_query_parse_seeking (query, &fmt, NULL, NULL, NULL);
res = TRUE;
if (fmt != GST_FORMAT_TIME || !demux->index) {
gst_query_set_seeking (query, fmt, FALSE, -1, -1);
} else if (demux->random_access) {
gst_query_set_seeking (query, GST_FORMAT_TIME, TRUE, 0,
demux->duration);
} else {
GstQuery *peerquery = gst_query_new_seeking (GST_FORMAT_BYTES);
gboolean seekable = gst_pad_peer_query (demux->sinkpad, peerquery);
if (seekable)
gst_query_parse_seeking (peerquery, NULL, &seekable, NULL, NULL);
gst_query_unref (peerquery);
if (seekable)
gst_query_set_seeking (query, GST_FORMAT_TIME, seekable, 0,
demux->duration);
else
gst_query_set_seeking (query, GST_FORMAT_TIME, FALSE, -1, -1);
}
break;
}
case GST_QUERY_LATENCY:
default:
{

View file

@ -65,6 +65,8 @@ gst_flv_demux_query_types (GstPad * pad)
{
static const GstQueryType query_types[] = {
GST_QUERY_DURATION,
GST_QUERY_POSITION,
GST_QUERY_SEEKING,
0
};