diff options
author | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-07-21 13:33:58 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-07-21 13:33:58 +0200 |
commit | 1f88ceeba8c908360d508cab5ee439eaff89309f (patch) | |
tree | 0a46c4bf261cbaf0a76ffe683c8394c3384d481c | |
parent | e3f08983aadac760320f50da1d82769645689470 (diff) | |
download | gst-plugins-bad-1f88ceeba8c908360d508cab5ee439eaff89309f.tar.gz gst-plugins-bad-1f88ceeba8c908360d508cab5ee439eaff89309f.tar.bz2 gst-plugins-bad-1f88ceeba8c908360d508cab5ee439eaff89309f.zip |
mpegtsdemux: Implement SEEKING query
Partially fixes bug #588944.
-rw-r--r-- | gst/mpegdemux/gstmpegtsdemux.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/gst/mpegdemux/gstmpegtsdemux.c b/gst/mpegdemux/gstmpegtsdemux.c index 65539d0a..8de7cc75 100644 --- a/gst/mpegdemux/gstmpegtsdemux.c +++ b/gst/mpegdemux/gstmpegtsdemux.c @@ -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; |