[vlc-devel] [PATCH] fdkaac: Fix build failure with libfdk-aac v2

Han Han hanhanzhiyeqianke at gmail.com
Sun Jan 13 13:48:59 CET 2019


fdkaac has changed encoderDelay to nDelay of AACENC_InfoStruct in v2.0.
Use encoderDelay before v2.0 and nDelay after v2.0.

Reference: https://github.com/mstorsjo/fdk-aac/issues/93

Signed-off-by: Han Han <hanhanzhiyeqianke at gmail.com>
---
 modules/codec/fdkaac.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/modules/codec/fdkaac.c b/modules/codec/fdkaac.c
index e0b3088c4a..861a734337 100644
--- a/modules/codec/fdkaac.c
+++ b/modules/codec/fdkaac.c
@@ -92,6 +92,11 @@ static void CloseEncoder(vlc_object_t *);
 #define SIGNALING_COMPATIBLE 1
 #define SIGNALING_HIERARCHICAL 2
 
+#define FDKENC_VER_AT_LEAST(vl0, vl1) \
+    (defined(AACENCODER_LIB_VL0) && \
+        ((AACENCODER_LIB_VL0 > vl0) || \
+         (AACENCODER_LIB_VL0 == vl0 && AACENCODER_LIB_VL1 >= vl1)))
+
 static const int pi_aot_values[] = { PROFILE_AAC_LC, PROFILE_AAC_HE, PROFILE_AAC_HE_v2, PROFILE_AAC_LD, PROFILE_AAC_ELD };
 static const char *const ppsz_aot_descriptions[] =
 { N_("AAC-LC"), N_("HE-AAC"), N_("HE-AAC-v2"), N_("AAC-LD"), N_("AAC-ELD") };
@@ -288,7 +293,11 @@ static int OpenEncoder(vlc_object_t *p_this)
     p_sys->i_maxoutputsize = 768*p_enc->fmt_in.audio.i_channels;
     p_enc->fmt_in.audio.i_bitspersample = 16;
     p_sys->i_frame_size = info.frameLength;
+#if FDKENC_VER_AT_LEAST(4, 0)
+    p_sys->i_encoderdelay = info.nDelay;
+#else
     p_sys->i_encoderdelay = info.encoderDelay;
+#endif
 
     p_enc->fmt_out.i_extra = info.confSize;
     if (p_enc->fmt_out.i_extra) {
-- 
2.19.2



More information about the vlc-devel mailing list