]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/mpegaudio_parser: Skip APE tags when parsing mp3 packets.
authorDale Curtis <dalecurtis@chromium.org>
Mon, 29 Jan 2018 23:10:26 +0000 (15:10 -0800)
committerMichael Niedermayer <michael@niedermayer.cc>
Tue, 30 Jan 2018 04:28:22 +0000 (05:28 +0100)
Otherwise the decoder will throw "Missing header" errors when the
packets are sent for decoding.

This is similar to 89a420b71b5.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/mpegaudio_parser.c

index 8c39825792282d16c26d0ec68c56d1826c7f58d3..244281b56fa2bec9cb3572170db7b53dce0ef512 100644 (file)
@@ -23,6 +23,7 @@
 #include "parser.h"
 #include "mpegaudiodecheader.h"
 #include "libavutil/common.h"
+#include "libavformat/apetag.h" // for APE tag.
 #include "libavformat/id3v1.h" // for ID3v1_TAG_SIZE
 
 typedef struct MpegAudioParseContext {
@@ -120,6 +121,12 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
         return next;
     }
 
+    if (flush && buf_size >= APE_TAG_FOOTER_BYTES && memcmp(buf, APE_TAG_PREAMBLE, 8) == 0) {
+        *poutbuf = NULL;
+        *poutbuf_size = 0;
+        return next;
+    }
+
     *poutbuf = buf;
     *poutbuf_size = buf_size;
     return next;