[Android] libvlcjni: set libdvdcss cache path

Felix Abecassis git at videolan.org
Fri Jul 4 17:07:01 CEST 2014


vlc-ports/android | branch: master | Felix Abecassis <felix.abecassis at gmail.com> | Fri Jul  4 11:59:37 2014 +0200| [5c5496c4d5618ec835ffad4a99116db896bc3e29] | committer: Felix Abecassis

libvlcjni: set libdvdcss cache path

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

 vlc-android/jni/libvlcjni.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/vlc-android/jni/libvlcjni.c b/vlc-android/jni/libvlcjni.c
index 5a8464a..0f787be 100644
--- a/vlc-android/jni/libvlcjni.c
+++ b/vlc-android/jni/libvlcjni.c
@@ -260,6 +260,11 @@ void Java_org_videolan_libvlc_LibVLC_nativeInit(JNIEnv *env, jobject thiz)
     if (hardwareAcceleration == HW_ACCELERATION_FULL)
         use_opengles2 = false;
 
+    methodId = (*env)->GetMethodID(env, cls, "getCachePath", "()Ljava/lang/String;");
+    jstring cachePath = (*env)->CallObjectMethod(env, thiz, methodId);
+    const char *cache_path = (*env)->GetStringUTFChars(env, cachePath, 0);
+    setenv("DVDCSS_CACHE", cache_path, 1);
+
     /* Don't add any invalid options, otherwise it causes LibVLC to crash */
     const char *argv[] = {
         /* CPU intensive plugin, setting for slow devices */
@@ -292,6 +297,7 @@ void Java_org_videolan_libvlc_LibVLC_nativeInit(JNIEnv *env, jobject thiz)
 
     (*env)->ReleaseStringUTFChars(env, chroma, chromastr);
     (*env)->ReleaseStringUTFChars(env, subsencoding, subsencodingstr);
+    (*env)->ReleaseStringUTFChars(env, cachePath, cache_path);
 
     if (!instance)
     {



More information about the Android mailing list