summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Decina <alessandro.d@gmail.com>2012-04-05 06:18:28 +0200
committerAlessandro Decina <alessandro.d@gmail.com>2012-04-05 09:16:07 +0200
commitf4b292f994d36bc08ae8049d4b3150f141b95452 (patch)
tree942155cb638c5b5315d844054b3b8a6ef7b237b0
parentd36fe4593dc7d5460b16f0d9a2e66cde83880a5a (diff)
tsdemux: set correct newsegment fields on _TIME seeks
Forward the seek rate and set NS.start to the seek target so that decoders can apply clipping where necessary.
-rw-r--r--gst/mpegtsdemux/tsdemux.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/gst/mpegtsdemux/tsdemux.c b/gst/mpegtsdemux/tsdemux.c
index 8f4d78d9a..96eb75cd5 100644
--- a/gst/mpegtsdemux/tsdemux.c
+++ b/gst/mpegtsdemux/tsdemux.c
@@ -1449,11 +1449,26 @@ calculate_and_push_newsegment (GstTSDemux * demux, TSDemuxStream * stream)
}
if (!demux->segment_event) {
+ gint64 start, stop, time;
+
GST_DEBUG ("Calculating actual segment");
- /* FIXME : Set proper values */
+
+ if (demux->segment.format == GST_FORMAT_TIME) {
+ /* if we have a TIME segment, set NS.start to the target ts so downstream
+ * can clip
+ */
+ start = demux->segment.start;
+ stop = demux->segment.stop;
+ time = demux->segment.time;
+ } else {
+ /* ...else start from the first ts/pts */
+ start = firstts;
+ stop = GST_CLOCK_TIME_NONE;
+ time = firstts;
+ }
demux->segment_event =
- gst_event_new_new_segment_full (FALSE, 1.0, 1.0, GST_FORMAT_TIME,
- firstts, GST_CLOCK_TIME_NONE, firstts);
+ gst_event_new_new_segment_full (FALSE, demux->segment.rate,
+ demux->segment.applied_rate, GST_FORMAT_TIME, start, stop, time);
GST_EVENT_SRC (demux->segment_event) = gst_object_ref (demux);
}