[FFmpeg-devel] [FFmpeg-cvslog] avcodec/mpegaudio_parser: Skip APE tags when parsing mp3 packets.
Alexander Strasser
eclipse7 at gmx.net
Wed Jan 31 01:18:42 EET 2018
On 2018-01-30 04:29 +0000, Dale Curtis wrote:
> ffmpeg | branch: master | Dale Curtis <dalecurtis at chromium.org> | Mon Jan 29 15:10:26 2018 -0800| [42323c3e3a600288e4bf1cefe952486ffc29d280] | committer: Michael Niedermayer
>
> avcodec/mpegaudio_parser: Skip APE tags when parsing mp3 packets.
>
> 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 at niedermayer.cc>
>
> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=42323c3e3a600288e4bf1cefe952486ffc29d280
> ---
>
> libavcodec/mpegaudio_parser.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/libavcodec/mpegaudio_parser.c b/libavcodec/mpegaudio_parser.c
> index 8c39825792..244281b56f 100644
> --- a/libavcodec/mpegaudio_parser.c
> +++ b/libavcodec/mpegaudio_parser.c
> @@ -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) {
I wonder if it would have been better to write out the preamble as
literal ("APETAGEX"). It just feels a bit wrong to have the data
described in one place (apetag.h) and the length in another.
For this instance it isn't important at all and I would think
APE_TAG_PREAMBLE is very unlikely to ever change.
Alexander
> + *poutbuf = NULL;
> + *poutbuf_size = 0;
> + return next;
> + }
> +
> *poutbuf = buf;
> *poutbuf_size = buf_size;
> return next;
More information about the ffmpeg-devel
mailing list