avidemux: init current_entry in push mode
authorWim Taymans <wim.taymans@collabora.co.uk>
Fri, 4 Dec 2009 12:50:59 +0000 (13:50 +0100)
committerWim Taymans <wim.taymans@collabora.co.uk>
Fri, 4 Dec 2009 12:52:49 +0000 (13:52 +0100)
Set the current_entry to 0 (instead of -1) in push mode so that we correctly
calculate the current frame number and timestamp.

Add some more debug info and fic the duration debug.

gst/avi/gstavidemux.c

index 286a121..f9bb7c1 100644 (file)
@@ -2816,6 +2816,7 @@ gst_avi_demux_stream_header_push (GstAviDemux * avi)
   GstBuffer *buf = NULL, *sub = NULL;
   guint offset = 4;
   gint64 stop;
+  gint i;
 
   GST_DEBUG ("Reading and parsing avi headers: %d", avi->header_state);
 
@@ -3001,6 +3002,10 @@ skipping_done:
 
   gst_avi_demux_expose_streams (avi, TRUE);
 
+  /* prepare all streams for index 0 */
+  for (i = 0; i < avi->num_streams; i++)
+    avi->stream[i].current_entry = 0;
+
   /* create initial NEWSEGMENT event */
   if ((stop = avi->segment.stop) == GST_CLOCK_TIME_NONE)
     stop = avi->segment.duration;
@@ -4345,7 +4350,7 @@ gst_avi_demux_stream_data (GstAviDemux * avi)
             "Pushing buffer with time=%" GST_TIME_FORMAT ", duration %"
             GST_TIME_FORMAT ", offset %" G_GUINT64_FORMAT
             " and size %d over pad %s", GST_TIME_ARGS (next_ts),
-            GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)), GST_BUFFER_OFFSET (buf),
+            GST_TIME_ARGS (GST_BUFFER_DURATION (buf)), GST_BUFFER_OFFSET (buf),
             size, GST_PAD_NAME (stream->pad));
 
         /* update current position in the segment */
@@ -4353,6 +4358,7 @@ gst_avi_demux_stream_data (GstAviDemux * avi)
 
         /* mark discont when pending */
         if (G_UNLIKELY (stream->discont)) {
+          GST_DEBUG_OBJECT (avi, "Setting DISCONT");
           GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT);
           stream->discont = FALSE;
         }