[FFmpeg-devel] [PATCH 2/2] libfdk-aacenc: disable hard version requirements

James Almer jamrial at gmail.com
Wed Feb 5 05:40:48 CET 2014


On 05/02/14 1:01 AM, Timothy Gu wrote:
> Enable compilation on machines with an old libfdk-aac.
> 
> Signed-off-by: Timothy Gu <timothygu99 at gmail.com>
> ---
>  configure                  | 4 +---
>  doc/encoders.texi          | 3 +++
>  libavcodec/libfdk-aacenc.c | 4 ++++
>  3 files changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/configure b/configure
> index c46bfd3..32bc5ba 100755
> --- a/configure
> +++ b/configure
> @@ -4437,9 +4437,7 @@ enabled libcelt           && require libcelt celt/celt.h celt_decode -lcelt0 &&
>                                 die "ERROR: libcelt must be installed and version must be >= 0.11.0."; }
>  enabled libcaca           && require_pkg_config caca caca.h caca_create_canvas
>  enabled libfaac           && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
> -enabled libfdk_aac        && require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac &&
> -                             { check_cpp_condition fdk-aac/aacenc_lib.h "AACENCODER_LIB_VL0 >= 3 && AACENCODER_LIB_VL1 >= 4 && AACENCODER_LIB_VL2 >= 12" ||
> -                               die "ERROR: libfdk-aac must be installed and version must be >= 0.1.3."; }
> +enabled libfdk_aac        && require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac
>  flite_libs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal -lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish -lflite_cmulex -lflite"
>  enabled libflite          && require2 libflite "flite/flite.h" flite_init $flite_libs
>  enabled libfreetype       && require_libfreetype
> diff --git a/doc/encoders.texi b/doc/encoders.texi
> index d163440..027b395 100644
> --- a/doc/encoders.texi
> +++ b/doc/encoders.texi
> @@ -623,6 +623,9 @@ VBR encoding, enabled through the @option{vbr} or @option{flags
>  +qscale} options, is experimental and only works with some
>  combinations of parameters.
>  
> +Support for encoding 7.1 audio is only supported with libfdk-aac 0.1.3 or
> +higher.

"Support for encoding 7.1 audio is only available with libfdk-aac 0.1.3 or higher"

> +
>  For more information see the fdk-aac project at
>  @url{http://sourceforge.net/p/opencore-amr/fdk-aac/}.
>  
> diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c
> index 2d91e58..e6bcfd7 100644
> --- a/libavcodec/libfdk-aacenc.c
> +++ b/libavcodec/libfdk-aacenc.c
> @@ -151,6 +151,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
>      case 4: mode = MODE_1_2_1;   sce = 2; cpe = 1; break;
>      case 5: mode = MODE_1_2_2;   sce = 1; cpe = 2; break;
>      case 6: mode = MODE_1_2_2_1; sce = 2; cpe = 2; break;
> +#if AACENCODER_LIB_VL0 >= 3 && AACENCODER_LIB_VL1 >= 4 && AACENCODER_LIB_VL2 >= 12

Assuming AACENCODER_LIB_VL2 will be reset to 0 once AACENCODER_LIB_VL1 is bumped to 5 
or AACENCODER_LIB_VL0 to 4, the correct check would be

#if AACENCODER_LIB_VL0 > 3 || (AACENCODER_LIB_VL0 == 3 && AACENCODER_LIB_VL1 > 4) || \
    (AACENCODER_LIB_VL0 == 3 && AACENCODER_LIB_VL1 == 4 && AACENCODER_LIB_VL2 >= 12)

Otherwise, it will be false with versions 3.5.* and above.
Alternatively, since these three defines were introduced after the 7.1 encoding feature, 
a simple #ifdef AACENCODER_LIB_VL0 should be enough.

>      case 8:
>          sce = 2;
>          cpe = 3;
> @@ -161,6 +162,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
>              mode = MODE_7_1_FRONT_CENTER;
>          }
>          break;
> +#endif
>      default:
>          av_log(avctx, AV_LOG_ERROR,
>                 "Unsupported number of channels %d\n", avctx->channels);
> @@ -394,8 +396,10 @@ static const uint64_t aac_channel_layout[] = {
>      AV_CH_LAYOUT_4POINT0,
>      AV_CH_LAYOUT_5POINT0_BACK,
>      AV_CH_LAYOUT_5POINT1_BACK,
> +#if AACENCODER_LIB_VL0 >= 3 && AACENCODER_LIB_VL1 >= 4 && AACENCODER_LIB_VL2 >= 12

Same as above

>      AV_CH_LAYOUT_7POINT1_WIDE_BACK,
>      AV_CH_LAYOUT_7POINT1,
> +#endif
>      0,
>  };
>  
> 



More information about the ffmpeg-devel mailing list