From afc3c674c0380450301dfaa0124038fb492a443b Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 19 Jan 2010 18:37:31 +0100 Subject: [PATCH] avidemux: skip RIFF and index in push mode 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 | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/gst/avi/gstavidemux.c b/gst/avi/gstavidemux.c index 1dc5b11cad..4d8ccf8cc3 100644 --- a/gst/avi/gstavidemux.c +++ b/gst/avi/gstavidemux.c @@ -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) {