gst/id3demux/gstid3demux.c: Fix handling of -1 values for start and stop values when...
authorJan Schmidt <thaytan@mad.scientist.com>
Mon, 12 Mar 2007 17:24:23 +0000 (17:24 +0000)
committerJan Schmidt <thaytan@mad.scientist.com>
Mon, 12 Mar 2007 17:24:23 +0000 (17:24 +0000)
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.

ChangeLog
gst/id3demux/gstid3demux.c

index 6dfd21a51d58626d80a20e42d540029e85fde870..3e66d6616267e7919f8a5b26aad1b1b9c0e755bd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-03-12  Jan Schmidt  <thaytan@mad.scientist.com>
+
+       * 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.
+
 2007-03-12  Tim-Philipp Müller  <tim at centricular dot net>
 
        * gst/id3demux/id3v2frames.c: (parse_picture_frame):
index 886264f6e085a4dd897880fe4e7d1ddef27d38de..6fec9dbdbcd1cc714d9997dc6162550e28e505d2 100644 (file)
@@ -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;