From 8ca098f4445cd12d39b2c55b0dfb8c988b7b28ce Mon Sep 17 00:00:00 2001 From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org> Date: Fri, 13 Feb 2015 22:51:33 +0100 Subject: [PATCH] avcocdec/mpegaudio_parser: add MP3 ADU headers parser Reviewed-by: Thomas Volkert <silvo@gmx.net> Signed-off-by: Michael Niedermayer <michaelni@gmx.at> --- libavcodec/mpegaudio_parser.c | 14 ++++++++++++-- libavcodec/mpegaudiodecheader.c | 3 ++- libavcodec/version.h | 4 ++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/libavcodec/mpegaudio_parser.c b/libavcodec/mpegaudio_parser.c index 79dbf635b40..42f470685ad 100644 --- a/libavcodec/mpegaudio_parser.c +++ b/libavcodec/mpegaudio_parser.c @@ -64,7 +64,7 @@ static int mpegaudio_parse(AVCodecParserContext *s1, }else{ while(i<buf_size){ int ret, sr, channels, bit_rate, frame_size; - enum AVCodecID codec_id; + enum AVCodecID codec_id = avctx->codec_id; state= (state<<8) + buf[i++]; @@ -90,6 +90,16 @@ static int mpegaudio_parse(AVCodecParserContext *s1, avctx->bit_rate += (bit_rate - avctx->bit_rate) / (s->header_count - header_threshold); } } + + if (s1->flags & PARSER_FLAG_COMPLETE_FRAMES) { + s->frame_size = 0; + next = buf_size; + } else if (codec_id == AV_CODEC_ID_MP3ADU) { + av_log(avctx, AV_LOG_ERROR, + "MP3ADU full parser not implemented"); + return AVERROR_PATCHWELCOME; + } + break; } } @@ -110,7 +120,7 @@ static int mpegaudio_parse(AVCodecParserContext *s1, AVCodecParser ff_mpegaudio_parser = { - .codec_ids = { AV_CODEC_ID_MP1, AV_CODEC_ID_MP2, AV_CODEC_ID_MP3 }, + .codec_ids = { AV_CODEC_ID_MP1, AV_CODEC_ID_MP2, AV_CODEC_ID_MP3, AV_CODEC_ID_MP3ADU }, .priv_data_size = sizeof(MpegAudioParseContext), .parser_parse = mpegaudio_parse, .parser_close = ff_parse_close, diff --git a/libavcodec/mpegaudiodecheader.c b/libavcodec/mpegaudiodecheader.c index 5db195725f8..6af6e4b239c 100644 --- a/libavcodec/mpegaudiodecheader.c +++ b/libavcodec/mpegaudiodecheader.c @@ -134,7 +134,8 @@ int avpriv_mpa_decode_header2(uint32_t head, int *sample_rate, int *channels, in break; default: case 3: - *codec_id = AV_CODEC_ID_MP3; + if (*codec_id != AV_CODEC_ID_MP3ADU) + *codec_id = AV_CODEC_ID_MP3; if (s->lsf) *frame_size = 576; else diff --git a/libavcodec/version.h b/libavcodec/version.h index 8a86414f8e0..e1e2904c855 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,8 +29,8 @@ #include "libavutil/version.h" #define LIBAVCODEC_VERSION_MAJOR 56 -#define LIBAVCODEC_VERSION_MINOR 21 -#define LIBAVCODEC_VERSION_MICRO 102 +#define LIBAVCODEC_VERSION_MINOR 22 +#define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ -- GitLab