diff options
author | Edward Hervey <bilboed@bilboed.com> | 2014-10-30 11:17:12 +0100 |
---|---|---|
committer | Edward Hervey <bilboed@bilboed.com> | 2015-02-18 12:17:31 +0100 |
commit | c27471eb9e998455931b044c6d7927f442db2c4c (patch) | |
tree | 1fa846cc66c4a1528b23bfb18c6ccb1ce7c81508 | |
parent | 0f0ba23d5fd978a1db293872b56acf70db803cf0 (diff) |
qtdemux: WIP: Support non-default TIME SEGMENT at beginning
If we receive an initial TIME SEGMENT with a non-zero start value,
we need to adjust it to take into account the fact that the buffers
we will be pushing out will start from 0 (and not from the segment
start value).
This is just a workaround for now until the relationship of TIME
SEGMENT values and container formats has been clarified upstream.
-rw-r--r-- | gst/isomp4/qtdemux.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c index 23be06171..0ac2d6983 100644 --- a/gst/isomp4/qtdemux.c +++ b/gst/isomp4/qtdemux.c @@ -2028,11 +2028,23 @@ gst_qtdemux_handle_sink_event (GstPad * sinkpad, GstObject * parent, segment.duration = demux->segment.duration; segment.base = gst_segment_to_running_time (&demux->segment, GST_FORMAT_TIME, demux->segment.position); + if (demux->n_streams == 0 && segment.start != 0) { + GstClockTime backdrift = segment.start; + /* If this is not a segment update, we shift the segment start/stop */ + GST_DEBUG_OBJECT (demux, "Shifting segment back by %" GST_TIME_FORMAT, + GST_TIME_ARGS (backdrift)); + segment.start = 0; + segment.position = 0; + segment.base = 0; + if (GST_CLOCK_TIME_IS_VALID (segment.stop)) + segment.stop -= backdrift; + } gst_segment_copy_into (&segment, &demux->segment); GST_DEBUG_OBJECT (demux, "Pushing newseg %" GST_SEGMENT_FORMAT, &segment); segment_event = gst_event_new_segment (&segment); gst_event_set_seqnum (segment_event, gst_event_get_seqnum (event)); + gst_event_replace (&demux->pending_newsegment, segment_event); gst_qtdemux_push_event (demux, segment_event); /* clear leftover in current segment, if any */ |