summaryrefslogtreecommitdiffstats
path: root/gst/apetag
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.net>2007-03-12 17:56:54 +0000
committerTim-Philipp Müller <tim@centricular.net>2007-03-12 17:56:54 +0000
commitdbe62aba11fc589b3ec7ea335af8f97f2e047cd8 (patch)
treed4c7293bbb82431e2fcfa94937c9497975e2937e /gst/apetag
parent56fbcb676602fb5b13104cb9d9439be22c2e2e0d (diff)
gst/apetag/gsttagdemux.c: Fix handling of -1 values for start and stop values when seeking, and SEEK_CUR+SEEK_END her...
Original commit message from CVS: * gst/apetag/gsttagdemux.c: (gst_tag_demux_srcpad_event): Fix handling of -1 values for start and stop values when seeking, and SEEK_CUR+SEEK_END here as well.
Diffstat (limited to 'gst/apetag')
-rw-r--r--gst/apetag/gsttagdemux.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/gst/apetag/gsttagdemux.c b/gst/apetag/gsttagdemux.c
index 9baaebbe..b8560b93 100644
--- a/gst/apetag/gsttagdemux.c
+++ b/gst/apetag/gsttagdemux.c
@@ -732,12 +732,18 @@ gst_tag_demux_srcpad_event (GstPad * pad, GstEvent * event)
switch (cur_type) {
case GST_SEEK_TYPE_SET:
+ if (cur == -1)
+ cur = 0;
cur += tagdemux->priv->strip_start;
break;
case GST_SEEK_TYPE_CUR:
break;
case GST_SEEK_TYPE_END:
- cur += tagdemux->priv->strip_end;
+ /* Adjust the seek to be relative to the start of any end tag
+ * (note: 10 bytes before end is represented by stop=-10) */
+ if (cur > 0)
+ cur = 0;
+ cur -= tagdemux->priv->strip_end;
break;
default:
g_assert_not_reached ();
@@ -745,12 +751,19 @@ gst_tag_demux_srcpad_event (GstPad * pad, GstEvent * event)
}
switch (stop_type) {
case GST_SEEK_TYPE_SET:
- stop += tagdemux->priv->strip_start;
+ if (stop != -1) {
+ /* -1 means the end of the file, pass it upstream intact */
+ stop += tagdemux->priv->strip_start;
+ }
break;
case GST_SEEK_TYPE_CUR:
break;
case GST_SEEK_TYPE_END:
- stop += tagdemux->priv->strip_end;
+ /* Adjust the seek to be relative to the start of any end tag
+ * (note: 10 bytes before end is represented by stop=-10) */
+ if (stop > 0)
+ stop = 0;
+ stop -= tagdemux->priv->strip_end;
break;
default:
break;