diff options
author | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-07-21 13:51:20 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-07-21 13:51:20 +0200 |
commit | 86af4924cca30c2887cece5ffb7608c4a1667589 (patch) | |
tree | 6457c48a5522c600efdd8d51f62cea1f2b448418 | |
parent | 95e50d3598397a1248e756231a69114229a032e6 (diff) | |
download | gst-plugins-bad-86af4924cca30c2887cece5ffb7608c4a1667589.tar.gz gst-plugins-bad-86af4924cca30c2887cece5ffb7608c4a1667589.tar.bz2 gst-plugins-bad-86af4924cca30c2887cece5ffb7608c4a1667589.zip |
mxfdemux: Implement SEEKING query
-rw-r--r-- | gst/mxf/mxfdemux.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/gst/mxf/mxfdemux.c b/gst/mxf/mxfdemux.c index 5abd37ff..e646be8c 100644 --- a/gst/mxf/mxfdemux.c +++ b/gst/mxf/mxfdemux.c @@ -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); |