[FFmpeg-devel] [PATCH 224/281] libfdk-aac: convert to new channel layout API

Anton Khirnov anton at khirnov.net
Fri Feb 25 13:18:20 EET 2022


Quoting James Almer (2022-01-13 03:05:03)
> diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c
> index 7ee2f13ac7..d43f45d9ee 100644
> --- a/libavcodec/libfdk-aacenc.c
> +++ b/libavcodec/libfdk-aacenc.c
> @@ -128,7 +128,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
>      int aot = FF_PROFILE_AAC_LOW + 1;
>      int sce = 0, cpe = 0;
>  
> -    if ((err = aacEncOpen(&s->handle, 0, avctx->channels)) != AACENC_OK) {
> +    if ((err = aacEncOpen(&s->handle, 0, avctx->ch_layout.nb_channels)) != AACENC_OK) {
>          av_log(avctx, AV_LOG_ERROR, "Unable to open the encoder: %s\n",
>                 aac_get_error(err));
>          goto error;
> @@ -159,7 +159,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
>          goto error;
>      }
>  
> -    switch (avctx->channels) {
> +    switch (avctx->ch_layout.nb_channels) {
>      case 1: mode = MODE_1;       sce = 1; cpe = 0; break;
>      case 2:
>  #if FDKENC_VER_AT_LEAST(4, 0) // 4.0.0
> @@ -193,7 +193,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
>      case 8:
>          sce = 2;
>          cpe = 3;
> -        if (avctx->channel_layout == AV_CH_LAYOUT_7POINT1) {
> +        if (avctx->ch_layout.u.mask == AV_CH_LAYOUT_7POINT1) {

Either check for order == NATIVE or use channel_layout_compare.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list