[Android] [PATCH 4/4] Enable iomx direct rendering if "full acceleration" is chosen
Martin Storsjö
martin at martin.st
Fri Jul 25 00:38:56 CEST 2014
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.)
---
vlc-android/jni/Android.mk | 3 +++
vlc-android/jni/libvlcjni.c | 8 +++++++-
2 files changed, 10 insertions(+), 1 deletion(-)
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..27fc47d 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 IOMX_DR "--omxil-dr"
+#else
+#define 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;
@@ -292,7 +298,7 @@ void Java_org_videolan_libvlc_LibVLC_nativeInit(JNIEnv *env, jobject thiz)
use_opengles2 ? "--vout=gles2" : "--vout=androidsurface",
"--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) ? IOMX_DR : "--no-mediacodec-dr",
};
libvlc_instance_t *instance = libvlc_new(sizeof(argv) / sizeof(*argv), argv);
--
1.8.5.2 (Apple Git-48)
More information about the Android
mailing list