gst/avi/gstavidemux.c: Try to ignore unparsable/unknown streams and give a warning instead of erroring out. Fixes #53...

Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull):
Try to ignore unparsable/unknown streams and give a warning instead of
erroring out. Fixes #537377.
This commit is contained in:
Wim Taymans 2008-06-10 11:05:30 +00:00
parent a778b414b8
commit b28a5162af
2 changed files with 31 additions and 13 deletions

View file

@ -1,3 +1,13 @@
2008-06-10 Wim Taymans <wim.taymans@collabora.co.uk>
* gst/avi/gstavidemux.c: (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull):
Try to ignore unparsable/unknown streams and give a warning instead of
erroring out. Fixes #537377.
2008-06-10 Sebastian Dröge <slomo@circular-chaos.org> 2008-06-10 Sebastian Dröge <slomo@circular-chaos.org>
* gst/matroska/ebml-write.c: (gst_ebml_write_float): * gst/matroska/ebml-write.c: (gst_ebml_write_float):

View file

@ -1335,12 +1335,12 @@ gst_avi_demux_parse_stream (GstAviDemux * avi, GstBuffer * buf)
} }
if (!got_strh) { if (!got_strh) {
GST_ERROR_OBJECT (avi, "Failed to find strh chunk"); GST_WARNING_OBJECT (avi, "Failed to find strh chunk");
goto fail; goto fail;
} }
if (!got_strf) { if (!got_strf) {
GST_ERROR_OBJECT (avi, "Failed to find strf chunk"); GST_WARNING_OBJECT (avi, "Failed to find strf chunk");
goto fail; goto fail;
} }
@ -1642,6 +1642,11 @@ gst_avi_demux_parse_index (GstAviDemux * avi,
target->stream_nr = stream_nr; target->stream_nr = stream_nr;
stream = &avi->stream[stream_nr]; stream = &avi->stream[stream_nr];
if (!stream->strh) {
GST_WARNING_OBJECT (avi, "Unhandled stream %d, skipping", stream_nr);
continue;
}
target->index_nr = i; target->index_nr = i;
target->flags = target->flags =
(entry. (entry.
@ -2422,6 +2427,8 @@ gst_avi_demux_massage_index (GstAviDemux * avi,
gchar *pad_name; gchar *pad_name;
for (i = 0; i < avi->num_streams; i++) { for (i = 0; i < avi->num_streams; i++) {
if (!avi->stream[i].pad)
continue;
pad_name = GST_OBJECT_NAME (avi->stream[i].pad); pad_name = GST_OBJECT_NAME (avi->stream[i].pad);
sprintf (&str[i * (1 + 6 + 2)], " %6u %c", num_per_stream[i], sprintf (&str[i * (1 + 6 + 2)], " %6u %c", num_per_stream[i],
pad_name[0]); pad_name[0]);
@ -2471,6 +2478,8 @@ gst_avi_demux_calculate_durations_from_index (GstAviDemux * avi)
avi_stream_context *streamc = &avi->stream[stream]; avi_stream_context *streamc = &avi->stream[stream];
gst_riff_strh *strh = streamc->strh; gst_riff_strh *strh = streamc->strh;
if (!strh)
continue;
/* get header duration */ /* get header duration */
hduration = gst_util_uint64_scale ((guint64) strh->length * hduration = gst_util_uint64_scale ((guint64) strh->length *
strh->scale, GST_SECOND, (guint64) strh->rate); strh->scale, GST_SECOND, (guint64) strh->rate);
@ -2615,8 +2624,9 @@ gst_avi_demux_stream_header_push (GstAviDemux * avi)
switch (GST_READ_UINT32_LE (GST_BUFFER_DATA (sub))) { switch (GST_READ_UINT32_LE (GST_BUFFER_DATA (sub))) {
case GST_RIFF_LIST_strl: case GST_RIFF_LIST_strl:
if (!(gst_avi_demux_parse_stream (avi, sub))) { if (!(gst_avi_demux_parse_stream (avi, sub))) {
GST_DEBUG_OBJECT (avi, "avi_demux_parse_stream failed"); GST_ELEMENT_WARNING (avi, STREAM, DEMUX, (NULL),
return GST_FLOW_ERROR; ("failed to parse stream, ignoring"));
goto next;
} }
goto next; goto next;
case GST_RIFF_LIST_odml: case GST_RIFF_LIST_odml:
@ -2891,9 +2901,11 @@ gst_avi_demux_stream_header_pull (GstAviDemux * avi)
switch (fourcc) { switch (fourcc) {
case GST_RIFF_LIST_strl: case GST_RIFF_LIST_strl:
if (!(gst_avi_demux_parse_stream (avi, sub))) if (!(gst_avi_demux_parse_stream (avi, sub))) {
goto parse_stream_failed; GST_ELEMENT_WARNING (avi, STREAM, DEMUX, (NULL),
("faile to parse stream, ignoring"));
sub = NULL;
}
goto next; goto next;
case GST_RIFF_LIST_odml: case GST_RIFF_LIST_odml:
gst_avi_demux_parse_odml (avi, sub); gst_avi_demux_parse_odml (avi, sub);
@ -2915,7 +2927,8 @@ gst_avi_demux_stream_header_pull (GstAviDemux * avi)
/* fall-through */ /* fall-through */
case GST_RIFF_TAG_JUNK: case GST_RIFF_TAG_JUNK:
next: next:
gst_buffer_unref (sub); if (sub)
gst_buffer_unref (sub);
sub = NULL; sub = NULL;
break; break;
} }
@ -3033,11 +3046,6 @@ skipping_done:
return GST_FLOW_OK; return GST_FLOW_OK;
/* ERRORS */ /* ERRORS */
parse_stream_failed:
{
GST_DEBUG_OBJECT (avi, "avi_demux_parse_stream failed");
return GST_FLOW_ERROR;
}
no_list: no_list:
{ {
GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL), GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL),