DJI-Mobile-SDK-Tutorials / Android-VideoStreamDecodingSample

This sample project demonstrates how to use FFmpeg for video frame parsing and to use MediaCodec for hardware decoding on DJI Products.
MIT License
169 stars 80 forks source link

ndk-build for DJIVIDEOSTREAMDECODE: APP_ABI problems. #12

Closed giannisergente closed 6 years ago

giannisergente commented 7 years ago

Hi everybody, I've just re-compiled the source C ++, using the latest Android NDK builder, after the download of the original libffmpeg.so and after replacing the "placeholder" libffmpeg.so located in app/jni (thanks to this post: https://github.com/DJI-Mobile-SDK-Tutorials/Android-VideoStreamDecodingSample/issues/5).

Now I can recompile the source, but only for APP_ABI :=armeabi-v7a. This works fine with my configuration (Samsung Galaxy Grand Prime - Android 5.0.2), but the app crashes on a Nexus 7 tablet. So, i tried to recompile also the others APP_ABI, by using the following makefile:

APP_ABI := all

but it didn't compile correctly, with the following error message:

C:\Users\Gianpaolo\AppData\Local\Android\Sdk\ndk-bundle\ndk-build [arm64-v8a] SharedLibrary : libdjivideojni.so ./obj/local/arm64-v8a/libffmpeg.so: error adding symbols: File in wrong format clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [obj/local/arm64-v8a/libdjivideojni.so] Error 1 Instead, this is the error message if I try to compile for x86 ABI:

[x86] Compile        : djivideojni <= dji_video_jni.c
jni/dji_video_jni.c:63:51: warning: passing 'uint8_t *' (aka 'unsigned char *') to parameter of type 'const jbyte *' (aka 'const signed char *') converts between pointers to integer
      types with different sign [-Wpointer-sign]
        (*env)->SetByteArrayRegion(env, jarray, 0, size, buf);
                                                         ^~~
1 warning generated.
[x86] Prebuilt       : libffmpeg.so <= jni/
[x86] SharedLibrary  : libdjivideojni.so
C:/Users/Gianpaolo/AppData/Local/Android/sdk/ndk-bundle/build//../toolchains/x86-4.9/prebuilt/windows-x86_64/lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin\ld: e
rror: ./obj/local/x86/libffmpeg.so: incompatible target
jni/dji_video_jni.c:41: error: undefined reference to 'av_register_all'
jni/dji_video_jni.c:43: error: undefined reference to 'av_codec_next'
jni/dji_video_jni.c:77: error: undefined reference to 'avcodec_register_all'
jni/dji_video_jni.c:78: error: undefined reference to 'av_register_all'
jni/dji_video_jni.c:81: error: undefined reference to 'avcodec_find_decoder'
jni/dji_video_jni.c:82: error: undefined reference to 'avcodec_alloc_context3'
jni/dji_video_jni.c:83: error: undefined reference to 'av_parser_init'
jni/dji_video_jni.c:96: error: undefined reference to 'avcodec_open2'
jni/dji_video_jni.c:102: error: undefined reference to 'av_frame_alloc'
jni/dji_video_jni.c:126: error: undefined reference to 'av_init_packet'
jni/dji_video_jni.c:132: error: undefined reference to 'av_parser_parse2'
jni/dji_video_jni.c:165: error: undefined reference to 'av_free_packet'
jni/dji_video_jni.c:225: error: undefined reference to 'avcodec_close'
jni/dji_video_jni.c:229: error: undefined reference to 'av_free'
jni/dji_video_jni.c:230: error: undefined reference to 'av_free'
jni/dji_video_jni.c:231: error: undefined reference to 'av_parser_close'
clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [obj/local/x86/libdjivideojni.so] Error 1

How can I do to compile also for the others ABI in order to try this demo on Nexus 7 tablet?

giannisergente commented 7 years ago

No suggestions? @oliverou so, is not possible to recompile library for x86 and arm64-v8a without errors? if I understood well, is not possible to use a modified version of your example code on devices using x86 and arm64-v8a Application Binary Interface? please help me to fix this point...

dji-dev commented 6 years ago

Will go ahead and close this ticket as current version should not have this problem any more. Our app is now compatible with v7, v8a and x86. Please feel free to reopen if the problem still exists. Thanks!