avidemux: correctly perform pull mode KEY_UNIT seeking
authorMark Nauwelaerts <mnauw@users.sourceforge.net>
Wed, 28 Dec 2016 12:23:11 +0000 (13:23 +0100)
committerMark Nauwelaerts <mnauw@users.sourceforge.net>
Wed, 28 Dec 2016 12:59:30 +0000 (13:59 +0100)
Rather amazingly (and equally unnoticed), keyunit seeking resulted in segments
where start != time (which is bogus for simple avi timeline).  So, properly
adjust the segment (start) rather than fiddling with segment time (only).

gst/avi/gstavidemux.c

index 245a691..3964163 100644 (file)
@@ -4499,14 +4499,16 @@ gst_avi_demux_do_seek (GstAviDemux * avi, GstSegment * segment,
     seek_time = stream->current_timestamp;
     GST_DEBUG_OBJECT (avi, "keyframe adjusted to %" GST_TIME_FORMAT,
         GST_TIME_ARGS (seek_time));
+    /* the seek time is always the position ... */
+    segment->position = seek_time;
+    /* ... and start and stream time when going forwards,
+     * otherwise only stop time */
+    if (segment->rate > 0.0)
+      segment->start = segment->time = seek_time;
+    else
+      segment->stop = seek_time;
   }
 
-  /* the seek time is also the position and stream time when going
-   * forwards */
-  segment->position = seek_time;
-  if (segment->rate > 0.0)
-    segment->time = seek_time;
-
   /* now set DISCONT and align the other streams */
   for (i = 0; i < avi->num_streams; i++) {
     GstAviStream *ostream;