From 38e832cdef5925e406dd3626f39060cc5d5450f5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 29 Jul 2013 11:02:34 +0200 Subject: [PATCH] mpegdemux: Implement SEGMENT query --- gst/mpegdemux/gstmpegdemux.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/gst/mpegdemux/gstmpegdemux.c b/gst/mpegdemux/gstmpegdemux.c index 0e5f97f..f1306e1 100644 --- a/gst/mpegdemux/gstmpegdemux.c +++ b/gst/mpegdemux/gstmpegdemux.c @@ -1470,6 +1470,32 @@ gst_flups_demux_src_query (GstPad * pad, GstObject * parent, GstQuery * query) } break; } + case GST_QUERY_SEGMENT:{ + GstFormat format; + gint64 start, stop; + + format = demux->src_segment.format; + + start = + gst_segment_to_stream_time (&demux->src_segment, format, + demux->src_segment.start); + if ((stop = demux->src_segment.stop) == -1) + stop = demux->src_segment.duration; + else + stop = gst_segment_to_stream_time (&demux->src_segment, format, stop); + + if (demux->src_segment.rate < 0.0) { + gint64 tmp; + tmp = stop; + stop = start; + start = tmp; + } + + gst_query_set_segment (query, demux->src_segment.rate, format, start, + stop); + res = TRUE; + break; + } default: res = gst_pad_query_default (pad, parent, query); break; -- 2.7.4