[libbluray-devel] Added PSR_SAVE event

hpi1 git at videolan.org
Tue Jun 21 01:39:59 CEST 2011


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Wed Jun 15 13:24:47 2011 +0300| [0b1e9c9efe3fba14fd481a81c850b2db2501cf9e] | committer: hpi1

Added PSR_SAVE event

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

 src/libbluray/bluray.c   |    5 +++++
 src/libbluray/register.c |   16 ++++++++++++++++
 src/libbluray/register.h |    1 +
 3 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index 6cf7410..7673072 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -1699,6 +1699,11 @@ static void _process_psr_event(void *handle, BD_PSR_EVENT *ev)
 {
     BLURAY *bd = (BLURAY*)handle;
 
+    if (ev->ev_type == BD_PSR_SAVE) {
+        BD_DEBUG(DBG_BLURAY, "PSR SAVE event (%p)\n", bd);
+        return;
+    }
+
     /* PSR restore events are handled internally */
 
     if (ev->ev_type == BD_PSR_RESTORE) {
diff --git a/src/libbluray/register.c b/src/libbluray/register.c
index aec8e89..d5cb04d 100644
--- a/src/libbluray/register.c
+++ b/src/libbluray/register.c
@@ -252,6 +252,22 @@ void bd_psr_save_state(BD_REGISTERS *p)
     memcpy(p->psr + 36, p->psr + 4,  sizeof(uint32_t) * 5);
     memcpy(p->psr + 42, p->psr + 10, sizeof(uint32_t) * 3);
 
+    /* generate save event */
+
+    if (p->num_cb) {
+        BD_PSR_EVENT ev = {
+            .ev_type = BD_PSR_SAVE,
+            .psr_idx = -1,
+            .old_val = 0,
+            .new_val = 0,
+        };
+
+        unsigned j;
+        for (j = 0; j < p->num_cb; j++) {
+            p->cb[j].cb(p->cb[j].handle, &ev);
+        }
+    }
+
     bd_psr_unlock(p);
 }
 
diff --git a/src/libbluray/register.h b/src/libbluray/register.h
index 6259907..97cb862 100644
--- a/src/libbluray/register.h
+++ b/src/libbluray/register.h
@@ -207,6 +207,7 @@ void bd_psr_reset_backup_registers(BD_REGISTERS *);
 /* event types */
 #define BD_PSR_CHANGE  1
 #define BD_PSR_RESTORE 2
+#define BD_PSR_SAVE    3 /* single event, psr_idx and values undefined */
 
 /* event data */
 typedef struct {



More information about the libbluray-devel mailing list