[libbluray-devel] bdj: give disc root path to Libbluray.init() instead of setting it as JVM parameter

hpi1 git at videolan.org
Wed Feb 26 10:13:54 CET 2014


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Wed Feb 26 11:11:32 2014 +0200| [b8a378faee686e5d8cbbec08c2125eb4c6e00516] | committer: hpi1

bdj: give disc root path to Libbluray.init() instead of setting it as JVM parameter

Fixes two issues:
- when disc is changed, disc root may need to be changed too
- charset conversion issues in Windows

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=b8a378faee686e5d8cbbec08c2125eb4c6e00516
---

 src/libbluray/bdj/bdj.c                            |    7 ++++---
 src/libbluray/bdj/java/org/videolan/Libbluray.java |    4 +++-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/libbluray/bdj/bdj.c b/src/libbluray/bdj/bdj.c
index 83b6790..11e9d0c 100644
--- a/src/libbluray/bdj/bdj.c
+++ b/src/libbluray/bdj/bdj.c
@@ -307,7 +307,7 @@ static int _bdj_init(BDJAVA *bdjava, JNIEnv *env)
     jclass init_class;
     jmethodID init_id;
     if (!bdj_get_method(env, &init_class, &init_id,
-                        "org/videolan/Libbluray", "init", "(JLjava/lang/String;)V")) {
+                        "org/videolan/Libbluray", "init", "(JLjava/lang/String;Ljava/lang/String;)V")) {
         return 0;
     }
 
@@ -316,8 +316,9 @@ static int _bdj_init(BDJAVA *bdjava, JNIEnv *env)
     jlong param_bdjava_ptr = (jlong)(intptr_t) bdjava;
     jstring param_disc_id = (*env)->NewStringUTF(env,
                                                  id ? id->disc_id : "00000000000000000000000000000000");
+    jstring param_disc_root = (*env)->NewStringUTF(env, bdjava->path);
     (*env)->CallStaticVoidMethod(env, init_class, init_id,
-                                 param_bdjava_ptr, param_disc_id);
+                                 param_bdjava_ptr, param_disc_id, param_disc_root);
 
     if ((*env)->ExceptionOccurred(env)) {
         (*env)->ExceptionDescribe(env);
@@ -326,6 +327,7 @@ static int _bdj_init(BDJAVA *bdjava, JNIEnv *env)
 
     (*env)->DeleteLocalRef(env, init_class);
     (*env)->DeleteLocalRef(env, param_disc_id);
+    (*env)->DeleteLocalRef(env, param_disc_root);
 
     X_FREE(id_path);
     bdid_free(&id);
@@ -389,7 +391,6 @@ BDJAVA* bdj_open(const char *path, struct bluray *bd,
     JavaVMOption* option = calloc(1, sizeof(JavaVMOption) * 20);
     int n = 0;
     JavaVMInitArgs args;
-    option[n++].optionString = str_printf("-Dbluray.vfs.root=%s", path);
     option[n++].optionString = str_printf("-Ddvb.persistent.root=%s", _bdj_persistent_root());
     option[n++].optionString = str_printf("-Dbluray.bindingunit.root=%s", _bdj_buda_root());
 
diff --git a/src/libbluray/bdj/java/org/videolan/Libbluray.java b/src/libbluray/bdj/java/org/videolan/Libbluray.java
index 48e9bc9..18d4aab 100644
--- a/src/libbluray/bdj/java/org/videolan/Libbluray.java
+++ b/src/libbluray/bdj/java/org/videolan/Libbluray.java
@@ -39,7 +39,9 @@ import org.videolan.media.content.PlayerManager;
  * This class allows BDJ to call various libbluray functions.
  */
 public class Libbluray {
-        protected static void init(long nativePointer, String discID) {
+    protected static void init(long nativePointer, String discID, String discRoot) {
+
+        System.setProperty("bluray.vfs.root", discRoot);
 
             Libbluray.nativePointer = nativePointer;
             DiscManager.getDiscManager().setCurrentDisc(discID);



More information about the libbluray-devel mailing list