This is an ABI change, so it's scheduled for the next bump. Signed-off-by: James Almer <jamr...@gmail.com> --- libavcodec/aacdec_template.c | 2 +- libavcodec/alsdec.c | 4 ++++ libavcodec/mpeg4audio.c | 11 +++++++++-- libavcodec/mpeg4audio.h | 8 +++++++- libavcodec/mpegaudiodec_template.c | 4 ++++ libavformat/adtsenc.c | 4 ++++ libavformat/isom.c | 4 ++++ libavformat/latmenc.c | 4 ++++ libavformat/matroskaenc.c | 4 ++++ 9 files changed, 41 insertions(+), 4 deletions(-)
diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c index 6e086e00df..8726c8b828 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -975,7 +975,7 @@ static int decode_audio_specific_config_gb(AACContext *ac, int i, ret; GetBitContext gbc = *gb; - if ((i = ff_mpeg4audio_get_config_gb(m4ac, &gbc, sync_extension)) < 0) + if ((i = ff_mpeg4audio_get_config_gb(m4ac, &gbc, sync_extension, avctx)) < 0) return AVERROR_INVALIDDATA; if (m4ac->sampling_index > 12) { diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c index a53c170d18..767d1be7d3 100644 --- a/libavcodec/alsdec.c +++ b/libavcodec/alsdec.c @@ -303,7 +303,11 @@ static av_cold int read_specific_config(ALSDecContext *ctx) return ret; config_offset = avpriv_mpeg4audio_get_config(&m4ac, avctx->extradata, +#if LIBAVCODEC_VERSION_MAJOR < 59 avctx->extradata_size * 8, 1); +#else + avctx->extradata_size * 8, 1, avctx); +#endif if (config_offset < 0) return AVERROR_INVALIDDATA; diff --git a/libavcodec/mpeg4audio.c b/libavcodec/mpeg4audio.c index 219714752f..43c19c4188 100644 --- a/libavcodec/mpeg4audio.c +++ b/libavcodec/mpeg4audio.c @@ -84,7 +84,7 @@ static inline int get_sample_rate(GetBitContext *gb, int *index) } int ff_mpeg4audio_get_config_gb(MPEG4AudioConfig *c, GetBitContext *gb, - int sync_extension) + int sync_extension, void *logctx) { int specific_config_bitindex, ret; int start_bit_index = get_bits_count(gb); @@ -152,9 +152,16 @@ int ff_mpeg4audio_get_config_gb(MPEG4AudioConfig *c, GetBitContext *gb, return specific_config_bitindex - start_bit_index; } +#if LIBAVCODEC_VERSION_MAJOR < 59 int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf, int bit_size, int sync_extension) { + void *logctx = NULL; +#else +int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf, + int bit_size, int sync_extension, void *logctx) +{ +#endif GetBitContext gb; int ret; @@ -165,5 +172,5 @@ int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf, if (ret < 0) return ret; - return ff_mpeg4audio_get_config_gb(c, &gb, sync_extension); + return ff_mpeg4audio_get_config_gb(c, &gb, sync_extension, logctx); } diff --git a/libavcodec/mpeg4audio.h b/libavcodec/mpeg4audio.h index b9cea8af17..ee6c8da233 100644 --- a/libavcodec/mpeg4audio.h +++ b/libavcodec/mpeg4audio.h @@ -53,10 +53,11 @@ extern const uint8_t ff_mpeg4audio_channels[8]; * @param[in] c MPEG4AudioConfig structure to fill. * @param[in] gb Extradata from container. * @param[in] sync_extension look for a sync extension after config if true. + * @param[in] logctx opaque struct starting with an AVClass element, used for logging. * @return On error -1 is returned, on success AudioSpecificConfig bit index in extradata. */ int ff_mpeg4audio_get_config_gb(MPEG4AudioConfig *c, GetBitContext *gb, - int sync_extension); + int sync_extension, void *logctx); /** * Parse MPEG-4 systems extradata from a raw buffer to retrieve audio configuration. @@ -64,10 +65,15 @@ int ff_mpeg4audio_get_config_gb(MPEG4AudioConfig *c, GetBitContext *gb, * @param[in] buf Extradata from container. * @param[in] bit_size Extradata size in bits. * @param[in] sync_extension look for a sync extension after config if true. + * @param[in] logctx opaque struct starting with an AVClass element, used for logging. * @return On error -1 is returned, on success AudioSpecificConfig bit index in extradata. */ int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf, +#if LIBAVCODEC_VERSION_MAJOR < 59 int bit_size, int sync_extension); +#else + int bit_size, int sync_extension, void *logctx); +#endif enum AudioObjectType { AOT_NULL, diff --git a/libavcodec/mpegaudiodec_template.c b/libavcodec/mpegaudiodec_template.c index 9cce88e263..a89d7e408f 100644 --- a/libavcodec/mpegaudiodec_template.c +++ b/libavcodec/mpegaudiodec_template.c @@ -1852,7 +1852,11 @@ static av_cold int decode_init_mp3on4(AVCodecContext * avctx) } avpriv_mpeg4audio_get_config(&cfg, avctx->extradata, +#if LIBAVCODEC_VERSION_MAJOR < 59 avctx->extradata_size * 8, 1); +#else + avctx->extradata_size * 8, 1, avctx); +#endif if (!cfg.chan_config || cfg.chan_config > 7) { av_log(avctx, AV_LOG_ERROR, "Invalid channel config number.\n"); return AVERROR_INVALIDDATA; diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c index 3c2840c6ab..48871efe1a 100644 --- a/libavformat/adtsenc.c +++ b/libavformat/adtsenc.c @@ -53,7 +53,11 @@ static int adts_decode_extradata(AVFormatContext *s, ADTSContext *adts, const ui int off; init_get_bits(&gb, buf, size * 8); +#if LIBAVCODEC_VERSION_MAJOR < 59 off = avpriv_mpeg4audio_get_config(&m4ac, buf, size * 8, 1); +#else + off = avpriv_mpeg4audio_get_config(&m4ac, buf, size * 8, 1, s); +#endif if (off < 0) return off; skip_bits_long(&gb, off); diff --git a/libavformat/isom.c b/libavformat/isom.c index fa2e318099..6d5e9b56d0 100644 --- a/libavformat/isom.c +++ b/libavformat/isom.c @@ -548,7 +548,11 @@ FF_ENABLE_DEPRECATION_WARNINGS if (st->codecpar->codec_id == AV_CODEC_ID_AAC) { MPEG4AudioConfig cfg = {0}; ret = avpriv_mpeg4audio_get_config(&cfg, st->codecpar->extradata, +#if LIBAVCODEC_VERSION_MAJOR < 59 st->codecpar->extradata_size * 8, 1); +#else + st->codecpar->extradata_size * 8, 1, fc); +#endif if (ret < 0) return ret; st->codecpar->channels = cfg.channels; diff --git a/libavformat/latmenc.c b/libavformat/latmenc.c index 1b16d752b6..d33e39074c 100644 --- a/libavformat/latmenc.c +++ b/libavformat/latmenc.c @@ -62,7 +62,11 @@ static int latm_decode_extradata(AVFormatContext *s, uint8_t *buf, int size) av_log(s, AV_LOG_ERROR, "Extradata is larger than currently supported.\n"); return AVERROR_INVALIDDATA; } +#if LIBAVCODEC_VERSION_MAJOR < 59 ctx->off = avpriv_mpeg4audio_get_config(&m4ac, buf, size * 8, 1); +#else + ctx->off = avpriv_mpeg4audio_get_config(&m4ac, buf, size * 8, 1, s); +#endif if (ctx->off < 0) return ctx->off; diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index cef504fa05..475578c6ba 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -718,7 +718,11 @@ static int get_aac_sample_rates(AVFormatContext *s, uint8_t *extradata, int extr int ret; ret = avpriv_mpeg4audio_get_config(&mp4ac, extradata, +#if LIBAVCODEC_VERSION_MAJOR < 59 extradata_size * 8, 1); +#else + extradata_size * 8, 1, s); +#endif /* Don't abort if the failure is because of missing extradata. Assume in that * case a bitstream filter will provide the muxer with the extradata in the * first packet. -- 2.22.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".