[libbluray-devel] Emit BD_EVENT_ENCRYPTED when decryption fails

hpi1 git at videolan.org
Sun Dec 15 18:16:42 CET 2013


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Sun Dec 15 19:13:45 2013 +0200| [50b1bd8105894fb747c6fd7398c7a57e4449a18b] | committer: hpi1

Emit BD_EVENT_ENCRYPTED when decryption fails

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

 src/libbluray/bluray.c |    6 ++++--
 src/libbluray/bluray.h |    4 ++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index 36ed2e2..3848e67 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -592,9 +592,11 @@ static int _read_block(BLURAY *bd, BD_STREAM *st, uint8_t *buf)
                     BD_DEBUG(DBG_STREAM | DBG_CRIT, "Read %d bytes at %"PRIu64" ; requested %d !\n", (int)read_len, st->clip_block_pos, (int)len);
                 }
                 if (bd->libaacs && libaacs_decrypt_unit(bd->libaacs, buf)) {
+                    _queue_event(bd, BD_EVENT_ENCRYPTED, BD_ERROR_AACS);
                     return -1;
                 }
-                if (st->bdplus && libbdplus_fixup(st->bdplus, buf, len)) {
+                if (st->bdplus && (libbdplus_fixup(st->bdplus, buf, len) < 0)) {
+                    _queue_event(bd, BD_EVENT_ENCRYPTED, BD_ERROR_BDPLUS);
                 }
 
                 st->clip_block_pos += len;
@@ -605,7 +607,7 @@ static int _read_block(BLURAY *bd, BD_STREAM *st, uint8_t *buf)
                     if (buf[4] != 0x47 || buf[4+192] != 0x47 || buf[4+2*192] != 0x47) {
                         BD_DEBUG(DBG_BLURAY | DBG_CRIT,
                                  "TP header copy permission indicator != 0, unit is still encrypted?\n");
-                        _queue_event(bd, BD_EVENT_ENCRYPTED, 0);
+                        _queue_event(bd, BD_EVENT_ENCRYPTED, BD_ERROR_AACS);
                         return -1;
                     }
                 }
diff --git a/src/libbluray/bluray.h b/src/libbluray/bluray.h
index 485fdad..10c8a09 100644
--- a/src/libbluray/bluray.h
+++ b/src/libbluray/bluray.h
@@ -651,6 +651,10 @@ typedef struct {
 #define BD_ERROR_HDMV    1
 #define BD_ERROR_BDJ     2
 
+/* BD_EVENT_ENCRYPTED param vlues */
+#define BD_ERROR_AACS    3
+#define BD_ERROR_BDPLUS  4
+
 
 #define BLURAY_TITLE_FIRST_PLAY  0xffff
 #define BLURAY_TITLE_TOP_MENU    0



More information about the libbluray-devel mailing list