diff mbox series

[FFmpeg-devel,3/4] aac: define a new profile for USAC

Message ID 20240605030843.2807174-3-dev@lynne.ee
State New
Headers show
Series [FFmpeg-devel,1/4] mpeg4audio: rename AOT_USAC_NOSBR to AOT_USAC | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Lynne June 5, 2024, 3:08 a.m. UTC
This allows users to determine whether a stream is USAC or not.
---
 libavcodec/aac/aacdec_usac.c | 4 ++++
 libavcodec/avcodec.h         | 1 +
 libavcodec/defs.h            | 1 +
 libavcodec/profiles.c        | 1 +
 libavcodec/profiles.h        | 1 +
 5 files changed, 8 insertions(+)

Comments

Andreas Rheinhardt June 5, 2024, 5:33 a.m. UTC | #1
Lynne via ffmpeg-devel:
> This allows users to determine whether a stream is USAC or not.
> ---
>  libavcodec/aac/aacdec_usac.c | 4 ++++
>  libavcodec/avcodec.h         | 1 +
>  libavcodec/defs.h            | 1 +
>  libavcodec/profiles.c        | 1 +
>  libavcodec/profiles.h        | 1 +
>  5 files changed, 8 insertions(+)
> 
> diff --git a/libavcodec/aac/aacdec_usac.c b/libavcodec/aac/aacdec_usac.c
> index 7b36b49d63..5c3bb8d4ac 100644
> --- a/libavcodec/aac/aacdec_usac.c
> +++ b/libavcodec/aac/aacdec_usac.c
> @@ -494,6 +494,8 @@ int ff_aac_usac_config_decode(AACDecContext *ac, AVCodecContext *avctx,
>          }
>      }
>  
> +    ac->avctx->profile = AV_PROFILE_AAC_USAC;
> +
>      ret = ff_aac_usac_reset_state(ac, oc);
>      if (ret < 0)
>          return ret;
> @@ -1533,6 +1535,8 @@ int ff_aac_usac_decode_frame(AVCodecContext *avctx, AACDecContext *ac,
>      ff_aac_output_configure(ac, ac->oc[1].layout_map, ac->oc[1].layout_map_tags,
>                              ac->oc[1].status, 0);
>  
> +    ac->avctx->profile = AV_PROFILE_AAC_USAC;
> +
>      indep_flag = get_bits1(gb);
>  
>      nb_ch_el = 0;
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 2da63c87ea..257e04fe2d 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -1652,6 +1652,7 @@ typedef struct AVCodecContext {
>  #define FF_PROFILE_AAC_HE_V2 28
>  #define FF_PROFILE_AAC_LD   22
>  #define FF_PROFILE_AAC_ELD  38
> +#define FF_PROFILE_AAC_USAC 41

Don't add new deprecated defines.

>  #define FF_PROFILE_MPEG2_AAC_LOW 128
>  #define FF_PROFILE_MPEG2_AAC_HE  131
>  
> diff --git a/libavcodec/defs.h b/libavcodec/defs.h
> index 00d840ec19..7ddfdcad0b 100644
> --- a/libavcodec/defs.h
> +++ b/libavcodec/defs.h
> @@ -73,6 +73,7 @@
>  #define AV_PROFILE_AAC_HE_V2       28
>  #define AV_PROFILE_AAC_LD          22
>  #define AV_PROFILE_AAC_ELD         38
> +#define AV_PROFILE_AAC_USAC        41
>  #define AV_PROFILE_MPEG2_AAC_LOW  128
>  #define AV_PROFILE_MPEG2_AAC_HE   131
>  
> diff --git a/libavcodec/profiles.c b/libavcodec/profiles.c
> index 052b77926e..44bdf6f85b 100644
> --- a/libavcodec/profiles.c
> +++ b/libavcodec/profiles.c
> @@ -33,6 +33,7 @@ const AVProfile ff_aac_profiles[] = {
>      { AV_PROFILE_AAC_MAIN,  "Main" },
>      { AV_PROFILE_AAC_SSR,   "SSR"  },
>      { AV_PROFILE_AAC_LTP,   "LTP"  },
> +    { AV_PROFILE_AAC_USAC,  "xHE-AAC" },
>      { AV_PROFILE_UNKNOWN },
>  };
>  
> diff --git a/libavcodec/profiles.h b/libavcodec/profiles.h
> index 842201718b..33b7ffc17a 100644
> --- a/libavcodec/profiles.h
> +++ b/libavcodec/profiles.h
> @@ -35,6 +35,7 @@
>      FF_AVCTX_PROFILE_OPTION("aac_he_v2",     NULL, AUDIO, AV_PROFILE_AAC_HE_V2)\
>      FF_AVCTX_PROFILE_OPTION("aac_ld",        NULL, AUDIO, AV_PROFILE_AAC_LD)\
>      FF_AVCTX_PROFILE_OPTION("aac_eld",       NULL, AUDIO, AV_PROFILE_AAC_ELD)\
> +    FF_AVCTX_PROFILE_OPTION("aac_xhe",       NULL, AUDIO, AV_PROFILE_AAC_USAC)\
>      FF_AVCTX_PROFILE_OPTION("mpeg2_aac_low", NULL, AUDIO, AV_PROFILE_MPEG2_AAC_LOW)\
>      FF_AVCTX_PROFILE_OPTION("mpeg2_aac_he",  NULL, AUDIO, AV_PROFILE_MPEG2_AAC_HE)\
>
Lynne June 5, 2024, 1:08 p.m. UTC | #2
On 05/06/2024 07:33, Andreas Rheinhardt wrote:
> Lynne via ffmpeg-devel:
>> This allows users to determine whether a stream is USAC or not.
>> ---
>>   libavcodec/aac/aacdec_usac.c | 4 ++++
>>   libavcodec/avcodec.h         | 1 +
>>   libavcodec/defs.h            | 1 +
>>   libavcodec/profiles.c        | 1 +
>>   libavcodec/profiles.h        | 1 +
>>   5 files changed, 8 insertions(+)
>>
>> diff --git a/libavcodec/aac/aacdec_usac.c b/libavcodec/aac/aacdec_usac.c
>> index 7b36b49d63..5c3bb8d4ac 100644
>> --- a/libavcodec/aac/aacdec_usac.c
>> +++ b/libavcodec/aac/aacdec_usac.c
>> @@ -494,6 +494,8 @@ int ff_aac_usac_config_decode(AACDecContext *ac, AVCodecContext *avctx,
>>           }
>>       }
>>   
>> +    ac->avctx->profile = AV_PROFILE_AAC_USAC;
>> +
>>       ret = ff_aac_usac_reset_state(ac, oc);
>>       if (ret < 0)
>>           return ret;
>> @@ -1533,6 +1535,8 @@ int ff_aac_usac_decode_frame(AVCodecContext *avctx, AACDecContext *ac,
>>       ff_aac_output_configure(ac, ac->oc[1].layout_map, ac->oc[1].layout_map_tags,
>>                               ac->oc[1].status, 0);
>>   
>> +    ac->avctx->profile = AV_PROFILE_AAC_USAC;
>> +
>>       indep_flag = get_bits1(gb);
>>   
>>       nb_ch_el = 0;
>> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
>> index 2da63c87ea..257e04fe2d 100644
>> --- a/libavcodec/avcodec.h
>> +++ b/libavcodec/avcodec.h
>> @@ -1652,6 +1652,7 @@ typedef struct AVCodecContext {
>>   #define FF_PROFILE_AAC_HE_V2 28
>>   #define FF_PROFILE_AAC_LD   22
>>   #define FF_PROFILE_AAC_ELD  38
>> +#define FF_PROFILE_AAC_USAC 41
> 
> Don't add new deprecated defines.

Didn't notice. Removed locally.
James Almer June 5, 2024, 4:18 p.m. UTC | #3
On 6/5/2024 12:08 AM, Lynne via ffmpeg-devel wrote:
> This allows users to determine whether a stream is USAC or not.
> ---
>   libavcodec/aac/aacdec_usac.c | 4 ++++
>   libavcodec/avcodec.h         | 1 +
>   libavcodec/defs.h            | 1 +
>   libavcodec/profiles.c        | 1 +
>   libavcodec/profiles.h        | 1 +
>   5 files changed, 8 insertions(+)
> 
> diff --git a/libavcodec/aac/aacdec_usac.c b/libavcodec/aac/aacdec_usac.c
> index 7b36b49d63..5c3bb8d4ac 100644
> --- a/libavcodec/aac/aacdec_usac.c
> +++ b/libavcodec/aac/aacdec_usac.c
> @@ -494,6 +494,8 @@ int ff_aac_usac_config_decode(AACDecContext *ac, AVCodecContext *avctx,
>           }
>       }
>   
> +    ac->avctx->profile = AV_PROFILE_AAC_USAC;
> +
>       ret = ff_aac_usac_reset_state(ac, oc);
>       if (ret < 0)
>           return ret;
> @@ -1533,6 +1535,8 @@ int ff_aac_usac_decode_frame(AVCodecContext *avctx, AACDecContext *ac,
>       ff_aac_output_configure(ac, ac->oc[1].layout_map, ac->oc[1].layout_map_tags,
>                               ac->oc[1].status, 0);
>   
> +    ac->avctx->profile = AV_PROFILE_AAC_USAC;
> +
>       indep_flag = get_bits1(gb);
>   
>       nb_ch_el = 0;
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 2da63c87ea..257e04fe2d 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -1652,6 +1652,7 @@ typedef struct AVCodecContext {
>   #define FF_PROFILE_AAC_HE_V2 28
>   #define FF_PROFILE_AAC_LD   22
>   #define FF_PROFILE_AAC_ELD  38
> +#define FF_PROFILE_AAC_USAC 41
>   #define FF_PROFILE_MPEG2_AAC_LOW 128
>   #define FF_PROFILE_MPEG2_AAC_HE  131
>   
> diff --git a/libavcodec/defs.h b/libavcodec/defs.h
> index 00d840ec19..7ddfdcad0b 100644
> --- a/libavcodec/defs.h
> +++ b/libavcodec/defs.h
> @@ -73,6 +73,7 @@
>   #define AV_PROFILE_AAC_HE_V2       28
>   #define AV_PROFILE_AAC_LD          22
>   #define AV_PROFILE_AAC_ELD         38
> +#define AV_PROFILE_AAC_USAC        41
>   #define AV_PROFILE_MPEG2_AAC_LOW  128
>   #define AV_PROFILE_MPEG2_AAC_HE   131
>   
> diff --git a/libavcodec/profiles.c b/libavcodec/profiles.c
> index 052b77926e..44bdf6f85b 100644
> --- a/libavcodec/profiles.c
> +++ b/libavcodec/profiles.c
> @@ -33,6 +33,7 @@ const AVProfile ff_aac_profiles[] = {
>       { AV_PROFILE_AAC_MAIN,  "Main" },
>       { AV_PROFILE_AAC_SSR,   "SSR"  },
>       { AV_PROFILE_AAC_LTP,   "LTP"  },
> +    { AV_PROFILE_AAC_USAC,  "xHE-AAC" },
>       { AV_PROFILE_UNKNOWN },
>   };
>   
> diff --git a/libavcodec/profiles.h b/libavcodec/profiles.h
> index 842201718b..33b7ffc17a 100644
> --- a/libavcodec/profiles.h
> +++ b/libavcodec/profiles.h
> @@ -35,6 +35,7 @@
>       FF_AVCTX_PROFILE_OPTION("aac_he_v2",     NULL, AUDIO, AV_PROFILE_AAC_HE_V2)\
>       FF_AVCTX_PROFILE_OPTION("aac_ld",        NULL, AUDIO, AV_PROFILE_AAC_LD)\
>       FF_AVCTX_PROFILE_OPTION("aac_eld",       NULL, AUDIO, AV_PROFILE_AAC_ELD)\
> +    FF_AVCTX_PROFILE_OPTION("aac_xhe",       NULL, AUDIO, AV_PROFILE_AAC_USAC)\
>       FF_AVCTX_PROFILE_OPTION("mpeg2_aac_low", NULL, AUDIO, AV_PROFILE_MPEG2_AAC_LOW)\
>       FF_AVCTX_PROFILE_OPTION("mpeg2_aac_he",  NULL, AUDIO, AV_PROFILE_MPEG2_AAC_HE)\

Should be ok without FF_PROFILE_AAC_USAC.
diff mbox series

Patch

diff --git a/libavcodec/aac/aacdec_usac.c b/libavcodec/aac/aacdec_usac.c
index 7b36b49d63..5c3bb8d4ac 100644
--- a/libavcodec/aac/aacdec_usac.c
+++ b/libavcodec/aac/aacdec_usac.c
@@ -494,6 +494,8 @@  int ff_aac_usac_config_decode(AACDecContext *ac, AVCodecContext *avctx,
         }
     }
 
+    ac->avctx->profile = AV_PROFILE_AAC_USAC;
+
     ret = ff_aac_usac_reset_state(ac, oc);
     if (ret < 0)
         return ret;
@@ -1533,6 +1535,8 @@  int ff_aac_usac_decode_frame(AVCodecContext *avctx, AACDecContext *ac,
     ff_aac_output_configure(ac, ac->oc[1].layout_map, ac->oc[1].layout_map_tags,
                             ac->oc[1].status, 0);
 
+    ac->avctx->profile = AV_PROFILE_AAC_USAC;
+
     indep_flag = get_bits1(gb);
 
     nb_ch_el = 0;
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 2da63c87ea..257e04fe2d 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1652,6 +1652,7 @@  typedef struct AVCodecContext {
 #define FF_PROFILE_AAC_HE_V2 28
 #define FF_PROFILE_AAC_LD   22
 #define FF_PROFILE_AAC_ELD  38
+#define FF_PROFILE_AAC_USAC 41
 #define FF_PROFILE_MPEG2_AAC_LOW 128
 #define FF_PROFILE_MPEG2_AAC_HE  131
 
diff --git a/libavcodec/defs.h b/libavcodec/defs.h
index 00d840ec19..7ddfdcad0b 100644
--- a/libavcodec/defs.h
+++ b/libavcodec/defs.h
@@ -73,6 +73,7 @@ 
 #define AV_PROFILE_AAC_HE_V2       28
 #define AV_PROFILE_AAC_LD          22
 #define AV_PROFILE_AAC_ELD         38
+#define AV_PROFILE_AAC_USAC        41
 #define AV_PROFILE_MPEG2_AAC_LOW  128
 #define AV_PROFILE_MPEG2_AAC_HE   131
 
diff --git a/libavcodec/profiles.c b/libavcodec/profiles.c
index 052b77926e..44bdf6f85b 100644
--- a/libavcodec/profiles.c
+++ b/libavcodec/profiles.c
@@ -33,6 +33,7 @@  const AVProfile ff_aac_profiles[] = {
     { AV_PROFILE_AAC_MAIN,  "Main" },
     { AV_PROFILE_AAC_SSR,   "SSR"  },
     { AV_PROFILE_AAC_LTP,   "LTP"  },
+    { AV_PROFILE_AAC_USAC,  "xHE-AAC" },
     { AV_PROFILE_UNKNOWN },
 };
 
diff --git a/libavcodec/profiles.h b/libavcodec/profiles.h
index 842201718b..33b7ffc17a 100644
--- a/libavcodec/profiles.h
+++ b/libavcodec/profiles.h
@@ -35,6 +35,7 @@ 
     FF_AVCTX_PROFILE_OPTION("aac_he_v2",     NULL, AUDIO, AV_PROFILE_AAC_HE_V2)\
     FF_AVCTX_PROFILE_OPTION("aac_ld",        NULL, AUDIO, AV_PROFILE_AAC_LD)\
     FF_AVCTX_PROFILE_OPTION("aac_eld",       NULL, AUDIO, AV_PROFILE_AAC_ELD)\
+    FF_AVCTX_PROFILE_OPTION("aac_xhe",       NULL, AUDIO, AV_PROFILE_AAC_USAC)\
     FF_AVCTX_PROFILE_OPTION("mpeg2_aac_low", NULL, AUDIO, AV_PROFILE_MPEG2_AAC_LOW)\
     FF_AVCTX_PROFILE_OPTION("mpeg2_aac_he",  NULL, AUDIO, AV_PROFILE_MPEG2_AAC_HE)\