[libbluray-devel] Added extended AACS error codes

npzacs git at videolan.org
Wed Apr 25 11:55:41 CEST 2012


libbluray | branch: master | npzacs <npzacs at gmail.com> | Wed Apr 25 12:43:32 2012 +0300| [7ef5a2204a83ece4c61cdf0069ed4dac8b5af7af] | committer: npzacs

Added extended AACS error codes

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

 ChangeLog              |    2 ++
 configure.ac           |    8 ++++----
 src/libbluray/bluray.c |   32 +++++++++++++++++++++++++++++++-
 src/libbluray/bluray.h |   11 +++++++++++
 4 files changed, 48 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 344d68c..8dc8ccf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,5 @@
+ - Added extended AACS error codes
+
 2012-03-19: Version 0.2.2
  - Fixed displaying of single-loop animated buttons when not using animations
  - Added events for pop-up menu availability and IG menu status
diff --git a/configure.ac b/configure.ac
index af31129..9c15ceb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
 # library version number
 m4_define([bluray_major], 0)
 m4_define([bluray_minor], 2)
-m4_define([bluray_micro], 2)
+m4_define([bluray_micro], 3)
 m4_define([bluray_version],[bluray_major.bluray_minor.bluray_micro])
 
 # shared library version (.so version)
@@ -12,9 +12,9 @@ m4_define([bluray_version],[bluray_major.bluray_minor.bluray_micro])
 #
 # Library file name will be libbluray.so.(current-age).age.revision
 #
-m4_define([lt_current],  2)
-m4_define([lt_revision], 0)
-m4_define([lt_age],      1)
+m4_define([lt_current],  3)
+m4_define([lt_revision], 1)
+m4_define([lt_age],      0)
 
 # initilization
 AC_INIT([libbluray], bluray_version, [http://www.videolan.org/developers/libbluray.html])
diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index 90fedfd..ecaee79 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -701,7 +701,14 @@ static int _libaacs_open(BLURAY *bd, const char *keyfile_path)
         return 0;
     }
 
-    bd->aacs = bd->libaacs_open(bd->device_path, keyfile_path);
+    int error_code = 0;
+    fptr_p_void aacs_open2 = (fptr_p_void)dl_dlsym(bd->h_libaacs, "aacs_open2");
+    if (!aacs_open2) {
+        BD_DEBUG(DBG_BLURAY, "Using old aacs_open(), no verbose error reporting available (%p)\n", bd->aacs);
+        bd->aacs = bd->libaacs_open(bd->device_path, keyfile_path);
+    } else {
+        bd->aacs = aacs_open2(bd->device_path, keyfile_path, &error_code);
+    }
 
     if (bd->aacs) {
         BD_DEBUG(DBG_BLURAY, "Opened libaacs (%p)\n", bd->aacs);
@@ -712,6 +719,29 @@ static int _libaacs_open(BLURAY *bd, const char *keyfile_path)
     BD_DEBUG(DBG_BLURAY, "aacs_open() failed!\n");
     bd->disc_info.aacs_handled = 0;
 
+    switch (error_code) {
+        case 0: /* AACS_SUCCESS */
+            break;
+        case -1: /* AACS_ERROR_CORRUPTED_DISC */
+            bd->disc_info.aacs_error_code = BD_AACS_CORRUPTED_DISC;
+            break;
+        case -2: /* AACS_ERROR_NO_CONFIG */
+            bd->disc_info.aacs_error_code = BD_AACS_NO_CONFIG;
+            break;
+        case -3: /* AACS_ERROR_NO_PK */
+            bd->disc_info.aacs_error_code = BD_AACS_NO_PK;
+            break;
+        case -4: /* AACS_ERROR_NO_CERT */
+            bd->disc_info.aacs_error_code = BD_AACS_NO_CERT;
+            break;
+        case -5: /* AACS_ERROR_CERT_REVOKED */
+            bd->disc_info.aacs_error_code = BD_AACS_CERT_REVOKED;
+            break;
+        case -6: /* AACS_ERROR_MMC_OPEN */
+            bd->disc_info.aacs_error_code = BD_AACS_MMC_FAILED;
+            break;
+    }
+
     _libaacs_unload(bd);
     return 0;
 }
diff --git a/src/libbluray/bluray.h b/src/libbluray/bluray.h
index 88abdc7..067e061 100644
--- a/src/libbluray/bluray.h
+++ b/src/libbluray/bluray.h
@@ -407,6 +407,14 @@ uint64_t bd_tell_time(BLURAY *bd);
  * Disc info
  */
 
+/* AACS error codes */
+#define BD_AACS_CORRUPTED_DISC  -1
+#define BD_AACS_NO_CONFIG       -2
+#define BD_AACS_NO_PK           -3
+#define BD_AACS_NO_CERT         -4
+#define BD_AACS_CERT_REVOKED    -5
+#define BD_AACS_MMC_FAILED      -6
+
 typedef struct {
     uint8_t  bluray_detected;
 
@@ -425,6 +433,9 @@ typedef struct {
     uint8_t  libbdplus_detected;
     uint8_t  bdplus_handled;
 
+    /* aacs error code */
+    int      aacs_error_code;
+
 } BLURAY_DISC_INFO;
 
 /**



More information about the libbluray-devel mailing list