summaryrefslogtreecommitdiffstats
path: root/gst/id3demux
diff options
context:
space:
mode:
authorJan Schmidt <thaytan@mad.scientist.com>2007-03-12 17:24:23 +0000
committerJan Schmidt <thaytan@mad.scientist.com>2007-03-12 17:24:23 +0000
commit56fbcb676602fb5b13104cb9d9439be22c2e2e0d (patch)
treeda54abc08da5c89daa03ec12060b356ae1b1e986 /gst/id3demux
parent6d967b4bb06d2cf9644a6d49b0b7fc96d2b67fe0 (diff)
gst/id3demux/gstid3demux.c: Fix handling of -1 values for start and stop values when seeking, and SEEK_CUR+SEEK_END.
Original commit message from CVS: * gst/id3demux/gstid3demux.c: (gst_id3demux_srcpad_event): Fix handling of -1 values for start and stop values when seeking, and SEEK_CUR+SEEK_END.
Diffstat (limited to 'gst/id3demux')
-rw-r--r--gst/id3demux/gstid3demux.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/gst/id3demux/gstid3demux.c b/gst/id3demux/gstid3demux.c
index 886264f6..6fec9dbd 100644
--- a/gst/id3demux/gstid3demux.c
+++ b/gst/id3demux/gstid3demux.c
@@ -672,12 +672,17 @@ gst_id3demux_srcpad_event (GstPad * pad, GstEvent * event)
switch (cur_type) {
case GST_SEEK_TYPE_SET:
+ if (cur == -1)
+ cur = 0;
cur += id3demux->strip_start;
break;
case GST_SEEK_TYPE_CUR:
break;
case GST_SEEK_TYPE_END:
- cur += id3demux->strip_end;
+ /* Adjust the seek to be relative to the start of any ID3v1 tag */
+ if (cur > 0)
+ cur = 0;
+ cur -= id3demux->strip_end;
break;
default:
g_assert_not_reached ();
@@ -685,12 +690,18 @@ gst_id3demux_srcpad_event (GstPad * pad, GstEvent * event)
}
switch (stop_type) {
case GST_SEEK_TYPE_SET:
- stop += id3demux->strip_start;
+ if (stop != -1) {
+ /* -1 means the end of the file, pass it upstream intact */
+ stop += id3demux->strip_start;
+ }
break;
case GST_SEEK_TYPE_CUR:
break;
case GST_SEEK_TYPE_END:
- stop += id3demux->strip_end;
+ /* Adjust the seek to be relative to the start of any ID3v1 tag */
+ if (stop > 0)
+ stop = 0;
+ stop -= id3demux->strip_end;
break;
default:
break;