gst/matroska/ebml-read.c: Change some GST_ELEMENT_ERRORs to GST_ERROR_OBJECT to make it possible to ignore errors and...

Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_read_uint),
(gst_ebml_read_sint), (gst_ebml_read_float),
(gst_ebml_read_header):
Change some GST_ELEMENT_ERRORs to GST_ERROR_OBJECT to make it
possible to ignore errors and not post any ERROR messages on
the bus.
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_parse_contents):
Ignore any errors and not just EOS when parsing the contents of
a SeekHead. Errors here are usually caused by truncated files
and playback of the file works fine. Fixes playback of the
audio_only_chapter_seekbroken.mka file from the MPlayer samples
archive.
This commit is contained in:
Sebastian Dröge 2008-08-22 12:24:23 +00:00
parent a10d127c35
commit 42998c9438
3 changed files with 44 additions and 25 deletions

View file

@ -1,3 +1,21 @@
2008-08-22 Sebastian Dröge <sebastian.droege@collabora.co.uk>
* gst/matroska/ebml-read.c: (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_read_uint),
(gst_ebml_read_sint), (gst_ebml_read_float),
(gst_ebml_read_header):
Change some GST_ELEMENT_ERRORs to GST_ERROR_OBJECT to make it
possible to ignore errors and not post any ERROR messages on
the bus.
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_parse_contents):
Ignore any errors and not just EOS when parsing the contents of
a SeekHead. Errors here are usually caused by truncated files
and playback of the file works fine. Fixes playback of the
audio_only_chapter_seekbroken.mka file from the MPlayer samples
archive.
2008-08-22 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* gst/multipart/multipartdemux.c:

View file

@ -329,9 +329,9 @@ gst_ebml_read_element_id (GstEbmlRead * ebml, guint32 * id, guint * level_up)
if (read > 4) {
guint64 pos = ebml->offset;
GST_ELEMENT_ERROR (ebml, STREAM, DEMUX, (NULL),
("Invalid EBML ID size tag (0x%x) at position %" G_GUINT64_FORMAT
" (0x%" G_GINT64_MODIFIER "x)", (guint) b, pos, pos));
GST_ERROR_OBJECT (ebml,
"Invalid EBML ID size tag (0x%x) at position %" G_GUINT64_FORMAT " (0x%"
G_GINT64_MODIFIER "x)", (guint) b, pos, pos);
return GST_FLOW_ERROR;
}
@ -385,9 +385,9 @@ gst_ebml_read_element_length (GstEbmlRead * ebml, guint64 * length,
if (read > 8) {
guint64 pos = ebml->offset;
GST_ELEMENT_ERROR (ebml, STREAM, DEMUX, (NULL),
("Invalid EBML length size tag (0x%x) at position %" G_GUINT64_FORMAT
" (0x%" G_GINT64_MODIFIER "x)", (guint) b, pos, pos));
GST_ERROR_OBJECT (ebml,
"Invalid EBML length size tag (0x%x) at position %" G_GUINT64_FORMAT
" (0x%" G_GINT64_MODIFIER "x)", (guint) b, pos, pos);
return GST_FLOW_ERROR;
}
@ -604,10 +604,9 @@ gst_ebml_read_uint (GstEbmlRead * ebml, guint32 * id, guint64 * num)
return ret;
if (size < 1 || size > 8) {
GST_ELEMENT_ERROR (ebml, STREAM, DEMUX, (NULL),
("Invalid integer element size %d at position %" G_GUINT64_FORMAT
" (0x%" G_GINT64_MODIFIER "x)",
size, ebml->offset - size, ebml->offset - size));
GST_ERROR_OBJECT (ebml,
"Invalid integer element size %d at position %" G_GUINT64_FORMAT " (0x%"
G_GINT64_MODIFIER "x)", size, ebml->offset - size, ebml->offset - size);
return GST_FLOW_ERROR;
}
*num = 0;
@ -637,10 +636,9 @@ gst_ebml_read_sint (GstEbmlRead * ebml, guint32 * id, gint64 * num)
return ret;
if (size < 1 || size > 8) {
GST_ELEMENT_ERROR (ebml, STREAM, DEMUX, (NULL),
("Invalid integer element size %d at position %" G_GUINT64_FORMAT
" (0x%" G_GINT64_MODIFIER "x)", size, ebml->offset - size,
ebml->offset - size));
GST_ERROR_OBJECT (ebml,
"Invalid integer element size %d at position %" G_GUINT64_FORMAT " (0x%"
G_GINT64_MODIFIER "x)", size, ebml->offset - size, ebml->offset - size);
return GST_FLOW_ERROR;
}
@ -715,10 +713,9 @@ gst_ebml_read_float (GstEbmlRead * ebml, guint32 * id, gdouble * num)
return ret;
if (size != 4 && size != 8 && size != 10) {
GST_ELEMENT_ERROR (ebml, STREAM, DEMUX, (NULL),
("Invalid float element size %d at position %" G_GUINT64_FORMAT
" (0x%" G_GINT64_MODIFIER "x)", size, ebml->offset - size,
ebml->offset - size));
GST_ERROR_OBJECT (ebml,
"Invalid float element size %d at position %" G_GUINT64_FORMAT " (0x%"
G_GINT64_MODIFIER "x)", size, ebml->offset - size, ebml->offset - size);
return GST_FLOW_ERROR;
}
@ -887,7 +884,7 @@ gst_ebml_read_header (GstEbmlRead * ebml, gchar ** doctype, guint * version)
GST_DEBUG_OBJECT (ebml, "id: %08x", GST_READ_UINT32_BE (&id));
if (level_up != 0 || id != GST_EBML_ID_HEADER) {
GST_ELEMENT_ERROR (ebml, STREAM, WRONG_TYPE, (NULL), (NULL));
GST_ERROR_OBJECT (ebml, "Failed to read header");
return GST_FLOW_ERROR;
}
ret = gst_ebml_read_master (ebml, &id);
@ -913,7 +910,8 @@ gst_ebml_read_header (GstEbmlRead * ebml, gchar ** doctype, guint * version)
return ret;
g_assert (id == GST_EBML_ID_EBMLREADVERSION);
if (num != GST_EBML_VERSION) {
GST_ELEMENT_ERROR (ebml, STREAM, WRONG_TYPE, (NULL), (NULL));
GST_ERROR_OBJECT (ebml, "Unsupported EBML version %" G_GUINT64_FORMAT,
num);
return GST_FLOW_ERROR;
}
@ -930,7 +928,8 @@ gst_ebml_read_header (GstEbmlRead * ebml, gchar ** doctype, guint * version)
return ret;
g_assert (id == GST_EBML_ID_EBMLMAXSIZELENGTH);
if (num > sizeof (guint64)) {
GST_ELEMENT_ERROR (ebml, STREAM, WRONG_TYPE, (NULL), (NULL));
GST_ERROR_OBJECT (ebml,
"Unsupported EBML maximum size %" G_GUINT64_FORMAT, num);
return GST_FLOW_ERROR;
}
GST_DEBUG_OBJECT (ebml, "EbmlMaxSizeLength: %" G_GUINT64_FORMAT, num);
@ -946,7 +945,8 @@ gst_ebml_read_header (GstEbmlRead * ebml, gchar ** doctype, guint * version)
return ret;
g_assert (id == GST_EBML_ID_EBMLMAXIDLENGTH);
if (num > sizeof (guint32)) {
GST_ELEMENT_ERROR (ebml, STREAM, WRONG_TYPE, (NULL), (NULL));
GST_ERROR_OBJECT (ebml,
"Unsupported EBML maximum ID %" G_GUINT64_FORMAT, num);
return GST_FLOW_ERROR;
}
GST_DEBUG_OBJECT (ebml, "EbmlMaxIdLength: %" G_GUINT64_FORMAT, num);

View file

@ -4536,9 +4536,9 @@ gst_matroska_demux_parse_contents (GstMatroskaDemux * demux)
case GST_MATROSKA_ID_SEEKENTRY:
{
ret = gst_matroska_demux_parse_contents_seekentry (demux);
/* Ignore EOS here */
if (ret == GST_FLOW_UNEXPECTED) {
GST_DEBUG_OBJECT (demux, "Ignoring EOS");
/* Ignore EOS and errors here */
if (ret != GST_FLOW_OK) {
GST_DEBUG_OBJECT (demux, "Ignoring %s", gst_flow_get_name (ret));
ret = GST_FLOW_OK;
}
break;
@ -4555,6 +4555,7 @@ gst_matroska_demux_parse_contents (GstMatroskaDemux * demux)
break;
}
}
DEBUG_ELEMENT_STOP (demux, ebml, "SeekHead", ret);
return ret;