gst/avi/gstavidemux.c: There can be bogus data before the hdrl LIST tag in the RIFF header.

Original commit message from CVS:
* 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.
This commit is contained in:
Edward Hervey 2006-02-14 16:58:30 +00:00
parent 44cded3b2f
commit fed4575aef
2 changed files with 36 additions and 6 deletions

View file

@ -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),

View file

@ -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) {