diff mbox

[FFmpeg-devel,1/3] avcodec/mpeg4audio: add a logging context parameter to avpriv_mpeg4audio_get_config()

Message ID 20190921155253.1004-1-jamrial@gmail.com
State New
Headers show

Commit Message

James Almer Sept. 21, 2019, 3:52 p.m. UTC
This is an ABI change, so it's scheduled for the next bump.

Signed-off-by: James Almer <jamrial@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(-)

Comments

Carl Eugen Hoyos Sept. 21, 2019, 10:31 p.m. UTC | #1
Am Sa., 21. Sept. 2019 um 17:53 Uhr schrieb James Almer <jamrial@gmail.com>:

> This is an ABI change, so it's scheduled for the next bump.

Why don't you add avpriv_mpeg4audio_get_config2() now?

Carl Eugen
James Almer Sept. 21, 2019, 10:36 p.m. UTC | #2
On 9/21/2019 7:31 PM, Carl Eugen Hoyos wrote:
> Am Sa., 21. Sept. 2019 um 17:53 Uhr schrieb James Almer <jamrial@gmail.com>:
> 
>> This is an ABI change, so it's scheduled for the next bump.
> 
> Why don't you add avpriv_mpeg4audio_get_config2() now?

I don't like the idea of adding a function that will be gone as soon as
we bump (and still require line changes in lavf once it's removed). But
if that's preferred to get the logging context in lavf working right
now, then i can do it.

> 
> Carl Eugen
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
Carl Eugen Hoyos Sept. 21, 2019, 10:38 p.m. UTC | #3
Am So., 22. Sept. 2019 um 00:36 Uhr schrieb James Almer <jamrial@gmail.com>:
>
> On 9/21/2019 7:31 PM, Carl Eugen Hoyos wrote:
> > Am Sa., 21. Sept. 2019 um 17:53 Uhr schrieb James Almer <jamrial@gmail.com>:
> >
> >> This is an ABI change, so it's scheduled for the next bump.
> >
> > Why don't you add avpriv_mpeg4audio_get_config2() now?
>
> I don't like the idea of adding a function that will be gone as soon as
> we bump (and still require line changes in lavf once it's removed).

Don't remove it.

> But if that's preferred to get the logging context in lavf working right
> now, then i can do it.

It's just less ugly and it avoids code changes for third parties.

Carl Eugen
James Almer Sept. 21, 2019, 10:40 p.m. UTC | #4
On 9/21/2019 7:38 PM, Carl Eugen Hoyos wrote:
> Am So., 22. Sept. 2019 um 00:36 Uhr schrieb James Almer <jamrial@gmail.com>:
>>
>> On 9/21/2019 7:31 PM, Carl Eugen Hoyos wrote:
>>> Am Sa., 21. Sept. 2019 um 17:53 Uhr schrieb James Almer <jamrial@gmail.com>:
>>>
>>>> This is an ABI change, so it's scheduled for the next bump.
>>>
>>> Why don't you add avpriv_mpeg4audio_get_config2() now?
>>
>> I don't like the idea of adding a function that will be gone as soon as
>> we bump (and still require line changes in lavf once it's removed).
> 
> Don't remove it.

Why would i leave a redundant internal function?

> 
>> But if that's preferred to get the logging context in lavf working right
>> now, then i can do it.
> 
> It's just less ugly and it avoids code changes for third parties.

What third parties? This is not public API.

> 
> Carl Eugen
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
Carl Eugen Hoyos Sept. 21, 2019, 10:42 p.m. UTC | #5
Am So., 22. Sept. 2019 um 00:40 Uhr schrieb James Almer <jamrial@gmail.com>:
>
> On 9/21/2019 7:38 PM, Carl Eugen Hoyos wrote:
> > Am So., 22. Sept. 2019 um 00:36 Uhr schrieb James Almer <jamrial@gmail.com>:
> >>
> >> On 9/21/2019 7:31 PM, Carl Eugen Hoyos wrote:
> >>> Am Sa., 21. Sept. 2019 um 17:53 Uhr schrieb James Almer <jamrial@gmail.com>:
> >>>
> >>>> This is an ABI change, so it's scheduled for the next bump.
> >>>
> >>> Why don't you add avpriv_mpeg4audio_get_config2() now?
> >>
> >> I don't like the idea of adding a function that will be gone as soon as
> >> we bump (and still require line changes in lavf once it's removed).
> >
> > Don't remove it.
>
> Why would i leave a redundant internal function?

Drop avpriv_mpeg4audio_get_config(), keep avpriv_mpeg4audio_get_config2().

> >> But if that's preferred to get the logging context in lavf working right
> >> now, then i can do it.
> >
> > It's just less ugly and it avoids code changes for third parties.
>
> What third parties? This is not public API.

True, it's still less ugly.

Carl Eugen
James Almer Sept. 21, 2019, 11:26 p.m. UTC | #6
On 9/21/2019 7:42 PM, Carl Eugen Hoyos wrote:
> Am So., 22. Sept. 2019 um 00:40 Uhr schrieb James Almer <jamrial@gmail.com>:
>>
>> On 9/21/2019 7:38 PM, Carl Eugen Hoyos wrote:
>>> Am So., 22. Sept. 2019 um 00:36 Uhr schrieb James Almer <jamrial@gmail.com>:
>>>>
>>>> On 9/21/2019 7:31 PM, Carl Eugen Hoyos wrote:
>>>>> Am Sa., 21. Sept. 2019 um 17:53 Uhr schrieb James Almer <jamrial@gmail.com>:
>>>>>
>>>>>> This is an ABI change, so it's scheduled for the next bump.
>>>>>
>>>>> Why don't you add avpriv_mpeg4audio_get_config2() now?
>>>>
>>>> I don't like the idea of adding a function that will be gone as soon as
>>>> we bump (and still require line changes in lavf once it's removed).
>>>
>>> Don't remove it.
>>
>> Why would i leave a redundant internal function?
> 
> Drop avpriv_mpeg4audio_get_config(), keep avpriv_mpeg4audio_get_config2().

Yes, of course, but i'm talking about the name. I'll be dropping the old
function as soon as we bump, but also ensuring the new one starts using
the old name.

> 
>>>> But if that's preferred to get the logging context in lavf working right
>>>> now, then i can do it.
>>>
>>> It's just less ugly and it avoids code changes for third parties.
>>
>> What third parties? This is not public API.
> 
> True, it's still less ugly.

Alright, will do that instead.

> 
> Carl Eugen
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
Jun Zhao Sept. 24, 2019, 2:20 a.m. UTC | #7
On Sat, Sep 21, 2019 at 11:53 PM James Almer <jamrial@gmail.com> wrote:
>
> This is an ABI change, so it's scheduled for the next bump.
>
> Signed-off-by: James Almer <jamrial@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;
I think return i better than the error AVERROR_INVALIDDATA in this context
>      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);
Missed the parase_config_ALS for logging context support.
>
>  /**
>   * 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
>
diff mbox

Patch

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.