mstorsjo / fdk-aac

A standalone library of the Fraunhofer FDK AAC code from Android.

Home Page:https://sourceforge.net/projects/opencore-amr/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

libavcodec/libfdk-aacenc.c:292:34: error: ‘AACENC_InfoStruct {aka struct <anonymous>}’ has no member named ‘encoderDelay’

rgaufman opened this issue · comments

When trying to compile FFMPEG against fdk-aac, both latest from master (2018-09-02), I'm getting:

...
CC	libavcodec/libfdk-aacenc.o
CC	libavcodec/libx264.o
libavcodec/libfdk-aacenc.c: In function ‘aac_encode_init’:
libavcodec/libfdk-aacenc.c:292:34: error: ‘AACENC_InfoStruct {aka struct <anonymous>}’ has no member named ‘encoderDelay’
     avctx->initial_padding = info.encoderDelay;
                                  ^
ffbuild/common.mak:60: recipe for target 'libavcodec/libfdk-aacenc.o' failed
make: *** [libavcodec/libfdk-aacenc.o] Error 1
make: *** Waiting for unfinished jobs....
$/data/tmp/ffmpeg$

Any ideas?

Yes - the new version of fdk-aac has changed the API slightly, and this requires a patch which isn't in ffmpeg yet. Hopefully it is there soon. To fix your build, manually apply this patch: https://git.libav.org/?p=libav.git;a=commitdiff_plain;h=141c960e21d2860e354f9b90df136184dd00a9a8;hp=c8bca9fe466f810fd484e2c6db7ef7bc83b5a943

What is the process for manually applying the patch given in the post above? Where does that go?

Manually you open the source file in a text edit, go to the line number shown in the path and add the lines with + and delete the lines with -.

Thanks, vargas! I learned something, and it appears to have worked

commented

I did the solution proposed by @mstorsjo and @vargas1010; Unfortunately, the solution didn't work for me. The "‘AACENC_InfoStruct {aka struct }.....’ error is replaced with new error:

CC libavcodec/libaomdec.o CC libavcodec/libaomenc.o libavcodec/libaomenc.c:744:109: error: ‘AOM_ERROR_RESILIENT_PARTITIONS’ undeclared here (not in a function) " is still done over the partition boundary.", 0, AV_OPT_TYPE_CONST, {.i64 = AOM_ERROR_R ^ ffbuild/common.mak:60: recipe for target 'libavcodec/libaomenc.o' failed make: *** [libavcodec/libaomenc.o] Error 1

My goal is to compile and install ffmpeg, according to it's main document on https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu , and I did it successfully about two months ago; but, It does not work now.

The error with libavcodec/libaomenc.o has nothing to do with fdk-aac. The fix for building with the latest version of fdk-aac is now in ffmpeg master, so there's nothing more to do here.

commented

Thanks @mstorsjo :)

I have issues with this patch (and the already patched version of FFMpeg) wiith at least MSVC 19.14.26433:

Example:

#define AACENCODER_LIB_VL0 4
#define AACENCODER_LIB_VL1 0
#define AACENCODER_LIB_VL2 0

#define FDKENC_VER_AT_LEAST(vl0, vl1) \
    (defined(AACENCODER_LIB_VL0) && \
        ((AACENCODER_LIB_VL0 > vl0) || \
         (AACENCODER_LIB_VL0 == vl0 && AACENCODER_LIB_VL1 >= vl1)))

// returns "FALSE"
#if (FDKENC_VER_AT_LEAST(4, 0))
#pragma message("TRUE")
#else
#pragma message("FALSE")
#endif

// returns "TRUE"
#if (defined(AACENCODER_LIB_VL0) && \
	((AACENCODER_LIB_VL0 > 4) || \
		(AACENCODER_LIB_VL0 == 4 && AACENCODER_LIB_VL1 >= 0)))
#pragma message("TRUE")
#else
#pragma message("FALSE")
#endif

// Crashes because defined() does not work with a literal
#if (defined(4) && ((4 > 4) || (4 == 4 && 0 >= 0)))
#pragma message("TRUE")
#else
#pragma message("FALSE")
#endif

My assumption is "defined(AACENCODER_LIB_VL0)" gets resolved to "defined(4)" before the final macro gets resolved.

I have issues with this patch (and the already patched version of FFMpeg) wiith at least MSVC 19.14.26433:

Thanks for the great analysis! I presume this adjustment would fix it for you?

diff --git a/libavcodec/libfdk-aacdec.c b/libavcodec/libfdk-aacdec.c
index ca70a49ad4..b69a1c1e86 100644
--- a/libavcodec/libfdk-aacdec.c
+++ b/libavcodec/libfdk-aacdec.c
@@ -25,10 +25,13 @@
 #include "avcodec.h"
 #include "internal.h"
 
+#ifdef AACDECODER_LIB_VL0
 #define FDKDEC_VER_AT_LEAST(vl0, vl1) \
-    (defined(AACDECODER_LIB_VL0) && \
-        ((AACDECODER_LIB_VL0 > vl0) || \
-         (AACDECODER_LIB_VL0 == vl0 && AACDECODER_LIB_VL1 >= vl1)))
+    (AACDECODER_LIB_VL0 > vl0) || \
+     (AACDECODER_LIB_VL0 == vl0 && AACDECODER_LIB_VL1 >= vl1))
+#else
+#define FDKDEC_VER_AT_LEAST(vl0, vl1) 0
+#endif
 
 #if !FDKDEC_VER_AT_LEAST(2, 5) // < 2.5.10
 #define AAC_PCM_MAX_OUTPUT_CHANNELS AAC_PCM_OUTPUT_CHANNELS
diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c
index f71a276403..3b492ef8f4 100644
--- a/libavcodec/libfdk-aacenc.c
+++ b/libavcodec/libfdk-aacenc.c
@@ -26,10 +26,13 @@
 #include "audio_frame_queue.h"
 #include "internal.h"
 
+#ifdef AACENCODER_LIB_VL0
 #define FDKENC_VER_AT_LEAST(vl0, vl1) \
-    (defined(AACENCODER_LIB_VL0) && \
-        ((AACENCODER_LIB_VL0 > vl0) || \
-         (AACENCODER_LIB_VL0 == vl0 && AACENCODER_LIB_VL1 >= vl1)))
+    ((AACENCODER_LIB_VL0 > vl0) || \
+     (AACENCODER_LIB_VL0 == vl0 && AACENCODER_LIB_VL1 >= vl1))
+#else
+#define FDKENC_VER_AT_LEAST(vl0, vl1) 0
+#endif
 
 typedef struct AACContext {
     const AVClass *class;

Yes, works fine with this patch! Thanks!

P.S.: One opening bracket is missing for the decoder part.

Yes, works fine with this patch! Thanks!

Ok, great!

P.S.: One opening bracket is missing for the decoder part.

Ah, thanks - I didn't test it locally before sending...

I'll send this fix upstream then.

Can I just run git .. somthing to replace libfdk-aacenc.c file with the provided patch?