[FFmpeg-devel,3/3] avformat: use avpriv_mpeg4audio_get_config2()

Submitted by James Almer on Sept. 21, 2019, 11:27 p.m.

Details

Message ID 20190921232712.1345-3-jamrial@gmail.com
State Accepted
Commit 35bbaa665246c363a1d623ea9b1e43f770e2768c
Headers show

Commit Message

James Almer Sept. 21, 2019, 11:27 p.m.
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavformat/adtsenc.c     | 2 +-
 libavformat/isom.c        | 4 ++--
 libavformat/latmenc.c     | 2 +-
 libavformat/matroskaenc.c | 3 +--
 4 files changed, 5 insertions(+), 6 deletions(-)

Comments

Andriy Gelman Sept. 22, 2019, 7:40 p.m.
WwawwewzA XX,$_2*#$5$2













On Sat, Sep 21, 2019, 7:28 PM James Almer <jamrial@gmail.com> wrote:

> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavformat/adtsenc.c     | 2 +-
>  libavformat/isom.c        | 4 ++--
>  libavformat/latmenc.c     | 2 +-
>  libavformat/matroskaenc.c | 3 +--
>  4 files changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c
> index 3c2840c6ab..d937e2bea9 100644
> --- a/libavformat/adtsenc.c
> +++ b/libavformat/adtsenc.c
> @@ -53,7 +53,7 @@ static int adts_decode_extradata(AVFormatContext *s,
> ADTSContext *adts, const ui
>      int off;
>
>      init_get_bits(&gb, buf, size * 8);
> -    off = avpriv_mpeg4audio_get_config(&m4ac, buf, size * 8, 1);
> +    off = avpriv_mpeg4audio_get_config2(&m4ac, buf, size, 1, s);
>      if (off < 0)
>          return off;
>      skip_bits_long(&gb, off);
> diff --git a/libavformat/isom.c b/libavformat/isom.c
> index fa2e318099..edd0d81063 100644
> --- a/libavformat/isom.c
> +++ b/libavformat/isom.c
> @@ -547,8 +547,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
>              return ret;
>          if (st->codecpar->codec_id == AV_CODEC_ID_AAC) {
>              MPEG4AudioConfig cfg = {0};
> -            ret = avpriv_mpeg4audio_get_config(&cfg,
> st->codecpar->extradata,
> -
>  st->codecpar->extradata_size * 8, 1);
> +            ret = avpriv_mpeg4audio_get_config2(&cfg,
> st->codecpar->extradata,
> +
> st->codecpar->extradata_size, 1, fc);
>              if (ret < 0)
>                  return ret;
>              st->codecpar->channels = cfg.channels;
> diff --git a/libavformat/latmenc.c b/libavformat/latmenc.c
> index 1b16d752b6..db867ebf1a 100644
> --- a/libavformat/latmenc.c
> +++ b/libavformat/latmenc.c
> @@ -62,7 +62,7 @@ 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;
>      }
> -    ctx->off = avpriv_mpeg4audio_get_config(&m4ac, buf, size * 8, 1);
> +    ctx->off = avpriv_mpeg4audio_get_config2(&m4ac, buf, size, 1, s);
>      if (ctx->off < 0)
>          return ctx->off;
>
> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
> index cef504fa05..a64ffdb690 100644
> --- a/libavformat/matroskaenc.c
> +++ b/libavformat/matroskaenc.c
> @@ -717,8 +717,7 @@ static int get_aac_sample_rates(AVFormatContext *s,
> uint8_t *extradata, int extr
>      MPEG4AudioConfig mp4ac;
>      int ret;
>
> -    ret = avpriv_mpeg4audio_get_config(&mp4ac, extradata,
> -                                       extradata_size * 8, 1);
> +    ret = avpriv_mpeg4audio_get_config2(&mp4ac, extradata,
> extradata_size, 1, s);
>      /* 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-request@ffmpeg.org with subject "unsubscribe".
mypopy@gmail.com Sept. 24, 2019, 2:24 a.m.
On Sun, Sep 22, 2019 at 7:28 AM James Almer <jamrial@gmail.com> wrote:
>
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavformat/adtsenc.c     | 2 +-
>  libavformat/isom.c        | 4 ++--
>  libavformat/latmenc.c     | 2 +-
>  libavformat/matroskaenc.c | 3 +--
>  4 files changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c
> index 3c2840c6ab..d937e2bea9 100644
> --- a/libavformat/adtsenc.c
> +++ b/libavformat/adtsenc.c
> @@ -53,7 +53,7 @@ static int adts_decode_extradata(AVFormatContext *s, ADTSContext *adts, const ui
>      int off;
>
>      init_get_bits(&gb, buf, size * 8);
> -    off = avpriv_mpeg4audio_get_config(&m4ac, buf, size * 8, 1);
> +    off = avpriv_mpeg4audio_get_config2(&m4ac, buf, size, 1, s);
>      if (off < 0)
>          return off;
>      skip_bits_long(&gb, off);
> diff --git a/libavformat/isom.c b/libavformat/isom.c
> index fa2e318099..edd0d81063 100644
> --- a/libavformat/isom.c
> +++ b/libavformat/isom.c
> @@ -547,8 +547,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
>              return ret;
>          if (st->codecpar->codec_id == AV_CODEC_ID_AAC) {
>              MPEG4AudioConfig cfg = {0};
> -            ret = avpriv_mpeg4audio_get_config(&cfg, st->codecpar->extradata,
> -                                               st->codecpar->extradata_size * 8, 1);
> +            ret = avpriv_mpeg4audio_get_config2(&cfg, st->codecpar->extradata,
> +                                                st->codecpar->extradata_size, 1, fc);
>              if (ret < 0)
>                  return ret;
>              st->codecpar->channels = cfg.channels;
> diff --git a/libavformat/latmenc.c b/libavformat/latmenc.c
> index 1b16d752b6..db867ebf1a 100644
> --- a/libavformat/latmenc.c
> +++ b/libavformat/latmenc.c
> @@ -62,7 +62,7 @@ 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;
>      }
> -    ctx->off = avpriv_mpeg4audio_get_config(&m4ac, buf, size * 8, 1);
> +    ctx->off = avpriv_mpeg4audio_get_config2(&m4ac, buf, size, 1, s);
>      if (ctx->off < 0)
>          return ctx->off;
>
> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
> index cef504fa05..a64ffdb690 100644
> --- a/libavformat/matroskaenc.c
> +++ b/libavformat/matroskaenc.c
> @@ -717,8 +717,7 @@ static int get_aac_sample_rates(AVFormatContext *s, uint8_t *extradata, int extr
>      MPEG4AudioConfig mp4ac;
>      int ret;
>
> -    ret = avpriv_mpeg4audio_get_config(&mp4ac, extradata,
> -                                       extradata_size * 8, 1);
> +    ret = avpriv_mpeg4audio_get_config2(&mp4ac, extradata, extradata_size, 1, s);
>      /* 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
>
Patchset LGTM
James Almer Sept. 27, 2019, 1:40 p.m.
On 9/23/2019 11:24 PM, mypopy@gmail.com wrote:
> On Sun, Sep 22, 2019 at 7:28 AM James Almer <jamrial@gmail.com> wrote:
>>
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>>  libavformat/adtsenc.c     | 2 +-
>>  libavformat/isom.c        | 4 ++--
>>  libavformat/latmenc.c     | 2 +-
>>  libavformat/matroskaenc.c | 3 +--
>>  4 files changed, 5 insertions(+), 6 deletions(-)
>>
>> diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c
>> index 3c2840c6ab..d937e2bea9 100644
>> --- a/libavformat/adtsenc.c
>> +++ b/libavformat/adtsenc.c
>> @@ -53,7 +53,7 @@ static int adts_decode_extradata(AVFormatContext *s, ADTSContext *adts, const ui
>>      int off;
>>
>>      init_get_bits(&gb, buf, size * 8);
>> -    off = avpriv_mpeg4audio_get_config(&m4ac, buf, size * 8, 1);
>> +    off = avpriv_mpeg4audio_get_config2(&m4ac, buf, size, 1, s);
>>      if (off < 0)
>>          return off;
>>      skip_bits_long(&gb, off);
>> diff --git a/libavformat/isom.c b/libavformat/isom.c
>> index fa2e318099..edd0d81063 100644
>> --- a/libavformat/isom.c
>> +++ b/libavformat/isom.c
>> @@ -547,8 +547,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
>>              return ret;
>>          if (st->codecpar->codec_id == AV_CODEC_ID_AAC) {
>>              MPEG4AudioConfig cfg = {0};
>> -            ret = avpriv_mpeg4audio_get_config(&cfg, st->codecpar->extradata,
>> -                                               st->codecpar->extradata_size * 8, 1);
>> +            ret = avpriv_mpeg4audio_get_config2(&cfg, st->codecpar->extradata,
>> +                                                st->codecpar->extradata_size, 1, fc);
>>              if (ret < 0)
>>                  return ret;
>>              st->codecpar->channels = cfg.channels;
>> diff --git a/libavformat/latmenc.c b/libavformat/latmenc.c
>> index 1b16d752b6..db867ebf1a 100644
>> --- a/libavformat/latmenc.c
>> +++ b/libavformat/latmenc.c
>> @@ -62,7 +62,7 @@ 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;
>>      }
>> -    ctx->off = avpriv_mpeg4audio_get_config(&m4ac, buf, size * 8, 1);
>> +    ctx->off = avpriv_mpeg4audio_get_config2(&m4ac, buf, size, 1, s);
>>      if (ctx->off < 0)
>>          return ctx->off;
>>
>> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
>> index cef504fa05..a64ffdb690 100644
>> --- a/libavformat/matroskaenc.c
>> +++ b/libavformat/matroskaenc.c
>> @@ -717,8 +717,7 @@ static int get_aac_sample_rates(AVFormatContext *s, uint8_t *extradata, int extr
>>      MPEG4AudioConfig mp4ac;
>>      int ret;
>>
>> -    ret = avpriv_mpeg4audio_get_config(&mp4ac, extradata,
>> -                                       extradata_size * 8, 1);
>> +    ret = avpriv_mpeg4audio_get_config2(&mp4ac, extradata, extradata_size, 1, s);
>>      /* 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
>>
> Patchset LGTM

Pushed, thanks.

Patch hide | download patch | download mbox

diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c
index 3c2840c6ab..d937e2bea9 100644
--- a/libavformat/adtsenc.c
+++ b/libavformat/adtsenc.c
@@ -53,7 +53,7 @@  static int adts_decode_extradata(AVFormatContext *s, ADTSContext *adts, const ui
     int off;
 
     init_get_bits(&gb, buf, size * 8);
-    off = avpriv_mpeg4audio_get_config(&m4ac, buf, size * 8, 1);
+    off = avpriv_mpeg4audio_get_config2(&m4ac, buf, size, 1, s);
     if (off < 0)
         return off;
     skip_bits_long(&gb, off);
diff --git a/libavformat/isom.c b/libavformat/isom.c
index fa2e318099..edd0d81063 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -547,8 +547,8 @@  FF_ENABLE_DEPRECATION_WARNINGS
             return ret;
         if (st->codecpar->codec_id == AV_CODEC_ID_AAC) {
             MPEG4AudioConfig cfg = {0};
-            ret = avpriv_mpeg4audio_get_config(&cfg, st->codecpar->extradata,
-                                               st->codecpar->extradata_size * 8, 1);
+            ret = avpriv_mpeg4audio_get_config2(&cfg, st->codecpar->extradata,
+                                                st->codecpar->extradata_size, 1, fc);
             if (ret < 0)
                 return ret;
             st->codecpar->channels = cfg.channels;
diff --git a/libavformat/latmenc.c b/libavformat/latmenc.c
index 1b16d752b6..db867ebf1a 100644
--- a/libavformat/latmenc.c
+++ b/libavformat/latmenc.c
@@ -62,7 +62,7 @@  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;
     }
-    ctx->off = avpriv_mpeg4audio_get_config(&m4ac, buf, size * 8, 1);
+    ctx->off = avpriv_mpeg4audio_get_config2(&m4ac, buf, size, 1, s);
     if (ctx->off < 0)
         return ctx->off;
 
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index cef504fa05..a64ffdb690 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -717,8 +717,7 @@  static int get_aac_sample_rates(AVFormatContext *s, uint8_t *extradata, int extr
     MPEG4AudioConfig mp4ac;
     int ret;
 
-    ret = avpriv_mpeg4audio_get_config(&mp4ac, extradata,
-                                       extradata_size * 8, 1);
+    ret = avpriv_mpeg4audio_get_config2(&mp4ac, extradata, extradata_size, 1, s);
     /* 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.