[libbluray-devel] disc: signal libmmbd usage to upper layers

npzacs git at videolan.org
Fri Sep 15 11:38:25 CEST 2017


libbluray | branch: master | npzacs <npzacs at gmail.com> | Fri Sep 15 12:24:45 2017 +0300| [78e36bc45829c19c509e9796aa7c5c32eb70ebbf] | committer: npzacs

disc: signal libmmbd usage to upper layers

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

 src/libbluray/bdj/native/org_videolan_Libbluray.c |  3 +++
 src/libbluray/disc/bdplus.c                       | 12 ++++++++++++
 src/libbluray/disc/bdplus.h                       |  3 +++
 src/libbluray/disc/dec.c                          | 17 +++++++++++++----
 4 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/src/libbluray/bdj/native/org_videolan_Libbluray.c b/src/libbluray/bdj/native/org_videolan_Libbluray.c
index 5623134c..a16cde34 100644
--- a/src/libbluray/bdj/native/org_videolan_Libbluray.c
+++ b/src/libbluray/bdj/native/org_videolan_Libbluray.c
@@ -235,6 +235,9 @@ JNIEXPORT jbyteArray JNICALL Java_org_videolan_Libbluray_getAacsDataN
     if (type == 8/*BD_AACS_BDJ_ROOT_CERT_HASH*/) {
         data_size = 20;
     }
+    if (type == 0x1000/*BD_BDPLUS_TYPE*/) {
+        data_size = strlen((const char*)data);
+    }
 
     jbyteArray array = (*env)->NewByteArray(env, data_size);
     (*env)->SetByteArrayRegion(env, array, 0, data_size, (const jbyte *)data);
diff --git a/src/libbluray/disc/bdplus.c b/src/libbluray/disc/bdplus.c
index 8afe9804..80048507 100644
--- a/src/libbluray/disc/bdplus.c
+++ b/src/libbluray/disc/bdplus.c
@@ -258,6 +258,18 @@ int libbdplus_get_date(BD_BDPLUS *p)
     return _bdplus_get(p, "bdplus_get_code_date");
 }
 
+const uint8_t *libbdplus_get_data(BD_BDPLUS *p, int type)
+{
+    switch (type) {
+        case BD_BDPLUS_TYPE:
+            if (libbdplus_is_mmbd(p->bdplus)) {
+                return (const uint8_t *)"mmbd";
+            }
+    }
+
+    return NULL;
+}
+
 void libbdplus_event(BD_BDPLUS *p, uint32_t event, uint32_t param1, uint32_t param2)
 {
     if (p && p->bdplus && p->event) {
diff --git a/src/libbluray/disc/bdplus.h b/src/libbluray/disc/bdplus.h
index 88e940c0..660a27fd 100644
--- a/src/libbluray/disc/bdplus.h
+++ b/src/libbluray/disc/bdplus.h
@@ -43,6 +43,9 @@ BD_PRIVATE void libbdplus_psr(BD_BDPLUS *p, void *regs, void *read, void *write)
 BD_PRIVATE void libbdplus_start(BD_BDPLUS *p);
 BD_PRIVATE void libbdplus_event(BD_BDPLUS *p, uint32_t event, uint32_t param1, uint32_t param2);
 
+#define BD_BDPLUS_TYPE 0x1000
+BD_PRIVATE const uint8_t *libbdplus_get_data(BD_BDPLUS *p, int type);
+
 /*
  *  stream layer
  */
diff --git a/src/libbluray/disc/dec.c b/src/libbluray/disc/dec.c
index 9df21548..1db158e4 100644
--- a/src/libbluray/disc/dec.c
+++ b/src/libbluray/disc/dec.c
@@ -243,7 +243,7 @@ static int _libbdplus_init(BD_DEC *dec, struct dec_dev *dev,
     if (i->bdplus_date == 0) {
         // libmmbd -> no menu support
         BD_DEBUG(DBG_BLURAY | DBG_CRIT, "WARNING: using libmmbd for BD+. On-disc menus will not work.\n");
-        i->no_menu_support = 1;
+        //i->no_menu_support = 1;
     }
 
     return 1;
@@ -339,10 +339,19 @@ void dec_close(BD_DEC **pp)
 
 const uint8_t *dec_data(BD_DEC *dec, int type)
 {
-    if (dec->aacs) {
-        return libaacs_get_aacs_data(dec->aacs, type);
+    const uint8_t *ret = NULL;
+
+    if (type >= 0x1000) {
+        if (dec->bdplus) {
+            ret = libbdplus_get_data(dec->bdplus, type);
+        }
+    } else {
+        if (dec->aacs) {
+            ret = libaacs_get_aacs_data(dec->aacs, type);
+        }
     }
-    return NULL;
+
+    return ret;
 }
 
 const uint8_t *dec_disc_id(BD_DEC *dec)



More information about the libbluray-devel mailing list