avidemux: skip RIFF and index in push mode
authorWim Taymans <wim.taymans@collabora.co.uk>
Tue, 19 Jan 2010 17:37:31 +0000 (18:37 +0100)
committerWim Taymans <wim.taymans@collabora.co.uk>
Wed, 20 Jan 2010 10:47:04 +0000 (11:47 +0100)
When we are in push mode, we can encounter RIFF and idx tags in the data chunk
when we are dealing with ODML files. In these cases, simply skip the chunks and
continue streaming instead of going EOS.

gst/avi/gstavidemux.c

index 1dc5b11..4d8ccf8 100644 (file)
@@ -4438,10 +4438,23 @@ gst_avi_demux_stream_data (GstAviDemux * avi)
         gst_adapter_flush (avi->adapter, 8 + GST_ROUND_UP_2 (size));
       }
       return GST_FLOW_OK;
+    } else if (tag == GST_RIFF_TAG_RIFF) {
+      /* RIFF tags can appear in ODML files, just jump over them */
+      if (gst_adapter_available (avi->adapter) >= 12) {
+        GST_DEBUG ("Found RIFF tag, skipping RIFF header");
+        gst_adapter_flush (avi->adapter, 12);
+        continue;
+      }
+      return GST_FLOW_OK;
     } else if (tag == GST_RIFF_TAG_idx1) {
-      GST_DEBUG ("Found index tag, stream done");
-      avi->have_eos = TRUE;
-      return GST_FLOW_UNEXPECTED;
+      GST_DEBUG ("Found index tag");
+      if (gst_avi_demux_peek_chunk (avi, &tag, &size) || size == 0) {
+        /* accept 0 size buffer here */
+        avi->abort_buffering = FALSE;
+        GST_DEBUG ("  skipping %d bytes for now", size);
+        gst_adapter_flush (avi->adapter, 8 + GST_ROUND_UP_2 (size));
+      }
+      return GST_FLOW_OK;
     } else if (tag == GST_RIFF_TAG_LIST) {
       /* movi chunks might be grouped in rec list */
       if (gst_adapter_available (avi->adapter) >= 12) {