]> git.sesse.net Git - ffmpeg/commitdiff
avformat/electronicarts: fix demuxing of certain eam files
authorPaul B Mahol <onemda@gmail.com>
Thu, 22 Oct 2015 08:35:09 +0000 (10:35 +0200)
committerPaul B Mahol <onemda@gmail.com>
Thu, 22 Oct 2015 09:01:00 +0000 (11:01 +0200)
Such files have gaps between header chunks.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
libavformat/electronicarts.c

index 22a7bc501d860b33201826963a8b79cc6ae06172..8087c9f5eab97624cb9437e86cb772198d63167e 100644 (file)
@@ -662,7 +662,19 @@ static int ea_read_packet(AVFormatContext *s, AVPacket *pkt)
         case SCEl_TAG:
         case SEND_TAG:
         case SEEN_TAG:
-            ret         = AVERROR(EIO);
+            while (!avio_feof(pb)) {
+                int tag = avio_rl32(pb);
+
+                if (tag == ISNh_TAG ||
+                    tag == SCHl_TAG ||
+                    tag == SEAD_TAG ||
+                    tag == SHEN_TAG) {
+                    avio_skip(pb, -4);
+                    break;
+                }
+            }
+            if (avio_feof(pb))
+                ret = AVERROR_EOF;
             packet_read = 1;
             break;