[Android] Enable iomx direct rendering if "full acceleration" is chosen

Martin Storsjö git at videolan.org
Fri Jul 25 11:36:43 CEST 2014


vlc-ports/android | branch: master | Martin Storsjö <martin at martin.st> | Fri Jul 18 00:34:42 2014 +0300| [ae06cb91a04b1a5bf226c7f3504b84747521ef4a] | committer: Martin Storsjö

Enable iomx direct rendering if "full acceleration" is chosen

The "auto" option doesn't enable any acceleration at all until
4.3, so this is quite safe - only people who intentionally enable
it will get it. (And for older vlc.git versions, such as the
vlc-2.2 branch, it won't have any effect.)

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=ae06cb91a04b1a5bf226c7f3504b84747521ef4a
---

 vlc-android/jni/Android.mk  |    3 +++
 vlc-android/jni/libvlcjni.c |    7 +++++++
 2 files changed, 10 insertions(+)

diff --git a/vlc-android/jni/Android.mk b/vlc-android/jni/Android.mk
index a914c5a..090eb5d 100644
--- a/vlc-android/jni/Android.mk
+++ b/vlc-android/jni/Android.mk
@@ -54,6 +54,9 @@ endif
 ifeq ($(ARCH), armeabi-v7a)
 	LOCAL_CFLAGS += -DHAVE_ARMEABI_V7A
 endif
+ifneq (,$(wildcard $(LOCAL_PATH)/../$(VLC_SRC_DIR)/modules/codec/omxil/iomx_hwbuffer.c))
+	LOCAL_CFLAGS += -DHAVE_IOMX_DR
+endif
 LOCAL_LDLIBS := -L$(VLC_CONTRIB)/lib \
 	$(VLC_MODULES) \
 	$(VLC_BUILD_DIR)/lib/.libs/libvlc.a \
diff --git a/vlc-android/jni/libvlcjni.c b/vlc-android/jni/libvlcjni.c
index 9781d76..97ad7e2 100644
--- a/vlc-android/jni/libvlcjni.c
+++ b/vlc-android/jni/libvlcjni.c
@@ -50,6 +50,12 @@
 #define LOG_TAG "VLC/JNI/main"
 #include "log.h"
 
+#ifdef HAVE_IOMX_DR
+#define NO_IOMX_DR "--no-omxil-dr"
+#else
+#define NO_IOMX_DR ""
+#endif
+
 libvlc_media_t *new_media(jlong instance, JNIEnv *env, jobject thiz, jstring fileLocation, bool noOmx, bool noVideo)
 {
     libvlc_instance_t *libvlc = (libvlc_instance_t*)(intptr_t)instance;
@@ -293,6 +299,7 @@ void Java_org_videolan_libvlc_LibVLC_nativeInit(JNIEnv *env, jobject thiz)
         "--androidsurface-chroma", chromastr != NULL && chromastr[0] != 0 ? chromastr : "RV32",
         /* XXX: we can't recover from direct rendering failure */
         (hardwareAcceleration == HW_ACCELERATION_FULL) ? "" : "--no-mediacodec-dr",
+        (hardwareAcceleration == HW_ACCELERATION_FULL) ? "" : NO_IOMX_DR,
     };
     libvlc_instance_t *instance = libvlc_new(sizeof(argv) / sizeof(*argv), argv);
 



More information about the Android mailing list