[libbluray-devel] [PATCH] Add possibility to to check whether BD-J is functional without actually opening a disc.

Andreas Zelend ace at kodi.tv
Sat May 27 22:06:34 CEST 2017


From: ace20022 <ace20022 at ymail.com>

---
 src/libbluray/bluray.c | 57 ++++++++++++++++++++++++++------------------------
 1 file changed, 30 insertions(+), 27 deletions(-)

diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index 5119cab5..c1d496a9 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -904,20 +904,22 @@ const BLURAY_DISC_INFO *bd_get_disc_info(BLURAY *bd)
 
 static void _fill_disc_info(BLURAY *bd, BD_ENC_INFO *enc_info)
 {
-    bd->disc_info.aacs_detected      = enc_info->aacs_detected;
-    bd->disc_info.libaacs_detected   = enc_info->libaacs_detected;
-    bd->disc_info.aacs_error_code    = enc_info->aacs_error_code;
-    bd->disc_info.aacs_handled       = enc_info->aacs_handled;
-    bd->disc_info.aacs_mkbv          = enc_info->aacs_mkbv;
-    memcpy(bd->disc_info.disc_id, enc_info->disc_id, 20);
-    bd->disc_info.bdplus_detected    = enc_info->bdplus_detected;
-    bd->disc_info.libbdplus_detected = enc_info->libbdplus_detected;
-    bd->disc_info.bdplus_handled     = enc_info->bdplus_handled;
-    bd->disc_info.bdplus_gen         = enc_info->bdplus_gen;
-    bd->disc_info.bdplus_date        = enc_info->bdplus_date;
-    bd->disc_info.no_menu_support    = enc_info->no_menu_support;
-
-    bd->disc_info.udf_volume_id      = disc_volume_id(bd->disc);
+    if (enc_info)
+    {
+      bd->disc_info.aacs_detected      = enc_info->aacs_detected;
+      bd->disc_info.libaacs_detected   = enc_info->libaacs_detected;
+      bd->disc_info.aacs_error_code    = enc_info->aacs_error_code;
+      bd->disc_info.aacs_handled       = enc_info->aacs_handled;
+      bd->disc_info.aacs_mkbv          = enc_info->aacs_mkbv;
+      memcpy(bd->disc_info.disc_id, enc_info->disc_id, 20);
+      bd->disc_info.bdplus_detected    = enc_info->bdplus_detected;
+      bd->disc_info.libbdplus_detected = enc_info->libbdplus_detected;
+      bd->disc_info.bdplus_handled     = enc_info->bdplus_handled;
+      bd->disc_info.bdplus_gen         = enc_info->bdplus_gen;
+      bd->disc_info.bdplus_date        = enc_info->bdplus_date;
+      bd->disc_info.no_menu_support    = enc_info->no_menu_support;
+    }
+
 
     bd->disc_info.bluray_detected        = 0;
     bd->disc_info.top_menu_supported     = 0;
@@ -928,8 +930,14 @@ static void _fill_disc_info(BLURAY *bd, BD_ENC_INFO *enc_info)
 
     bd->disc_info.bdj_detected    = 0;
     bd->disc_info.bdj_supported   = 1;
-    bd->disc_info.libjvm_detected = 0;
-    bd->disc_info.bdj_handled     = 0;
+
+
+    /* Check if jvm + jar can be loaded ? */
+    switch (bdj_jvm_available(&bd->bdjstorage)) {
+    case 2: bd->disc_info.bdj_handled = 1;
+    case 1: bd->disc_info.libjvm_detected = 1;
+    default:;
+    }
 
     bd->disc_info.num_titles  = 0;
     bd->disc_info.titles      = NULL;
@@ -941,6 +949,11 @@ static void _fill_disc_info(BLURAY *bd, BD_ENC_INFO *enc_info)
     memset(bd->disc_info.bdj_org_id,  0, sizeof(bd->disc_info.bdj_org_id));
     memset(bd->disc_info.bdj_disc_id, 0, sizeof(bd->disc_info.bdj_disc_id));
 
+    if (!bd->disc)
+      return;
+
+    bd->disc_info.udf_volume_id = disc_volume_id(bd->disc);
+
     INDX_ROOT *index = indx_get(bd->disc);
     if (index) {
         INDX_PLAY_ITEM *pi;
@@ -1010,16 +1023,6 @@ static void _fill_disc_info(BLURAY *bd, BD_ENC_INFO *enc_info)
             titles[0]->id_ref = pi->hdmv.id_ref;
         }
 
-        /* check for BD-J capability */
-        if (bd->disc_info.bdj_detected) {
-            /* BD-J titles found. Check if jvm + jar can be loaded ? */
-            switch (bdj_jvm_available(&bd->bdjstorage)) {
-                case 2: bd->disc_info.bdj_handled     = 1;
-                case 1: bd->disc_info.libjvm_detected = 1;
-                default:;
-            }
-        }
-
         /* mark supported titles */
 
         if (bd->disc_info.bdj_detected && !bd->disc_info.bdj_handled) {
@@ -1387,7 +1390,7 @@ BLURAY *bd_init(void)
         int v = (!strcmp(env, "yes")) ? 1 : (!strcmp(env, "no")) ? 0 : atoi(env);
         bd->bdjstorage.no_persistent_storage = !v;
     }
-
+    _fill_disc_info(bd, NULL);
     BD_DEBUG(DBG_BLURAY, "BLURAY initialized!\n");
 
     return bd;
-- 
2.12.0.windows.1



More information about the libbluray-devel mailing list