[Android] [PATCH 3/4] libiomx: Build the hwbuffer code if found

Martin Storsjö martin at martin.st
Fri Jul 25 00:38:55 CEST 2014


From: Thomas Guillem <guillem at archos.com>

The new iomx_hwbuffer.c file currently only exists in the master
branch in vlc.git, not in the 2.2 release branch.

Linking the libiomx-*.so to libcutils/liblog/libui even though we
don't use any functions from those (if iomx_hwbuffer.c isn't found)
doesn't hurt, and some of them are necessary even if iomx_hwbuffer.c
isn't built, since we still provide ANDROID_API to iomx.cpp (which
causes the HAS_USE_BUFFER codepaths to be built).
---
 vlc-android/jni/Android.mk | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/vlc-android/jni/Android.mk b/vlc-android/jni/Android.mk
index 2752d8e..a914c5a 100644
--- a/vlc-android/jni/Android.mk
+++ b/vlc-android/jni/Android.mk
@@ -79,32 +79,45 @@ include $(BUILD_SHARED_LIBRARY)
 
 LIBIOMX_SRC_FILES_COMMON := ../$(VLC_SRC_DIR)/modules/codec/omxil/iomx.cpp
 LIBIOMX_INCLUDES_COMMON := $(VLC_SRC_DIR)/modules/codec/omxil
-LIBIOMX_LDLIBS_COMMON := -L$(ANDROID_LIBS) -lgcc -lstagefright -lmedia -lutils -lbinder
+LIBIOMX_LDLIBS_COMMON := -L$(ANDROID_LIBS) -lgcc -lstagefright -lmedia -lutils -lbinder -llog -lcutils -lui
 LIBIOMX_CFLAGS_COMMON := -Wno-psabi
+# Once we always build this with a version of vlc that contains iomx_hwbuffer.c,
+# we can remove this condition
+ifneq (,$(wildcard $(LOCAL_PATH)/../$(VLC_SRC_DIR)/modules/codec/omxil/iomx_hwbuffer.c))
+LIBIOMX_SRC_FILES_COMMON += ../$(VLC_SRC_DIR)/modules/codec/omxil/iomx_hwbuffer.c
+endif
 
+# no hwbuffer for gingerbread
 LIBIOMX_INCLUDES_gingerbread := $(LIBIOMX_INCLUDES_COMMON) \
 	$(ANDROID_SYS_HEADERS_GINGERBREAD)/frameworks/base/include \
-	$(ANDROID_SYS_HEADERS_GINGERBREAD)/system/core/include
+	$(ANDROID_SYS_HEADERS_GINGERBREAD)/system/core/include \
+	$(ANDROID_SYS_HEADERS_GINGERBREAD)/hardware/libhardware/include
+LIBIOMX_LDLIBS_gingerbread := $(LIBIOMX_LDLIBS_COMMON)
+LIBIOMX_CFLAGS_gingerbread := $(LIBIOMX_CFLAGS_COMMON) -DANDROID_API=10
 
 LIBIOMX_INCLUDES_hc := $(LIBIOMX_INCLUDES_COMMON) \
 	$(ANDROID_SYS_HEADERS_HC)/frameworks/base/include \
 	$(ANDROID_SYS_HEADERS_HC)/frameworks/base/native/include \
 	$(ANDROID_SYS_HEADERS_HC)/system/core/include \
 	$(ANDROID_SYS_HEADERS_HC)/hardware/libhardware/include
+LIBIOMX_LDLIBS_hc := $(LIBIOMX_LDLIBS_COMMON)
+LIBIOMX_CFLAGS_hc := $(LIBIOMX_CFLAGS_COMMON) -DANDROID_API=11
 
 LIBIOMX_INCLUDES_ics := $(LIBIOMX_INCLUDES_COMMON) \
 	$(ANDROID_SYS_HEADERS_ICS)/frameworks/base/include \
 	$(ANDROID_SYS_HEADERS_ICS)/frameworks/base/native/include \
 	$(ANDROID_SYS_HEADERS_ICS)/system/core/include \
 	$(ANDROID_SYS_HEADERS_ICS)/hardware/libhardware/include
+LIBIOMX_LDLIBS_ics := $(LIBIOMX_LDLIBS_COMMON) $(LIBIOMX_LDLIBS_HWBUFFER)
+LIBIOMX_CFLAGS_ics := $(LIBIOMX_CFLAGS_COMMON) -DANDROID_API=14
 
 define build_iomx
 include $(CLEAR_VARS)
 LOCAL_MODULE := $(1)
 LOCAL_SRC_FILES  := $(LIBIOMX_SRC_FILES_COMMON)
 LOCAL_C_INCLUDES := $(LIBIOMX_INCLUDES_$(2))
-LOCAL_LDLIBS     := $(LIBIOMX_LDLIBS_COMMON)
-LOCAL_CFLAGS     := $(LIBIOMX_CFLAGS_COMMON)
+LOCAL_LDLIBS     := $(LIBIOMX_LDLIBS_$(2))
+LOCAL_CFLAGS     := $(LIBIOMX_CFLAGS_$(2))
 include $(BUILD_SHARED_LIBRARY)
 endef
 
-- 
1.8.5.2 (Apple Git-48)



More information about the Android mailing list