From 42998c9438cee485f9a9f5d3ed1c0be1d5ab4840 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 22 Aug 2008 12:24:23 +0000 Subject: [PATCH] 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. --- ChangeLog | 18 ++++++++++++++ gst/matroska/ebml-read.c | 44 +++++++++++++++++------------------ gst/matroska/matroska-demux.c | 7 +++--- 3 files changed, 44 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9b2687c312..c4e9b24ea8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2008-08-22 Sebastian Dröge + + * 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 * gst/multipart/multipartdemux.c: diff --git a/gst/matroska/ebml-read.c b/gst/matroska/ebml-read.c index ae673ca5ff..bd7a71d351 100644 --- a/gst/matroska/ebml-read.c +++ b/gst/matroska/ebml-read.c @@ -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); diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c index 44471f1b28..09c4b5491e 100644 --- a/gst/matroska/matroska-demux.c +++ b/gst/matroska/matroska-demux.c @@ -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;