[libbluray-devel] Added bdplus content code version information to disc info.

anonymous git at videolan.org
Sun Dec 15 09:49:47 CET 2013


libbluray | branch: master | anonymous <anonymous at anonymous.org> | Sun Dec 15 10:46:59 2013 +0200| [8bdc92437a919c191e61955acf77f9a5af43be64] | committer: anonymous

Added bdplus content code version information to disc info.

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

 src/examples/bd_info.c |   11 ++++++++++-
 src/file/libbdplus.c   |   22 ++++++++++++++++++++++
 src/file/libbdplus.h   |    3 +++
 src/libbluray/bluray.c |    2 ++
 src/libbluray/bluray.h |    5 +++++
 5 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/src/examples/bd_info.c b/src/examples/bd_info.c
index 028960a..fbf8f31 100644
--- a/src/examples/bd_info.c
+++ b/src/examples/bd_info.c
@@ -180,7 +180,16 @@ int main(int argc, char *argv[])
     printf("\nBD+ detected        : %s\n", _yes_no(info->bdplus_detected));
     if (info->bdplus_detected) {
         printf("libbdplus detected  : %s\n", _yes_no(info->libbdplus_detected));
-        printf("BD+ handled         : %s\n", _yes_no(info->bdplus_handled));
+        if (info->libbdplus_detected) {
+            if (info->bdplus_gen) {
+                printf("BD+ generation      : %d\n", info->bdplus_gen);
+            }
+            if (info->bdplus_date) {
+                printf("BD+ release date    : %d-%02d-%02d\n",
+                       info->bdplus_date >> 16, (info->bdplus_date >> 8) & 0xff, info->bdplus_date & 0xff );
+            }
+            printf("BD+ handled         : %s\n", _yes_no(info->bdplus_handled));
+        }
     }
 
     _print_meta(bd_get_meta(bd));
diff --git a/src/file/libbdplus.c b/src/file/libbdplus.c
index 1cc7c69..dab219f 100644
--- a/src/file/libbdplus.c
+++ b/src/file/libbdplus.c
@@ -174,6 +174,28 @@ int libbdplus_init(BD_BDPLUS *p, const char *device_path, const uint8_t *vid)
     return 0;
 }
 
+static uint32_t _bdplus_get(BD_BDPLUS *p, const char *func)
+{
+    if (p && p->bdplus) {
+        fptr_int32 fp;
+        *(void **)(&fp) = dl_dlsym(p->h_libbdplus, func);
+        if (fp) {
+            return fp(p->bdplus);
+        }
+    }
+    return 0;
+}
+
+int libbdplus_get_gen(BD_BDPLUS *p)
+{
+    return _bdplus_get(p, "bdplus_get_code_gen");
+}
+
+int libbdplus_get_date(BD_BDPLUS *p)
+{
+    return _bdplus_get(p, "bdplus_get_code_date");
+}
+
 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/file/libbdplus.h b/src/file/libbdplus.h
index ba5c6d8..e8fe8e6 100644
--- a/src/file/libbdplus.h
+++ b/src/file/libbdplus.h
@@ -32,6 +32,9 @@ BD_PRIVATE BD_BDPLUS *libbdplus_load(void);
 BD_PRIVATE int  libbdplus_init(BD_BDPLUS *p, const char *device_path, const uint8_t *vid);
 BD_PRIVATE void libbdplus_unload(BD_BDPLUS **p);
 
+BD_PRIVATE int  libbdplus_get_gen(BD_BDPLUS *p);
+BD_PRIVATE int  libbdplus_get_date(BD_BDPLUS *p);
+
 BD_PRIVATE void libbdplus_mmap(BD_BDPLUS *p, uint32_t region_id, void *mem);
 BD_PRIVATE void libbdplus_psr(BD_BDPLUS *p, void *regs, void *read, void *write);
 BD_PRIVATE void libbdplus_start(BD_BDPLUS *p);
diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index db90a34..b09b7aa 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -885,6 +885,8 @@ static int _libbdplus_init(BLURAY *bd)
     /* connect registers */
     libbdplus_psr(bd->libbdplus, (void*)bd->regs, (void*)bd_psr_read, (void*)bd_psr_write);
 
+    bd->disc_info.bdplus_gen     = libbdplus_get_gen(bd->libbdplus);
+    bd->disc_info.bdplus_date    = libbdplus_get_date(bd->libbdplus);
     bd->disc_info.bdplus_handled = 1;
     return 1;
 }
diff --git a/src/libbluray/bluray.h b/src/libbluray/bluray.h
index 90ca186..5b3760a 100644
--- a/src/libbluray/bluray.h
+++ b/src/libbluray/bluray.h
@@ -500,6 +500,11 @@ typedef struct {
     uint8_t  bdj_supported;    /* 1 if BD-J support was compiled in */
     uint8_t  libjvm_detected;  /* 1 if usable Java VM was found */
     uint8_t  bdj_handled;      /* 1 if usable Java VM + libbluray.jar was found */
+
+    /* BD+ content code generation */
+    uint8_t  bdplus_gen;
+    /* BD+ content code relese date */
+    uint32_t bdplus_date;      /* (year << 16) | (month << 8) | day */
 } BLURAY_DISC_INFO;
 
 /**



More information about the libbluray-devel mailing list