[vlc-devel] [PATCH 03/12] add libanw.*

Thomas Guillem thomas at gllm.fr
Fri Nov 14 17:10:18 CET 2014


---
 Makefile                                   |  2 ++
 libvlc/jni/Android.mk                      | 24 +++++++++++++++++++-----
 libvlc/src/org/videolan/libvlc/LibVLC.java | 13 +++++++++++++
 3 files changed, 34 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 558081a..c8de0b6 100644
--- a/Makefile
+++ b/Makefile
@@ -22,6 +22,8 @@ endif
 # (after android Jelly Bean, we prefer to use MediaCodec instead of iomx)
 #LIBVLC_LIBS += libiomx.19 libiomx.18
 
+LIBVLC_LIBS += libanw.13 libanw.14 libanw.18
+
 LIBVLCJNI= $(addprefix $(SRC)/obj/local/$(ARCH)/,$(addsuffix .so,$(LIBVLC_LIBS)))
 
 LIBVLCJNI_H=$(SRC)/jni/libvlcjni.h
diff --git a/libvlc/jni/Android.mk b/libvlc/jni/Android.mk
index 4425516..b2032ab 100644
--- a/libvlc/jni/Android.mk
+++ b/libvlc/jni/Android.mk
@@ -88,11 +88,6 @@ 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 -llog -lcutils -lui
 LIBIOMX_CFLAGS_COMMON := -Wno-psabi
-# Once we always build this with a version of vlc that contains nativewindowpriv.c,
-# we can remove this condition
-ifneq (,$(wildcard $(LOCAL_PATH)/../$(VLC_SRC_DIR)/modules/video_output/android/nativewindowpriv.c))
-LIBIOMX_SRC_FILES_COMMON += ../$(VLC_SRC_DIR)/modules/video_output/android/nativewindowpriv.c
-endif
 
 # no hwbuffer for gingerbread
 LIBIOMX_INCLUDES_10 := $(LIBIOMX_INCLUDES_COMMON) \
@@ -149,3 +144,22 @@ endef
 # call build_iomx for each libiomx-* in LIBVLC_LIBS
 $(foreach IOMX_MODULE,$(filter libiomx.%,$(LIBVLC_LIBS)), \
 	$(eval $(call build_iomx,$(IOMX_MODULE),$(subst libiomx.,,$(IOMX_MODULE)))))
+
+LIBANW_SRC_FILES_COMMON += ../$(VLC_SRC_DIR)/modules/video_output/android/nativewindowpriv.c
+# Once we always build this with a version of vlc that contains nativewindowpriv.c,
+# we can remove this condition
+ifneq (,$(wildcard $(LOCAL_PATH)/$(LIBANW_SRC_FILES_COMMON)))
+
+define build_anw
+include $(CLEAR_VARS)
+LOCAL_MODULE := $(1)
+LOCAL_SRC_FILES  := $(LIBANW_SRC_FILES_COMMON)
+LOCAL_C_INCLUDES := $(LIBIOMX_INCLUDES_$(2))
+LOCAL_LDLIBS     := -L$(ANDROID_LIBS) -llog -lhardware
+LOCAL_CFLAGS     := $(LIBIOMX_CFLAGS_COMMON) -DANDROID_API=$(2)
+include $(BUILD_SHARED_LIBRARY)
+endef
+
+$(foreach ANW_MODULE,$(filter libanw.%,$(LIBVLC_LIBS)), \
+    $(eval $(call build_anw,$(ANW_MODULE),$(subst libanw.,,$(ANW_MODULE)))))
+endif
diff --git a/libvlc/src/org/videolan/libvlc/LibVLC.java b/libvlc/src/org/videolan/libvlc/LibVLC.java
index cebad99..1e31ca1 100644
--- a/libvlc/src/org/videolan/libvlc/LibVLC.java
+++ b/libvlc/src/org/videolan/libvlc/LibVLC.java
@@ -113,6 +113,19 @@ public class LibVLC {
 
     /* Load library before object instantiation */
     static {
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
+            try {
+                if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.HONEYCOMB_MR2)
+                    System.loadLibrary("anw.13");
+                else if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR1)
+                    System.loadLibrary("anw.14");
+                else
+                    System.loadLibrary("anw.18");
+            } catch (Throwable t) {
+                Log.w(TAG, "Unable to load the anw library: " + t);
+            }
+        }
+
         try {
             if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1)
                 System.loadLibrary("iomx.10");
-- 
2.1.1




More information about the vlc-devel mailing list