ext/ffmpeg/gstffmpegdemux.c: Don't try to convert -1 values when seeking.
authorWim Taymans <wim.taymans@gmail.com>
Tue, 18 Apr 2006 11:02:04 +0000 (11:02 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Tue, 18 Apr 2006 11:02:04 +0000 (11:02 +0000)
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_perform_seek),
(gst_ffmpegdemux_loop):
Don't try to convert -1 values when seeking.
Adjust timestamps with start_time of the stream.

ChangeLog
ext/ffmpeg/gstffmpegdemux.c

index 4bb0aab..2a69c35 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-04-18  Wim Taymans  <wim@fluendo.com>
+
+       * ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_perform_seek),
+       (gst_ffmpegdemux_loop):
+       Don't try to convert -1 values when seeking.
+       Adjust timestamps with start_time of the stream.
+
 2006-04-13  Wim Taymans  <wim@fluendo.com>
 
        * ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_base_init),
index 8b96216..93a8340 100644 (file)
@@ -436,9 +436,9 @@ gst_ffmpegdemux_perform_seek (GstFFMpegDemux * demux, GstEvent *event)
       fmt = demux->segment.format;
       res = TRUE;
       /* FIXME, use source pad */
-      if (cur_type != GST_SEEK_TYPE_NONE)
+      if (cur_type != GST_SEEK_TYPE_NONE && cur != -1)
         res = gst_pad_query_convert (demux->sinkpad, format, cur, &fmt, &cur);
-      if (res && stop_type != GST_SEEK_TYPE_NONE)
+      if (res && stop_type != GST_SEEK_TYPE_NONE && stop != -1)
         res = gst_pad_query_convert (demux->sinkpad, format, stop, &fmt, &stop);
       if (!res)
         goto no_format;
@@ -1124,8 +1124,9 @@ gst_ffmpegdemux_loop (GstPad * pad)
   /* do timestamps, we do this first so that we can know when we
    * stepped over the segment stop position. */
   timestamp = gst_ffmpeg_time_ff_to_gst (pkt.pts, avstream->time_base);
-  if (GST_CLOCK_TIME_IS_VALID (timestamp))
+  if (GST_CLOCK_TIME_IS_VALID (timestamp)) {
     stream->last_ts = timestamp;
+  }
   duration = gst_ffmpeg_time_ff_to_gst (pkt.duration, avstream->time_base);
 
   GST_DEBUG_OBJECT (demux,
@@ -1134,11 +1135,16 @@ gst_ffmpegdemux_loop (GstPad * pad)
       GST_TIME_ARGS (timestamp), pkt.size, pkt.stream_index, pkt.flags, 
       GST_TIME_ARGS (duration), pkt.pos);
 
+  /* check start_time */
+  if (demux->start_time != -1 && demux->start_time > timestamp)
+    goto drop;
+
+  timestamp -= demux->start_time;
+
   /* check if we ran outside of the segment */
   if (demux->segment.stop != -1 && timestamp > demux->segment.stop)
     goto drop;
 
-
   /* prepare to push packet to peer */
   srcpad = stream->pad;