diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | gst/avi/gstavidemux.c | 34 |
2 files changed, 36 insertions, 6 deletions
@@ -1,3 +1,11 @@ +2006-02-14 Edward Hervey <edward@fluendo.com> + + * gst/avi/gstavidemux.c: (gst_avi_demux_stream_header): + There can be bogus data before the hdrl LIST tag in the RIFF header. + It's hard to say if it's not respecting the AVI specifications or not, + but since Google Video is producing AVIs like that and the other player + don't seem to complain, I guess we should do the same. + 2006-02-13 Jan Schmidt <thaytan@mad.scientist.com> * gst/id3demux/id3v2frames.c: (parse_insert_string_field), diff --git a/gst/avi/gstavidemux.c b/gst/avi/gstavidemux.c index cc6d9e73..8ca8a92c 100644 --- a/gst/avi/gstavidemux.c +++ b/gst/avi/gstavidemux.c @@ -1945,15 +1945,37 @@ gst_avi_demux_stream_header (GstAviDemux * avi) ("Invalid AVI header (no LIST at start): %" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag))); return GST_FLOW_ERROR; - } else if (GST_BUFFER_SIZE (buf) < 4 || - GST_READ_UINT32_LE (GST_BUFFER_DATA (buf)) != GST_RIFF_LIST_hdrl) { - GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL), - ("Invalid AVI header (no hdrl at start): %" - GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag))); - gst_buffer_unref (buf); + } else if (GST_BUFFER_SIZE (buf) < 4) { + GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL), ("No header found")); return GST_FLOW_ERROR; } + /* Find the 'hdrl' LIST tag */ + while (GST_READ_UINT32_LE (GST_BUFFER_DATA (buf)) != GST_RIFF_LIST_hdrl) { + + GST_LOG_OBJECT (avi, "buffer contains %" GST_FOURCC_FORMAT, + GST_FOURCC_ARGS (GST_READ_UINT32_LE (GST_BUFFER_DATA (buf)))); + + /* Eat up */ + gst_buffer_unref (buf); + if ((res = gst_riff_read_chunk (GST_ELEMENT (avi), avi->sinkpad, + &avi->offset, &tag, &buf)) != GST_FLOW_OK) + return res; + else if (tag != GST_RIFF_TAG_LIST) { + GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL), + ("Invalid AVI header (no LIST at start): %" + GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag))); + return GST_FLOW_ERROR; + } else if (GST_BUFFER_SIZE (buf) < 4) { + + GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL), + ("Invalid AVI header (no hdrl at start): %" + GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag))); + gst_buffer_unref (buf); + return GST_FLOW_ERROR; + } + } + /* the hdrl starts with a 'avih' header */ if (!gst_riff_parse_chunk (GST_ELEMENT (avi), buf, &offset, &tag, &sub) || tag != GST_RIFF_TAG_avih) { |