[FFmpeg-cvslog] libfdk-aacdec: Support building with the latest version of fdk-aac

Martin Storsjö git at videolan.org
Mon Nov 10 02:51:19 CET 2014


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Sat Nov  8 22:39:44 2014 +0200| [b44a242c3dfa1225ca4e75135ed5fbe7f0e3c378] | committer: Michael Niedermayer

libfdk-aacdec: Support building with the latest version of fdk-aac

The latest fdk-aac code drop (from android 5.0) changed the channel
layout enums (changing the value of existing enum constants), and
renamed the option for downmixing.

The failsafe comparison between ctype and FF_ARRAY_ELEMS(channel_counts)
can trigger warnings (-Wtautological-constant-out-of-range-compare)
when building with the old FDK AAC releases, where it can't be
out of range with the enum values used there.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b44a242c3dfa1225ca4e75135ed5fbe7f0e3c378
---

 libavcodec/libfdk-aacdec.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/libavcodec/libfdk-aacdec.c b/libavcodec/libfdk-aacdec.c
index e4bae1a..90cd956 100644
--- a/libavcodec/libfdk-aacdec.c
+++ b/libavcodec/libfdk-aacdec.c
@@ -25,6 +25,12 @@
 #include "avcodec.h"
 #include "internal.h"
 
+/* The version macro is introduced the same time as the setting enum was
+ * changed, so this check should suffice. */
+#ifndef AACDECODER_LIB_VL0
+#define AAC_PCM_MAX_OUTPUT_CHANNELS AAC_PCM_OUTPUT_CHANNELS
+#endif
+
 enum ConcealMethod {
     CONCEAL_METHOD_SPECTRAL_MUTING      =  0,
     CONCEAL_METHOD_NOISE_SUBSTITUTION   =  1,
@@ -76,7 +82,7 @@ static int get_stream_info(AVCodecContext *avctx)
 {
     FDKAACDecContext *s   = avctx->priv_data;
     CStreamInfo *info     = aacDecoder_GetStreamInfo(s->handle);
-    int channel_counts[9] = { 0 };
+    int channel_counts[0x24] = { 0 };
     int i, ch_error       = 0;
     uint64_t ch_layout    = 0;
 
@@ -94,7 +100,7 @@ static int get_stream_info(AVCodecContext *avctx)
 
     for (i = 0; i < info->numChannels; i++) {
         AUDIO_CHANNEL_TYPE ctype = info->pChannelType[i];
-        if (ctype <= ACT_NONE || ctype > ACT_TOP) {
+        if (ctype <= ACT_NONE || ctype > FF_ARRAY_ELEMS(channel_counts)) {
             av_log(avctx, AV_LOG_WARNING, "unknown channel type\n");
             break;
         }
@@ -239,7 +245,7 @@ static av_cold int fdk_aac_decode_init(AVCodecContext *avctx)
         }
 
         if (downmix_channels != -1) {
-            if (aacDecoder_SetParam(s->handle, AAC_PCM_OUTPUT_CHANNELS,
+            if (aacDecoder_SetParam(s->handle, AAC_PCM_MAX_OUTPUT_CHANNELS,
                                     downmix_channels) != AAC_DEC_OK) {
                av_log(avctx, AV_LOG_WARNING, "Unable to set output channels in the decoder\n");
             } else {



More information about the ffmpeg-cvslog mailing list