summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdward Hervey <bilboed@bilboed.com>2006-02-14 16:58:30 +0000
committerEdward Hervey <bilboed@bilboed.com>2006-02-14 16:58:30 +0000
commitfed4575aefbc321383082bb3cc1854117a98c997 (patch)
treea547d710888f6dec542ae5b7038a31ee240ed114
parent44cded3b2f6b7c2db282402a0532fe6aebf58234 (diff)
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.
-rw-r--r--ChangeLog8
-rw-r--r--gst/avi/gstavidemux.c34
2 files changed, 36 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 42e4e4a3..6e160b40 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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) {