[libbluray-devel] Added BD_PSR_WRITE event

hpi1 git at videolan.org
Sat Jul 2 09:51:17 CEST 2011


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Thu Jun 30 15:24:27 2011 +0300| [9738c08d0c34692d751c8c6071930c8e70c588de] | committer: hpi1

Added BD_PSR_WRITE event

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

 src/libbluray/register.c |   11 ++++-------
 src/libbluray/register.h |    7 ++++---
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/src/libbluray/register.c b/src/libbluray/register.c
index d5cb04d..7621866 100644
--- a/src/libbluray/register.c
+++ b/src/libbluray/register.c
@@ -383,14 +383,11 @@ int bd_psr_setting_write(BD_REGISTERS *p, int reg, uint32_t val)
         return -1;
     }
 
-    if (p->psr[reg] == val) {
-        BD_DEBUG(DBG_BLURAY, "bd_psr_write(%d, %d): no change in value\n", reg, val);
-        return 0;
-    }
-
     bd_psr_lock(p);
 
-    if (bd_psr_name[reg]) {
+    if (p->psr[reg] == val) {
+        BD_DEBUG(DBG_BLURAY, "bd_psr_write(%d, %d): no change in value\n", reg, val);
+    } else if (bd_psr_name[reg]) {
         BD_DEBUG(DBG_BLURAY, "bd_psr_write(): PSR%-4d (%s) 0x%x -> 0x%x\n", reg, bd_psr_name[reg], p->psr[reg], val);
     } else {
         BD_DEBUG(DBG_BLURAY, "bd_psr_write(): PSR%-4d 0x%x -> 0x%x\n", reg, p->psr[reg], val);
@@ -400,7 +397,7 @@ int bd_psr_setting_write(BD_REGISTERS *p, int reg, uint32_t val)
         BD_PSR_EVENT ev;
         unsigned i;
 
-        ev.ev_type = BD_PSR_CHANGE;
+        ev.ev_type = p->psr[reg] == val ? BD_PSR_WRITE : BD_PSR_CHANGE;
         ev.psr_idx = reg;
         ev.old_val = p->psr[reg];
         ev.new_val = val;
diff --git a/src/libbluray/register.h b/src/libbluray/register.h
index 97cb862..6e6643d 100644
--- a/src/libbluray/register.h
+++ b/src/libbluray/register.h
@@ -205,9 +205,10 @@ 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 */
+#define BD_PSR_SAVE    1 /* backup player state. Single event, psr_idx and values undefined */
+#define BD_PSR_WRITE   2 /* write, value unchanged */
+#define BD_PSR_CHANGE  3 /* write, value changed */
+#define BD_PSR_RESTORE 4 /* restore backup values */
 
 /* event data */
 typedef struct {



More information about the libbluray-devel mailing list