[FFmpeg-devel] [PATCH] mxfdec: do not fail on error parsing footer.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Thu Jan 5 22:06:57 CET 2012


Failing it play a file just because some metadata was not parseable
is overkill.
This should fix trac issue #879.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
---
 libavformat/mxfdec.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 10512ef..66af2e4 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -1634,7 +1634,7 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
 
             if (!mxf->current_partition) {
                 av_log(mxf->fc, AV_LOG_ERROR, "found essence prior to first PartitionPack\n");
-                return AVERROR_INVALIDDATA;
+                goto handle_essence;
             }
 
             if (!mxf->current_partition->essence_offset) {
@@ -1688,14 +1688,14 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
                     if (avio_tell(s->pb) > next) {
                         av_log(s, AV_LOG_ERROR, "read past end of KLV @ %#"PRIx64"\n",
                                klv.offset);
-                        return AVERROR_INVALIDDATA;
+                        goto handle_essence;
                     }
 
                     avio_seek(s->pb, next, SEEK_SET);
                 }
                 if (res < 0) {
                     av_log(s, AV_LOG_ERROR, "error reading header metadata\n");
-                    return -1;
+                    goto handle_essence;
                 }
                 break;
             }
@@ -1703,6 +1703,7 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
         if (!metadata->read)
             avio_skip(s->pb, klv.length);
     }
+handle_essence:
     /* FIXME avoid seek */
     if (!essence_offset)  {
         av_log(s, AV_LOG_ERROR, "no essence\n");
-- 
1.7.8.2



More information about the ffmpeg-devel mailing list