需要編譯libjnivideo.so和libjniaudio.so因為不同版本或者修改後的框架不壹樣,所以需要在android源代碼中編譯自己的so。我的android 2.1源代碼是從官網下載的,沒有修改。
根據其目錄結構,在到框架/基目錄的鏈接中下載本機目錄中的源代碼。/havlenapetr/Android _ frameworks _ base
編譯中主要有三個錯誤。
1.
庫“libjnigraphics.so”不在預鏈接映射中
當前目錄下的Android . MK plus
LOCAL_PRELINK_MODULE := false
2.
frameworks/base/native/video/JNI/surface . CPP:17:36:錯誤:surfaceflinger/Surface.h:沒有這樣的文件或目錄
修改頭文件
# include & ltAndroid/surface . h & gt;
# include & ltui/surface . h & gt;
# include & ltutils/log . h & gt;
# include & ltSkBitmap.h & gt
# include & ltSkCanvas.h & gt
3.
make:* * * *沒有創建目標“out/target/product/generic/obj/shared _ libraries/libjnivideo _ intermediates/linked/libjnivideo . so”的規則。停下來。
當前目錄下的Android.mk
LOCAL_SHARED_LIBRARIES := /
libskia /
李輝/
libutils /
liblog
如果妳幸運的話,妳可以這樣編譯。
其次,編譯libffmpeg_jni.so
需要修改的地方:
1.
jni/jni/Android.mk
LOCAL_C_INCLUDES += /
$(本地路徑)/../libffmpeg /
$(本地路徑)/../libmediaplayer /
$(本地路徑)/../包含/
$(本地路徑)/../包含/android
ifeq ($(IN_NDK),true)
LOCAL_LDLIBS := -llog
其他
LOCAL_PRELINK_MODULE := false
LOCAL_LDLIBS := -llog
LOCAL_SHARED_LIBRARIES := liblog
endif
2.
向量. h
# include & lt新建& gt
# include & ltstdint.h & gt
# include & ltsys/types . h & gt;
# include & ltcut ils/log . h & gt;
# include & ltutils/vector impl . h & gt;
# include & ltutils/type helpers . h & gt;
# include & ltAndroid/errors . h & gt;
3.
& ltutils/type helpers . h & gt;
四
向量圖
# include & ltassert.h & gt
# include & ltstdint.h & gt
# include & ltsys/types . h & gt;
# include & ltAndroid/errors . h & gt;
5.
VectorImpl.cpp
# include & ltstring.h & gt
# include & ltstdlib.h & gt
# include & ltstdio.h & gt
# include & ltcut ils/log . h & gt;
# include & ltAndroid/errors . h & gt;
# include & ltutils/shared buffer . h & gt;
# include & ltutils/vector impl . h & gt;
同時妳也要把剛剛編譯的兩個so放到obj/local/armeabi目錄下,然後就可以編譯libffmpeg_jni.so了
最後,我們還應該將這兩個so放在libs/armeabi目錄中。否則,在運行時將找不到它。
放的時候太卡了,聲音不同步。