gst/matroska/matroska-demux.c: Fix open-ended seeks in matroskademux

Original commit message from CVS:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_handle_seek_event):
Fix open-ended seeks in matroskademux
Patch by: Mark Nauwelaerts <manauw skynet be>
Fixes: #526557
This commit is contained in:
Mark Nauwelaerts 2008-04-14 13:38:32 +00:00 committed by Jan Schmidt
parent 2bdd92b2be
commit 8f2a1c0b5f
3 changed files with 20 additions and 9 deletions

View file

@ -1,3 +1,11 @@
2008-04-14 Jan Schmidt <Jan.Schmidt@sun.com>
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_handle_seek_event):
Fix open-ended seeks in matroskademux
Patch by: Mark Nauwelaerts <manauw skynet be>
Fixes: #526557
2008-04-14 Jan Schmidt <jan.schmidt@sun.com>
* tests/check/Makefile.am:

2
common

@ -1 +1 @@
Subproject commit bdc5172b0ba183be6d92e58cb51782c23e9f2127
Subproject commit f88ff852da7631ad2d0be835763da6d551a63883

View file

@ -1397,24 +1397,27 @@ gst_matroska_demux_handle_seek_event (GstMatroskaDemux * demux,
GST_OBJECT_LOCK (demux);
/* if nothing configured, play complete file */
if (cur == GST_CLOCK_TIME_NONE)
if (!GST_CLOCK_TIME_IS_VALID (cur))
cur = 0;
if (stop == GST_CLOCK_TIME_NONE)
if (!GST_CLOCK_TIME_IS_VALID (stop))
stop = demux->segment.duration;
/* prevent some calculations and comparisons involving INVALID */
segment_start = demux->segment.start;
segment_stop = demux->segment.stop;
if (!GST_CLOCK_TIME_IS_VALID (segment_start))
segment_start = 0;
if (!GST_CLOCK_TIME_IS_VALID (segment_stop))
segment_stop = demux->segment.duration;
if (cur_type == GST_SEEK_TYPE_SET)
segment_start = cur;
else if (cur_type == GST_SEEK_TYPE_CUR)
segment_start = demux->segment.start + cur;
else
segment_start = demux->segment.start;
segment_start += cur;
if (stop_type == GST_SEEK_TYPE_SET)
segment_stop = stop;
else if (stop_type == GST_SEEK_TYPE_CUR)
segment_stop = demux->segment.stop + stop;
else
segment_stop = demux->segment.stop;
segment_stop += stop;
segment_start = CLAMP (segment_start, 0, demux->segment.duration);
segment_stop = CLAMP (segment_stop, 0, demux->segment.duration);