我想創建一個使用FFMpeg的android應用程序。爲此,我從http://www.ffmpeg.org/olddownload.html下載了FFmpeg代碼(v 0.8.15)。和編譯的代碼按在http://www.roman10.net/how-to-build-ffmpeg-for-android/FFmpeg Android平臺
結果作出批示,.a文件已經在Android的/ lib文件夾中生成& .h文件中的android/include文件夾。
但是,當我嘗試創建本地代碼的.so文件時,使用了此預構建的FFmpeg庫(.a文件),它給出了未定義的引用錯誤。
請在下面給出我的項目的代碼結構。
項目路徑是/home/guest/Neeraj_temp/FFMpeg-Example
在這條道路,我創建了兩個文件夾JNI &預建 在預置的文件夾中,我不停libavfilter.a,libavcodec.a,libavformat.a,libavutil.a,libswscale.a 在jni文件夾中,我保留了一個包含所有.h文件夾(libavcodec,libavfilter,libavformat,libavutil,libswscale)的包含文件夾。
api-example.c文件也保存在使用FFmpeg的API的jni文件夾中。 & jni文件夾中的一個Android.mk文件。
Android.mk:-
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libFFmpeg
LOCAL_C_INCLUDES := $(LOCAL_PATH)/FFMpeg/include
LOCAL_SRC_FILES := api-example.c
LOCAL_LDLIBS += -L$(LOCAL_PATH)/../prebuilt -lavfilter -lavutil -lavformat -lavcodec -lswscale
include $(BUILD_SHARED_LIBRARY)
錯誤:
/home/guest/Neeraj_temp/ffmpeg-0.8.15/libavcodec/wavpack.c:689: undefined reference to `av_log'
/home/guest/Neeraj_temp/FFMpeg-Example/jni/../prebuilt/libavcodec.a(wavpack.o): In function `wv_unpack_stereo':
/home/guest/Neeraj_temp/ffmpeg-0.8.15/libavcodec/wavpack.c:604: undefined reference to `av_log'
/home/guest/Neeraj_temp/ffmpeg-0.8.15/libavcodec/wavpack.c:608: undefined reference to `av_log'
/home/guest/Neeraj_temp/FFMpeg-Example/jni/../prebuilt/libavcodec.a(wavpack.o):/home/guest/Neeraj_temp/ffmpeg-0.8.15/libavcodec/wavpack.c:1215: more undefined references to `av_log' follow
/home/guest/Neeraj_temp/FFMpeg-Example/jni/../prebuilt/libavcodec.a(wmavoice.o): In function `synth_block_fcb_acb':
/home/guest/Neeraj_temp/ffmpeg-0.8.15/libavcodec/wmavoice.c:1359: undefined reference to `av_memcpy_backptr'
/home/guest/Neeraj_temp/FFMpeg-Example/jni/../prebuilt/libavcodec.a(wmavoice.o): In function `synth_frame':
/home/guest/Neeraj_temp/ffmpeg-0.8.15/libavcodec/wmavoice.c:1441: undefined reference to `av_log'
/home/guest/Neeraj_temp/FFMpeg-Example/jni/../prebuilt/libavcodec.a(wmavoice.o): In function `synth_superframe':
/home/guest/Neeraj_temp/ffmpeg-0.8.15/libavcodec/wmavoice.c:1765: undefined reference to `av_log'
/home/guest/Neeraj_temp/FFMpeg-Example/jni/../prebuilt/libavcodec.a(wmavoice.o): In function `wmavoice_decode_packet':
/home/guest/Neeraj_temp/ffmpeg-0.8.15/libavcodec/wmavoice.c:1919: undefined reference to `av_log'
/home/guest/Neeraj_temp/FFMpeg-Example/jni/../prebuilt/libavcodec.a(wmavoice.o): In function `wmavoice_decode_init':
/home/guest/Neeraj_temp/ffmpeg-0.8.15/libavcodec/wmavoice.c:350: undefined reference to `av_log'
/home/guest/Neeraj_temp/ffmpeg-0.8.15/libavcodec/wmavoice.c:373: undefined reference to `av_log'
/home/guest/Neeraj_temp/FFMpeg-Example/jni/../prebuilt/libavcodec.a(wmavoice.o):/home/guest/Neeraj_temp/ffmpeg-0.8.15/libavcodec/wmavoice.c:397: more undefined references to `av_log' follow
/home/guest/Neeraj_temp/FFMpeg-Example/jni/../prebuilt/libavcodec.a(wnv1.o): In function `decode_frame':
/home/guest/Neeraj_temp/ffmpeg-0.8.15/libavcodec/wnv1.c:81: undefined reference to `av_reverse'
/home/guest/Neeraj_temp/FFMpeg-Example/jni/../prebuilt/libavcodec.a(ws-snd1.o): In function `ws_snd_decode_frame':
/home/guest/Neeraj_temp/ffmpeg-0.8.15/libavcodec/ws-snd1.c:70: undefined reference to `av_log'
/home/guest/Neeraj_temp/ffmpeg-0.8.15/libavcodec/ws-snd1.c:83: undefined reference to `av_log'
/home/guest/Neeraj_temp/ffmpeg-0.8.15/libavcodec/ws-snd1.c:79: undefined reference to `av_log'
/home/guest/Neeraj_temp/FFMpeg-Example/jni/../prebuilt/libavcodec.a(xan.o): In function `xan_decode_frame':
/home/guest/Neeraj_temp/ffmpeg-0.8.15/libavcodec/xan.c:568: undefined reference to `av_log'
/home/guest/Neeraj_temp/ffmpeg-0.8.15/libavcodec/xan.c:551: undefined reference to `av_log'
/home/guest/Neeraj_temp/FFMpeg-Example/jni/../prebuilt/libavcodec.a(xan.o):/home/guest/Neeraj_temp/ffmpeg-0.8.15/libavcodec/xan.c:515: more undefined references to `av_log' follow
/home/guest/Neeraj_temp/FFMpeg-Example/jni/../prebuilt/libavcodec.a(xan.o): In function `xan_unpack':
/home/guest/Neeraj_temp/ffmpeg-0.8.15/libavcodec/xan.c:178: undefined reference to `av_memcpy_backptr'
/home/guest/Neeraj_temp/FFMpeg-Example/jni/../prebuilt/libavcodec.a(xl.o): In function `decode_frame':
/home/guest/Neeraj_temp/ffmpeg-0.8.15/libavcodec/xl.c:60: undefined reference to `av_log'
/home/guest/Neeraj_temp/FFMpeg-Example/jni/../prebuilt/libavcodec.a(xsubdec.o): In function `decode_frame'
我已經讀了很多博客,但依然沒能得到解決的。請爲我提供解決方案。我如何構建代碼,我不應該得到這些錯誤&獲得代碼編譯。
謝謝。
我使用nm命令進行了檢查,發現av_log&av_reverse存在於libavutil.a中。這些行是: - 「00000070 T av_log」&「00000200 R av_reverse」。以及我驗證log.o&matematices.o也被構建。 – Neeraj