[libbluray-devel] commit: Generate events for PSR initial values (hpi1 )

git at videolan.org git at videolan.org
Wed Dec 8 18:58:17 CET 2010


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Tue Dec  7 15:52:20 2010 +0200| [d7f4b6cf5ab16a584bab3097e4f0c84f6c2fb537] | committer: hpi1 

Generate events for PSR initial values

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

 src/libbluray/bluray.c |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index 1cf866a..db5c3e3 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -1581,6 +1581,33 @@ static void _process_psr_event(void *handle, BD_PSR_EVENT *ev)
     }
 }
 
+static void _queue_initial_psr_events(BLURAY *bd)
+{
+    const uint32_t psrs[] = {
+        PSR_ANGLE_NUMBER,
+        PSR_TITLE_NUMBER,
+        PSR_CHAPTER,
+        PSR_PLAYLIST,
+        PSR_PLAYITEM,
+        PSR_IG_STREAM_ID,
+        PSR_PRIMARY_AUDIO_ID,
+        PSR_PG_STREAM,
+        PSR_SECONDARY_AUDIO_VIDEO,
+    };
+    unsigned ii;
+
+    for (ii = 0; ii < sizeof(psrs) / sizeof(psrs[0]); ii++) {
+        BD_PSR_EVENT ev = {
+            .ev_type = 0,
+            .psr_idx = psrs[ii],
+            .old_val = 0,
+            .new_val = bd_psr_read(bd->regs, psrs[ii]),
+        };
+
+        _process_psr_event(bd, &ev);
+    }
+}
+
 static int _play_bdj(BLURAY *bd, const char *name)
 {
     bd->title_type = title_bdj;
@@ -1699,6 +1726,7 @@ int bd_play(BLURAY *bd)
     _init_event_queue(bd);
 
     bd_psr_register_cb(bd->regs, _process_psr_event, bd);
+    _queue_initial_psr_events(bd);
 
     return bd_play_title(bd, TITLE_FIRST_PLAY);
 }
@@ -1876,6 +1904,7 @@ int bd_get_event(BLURAY *bd, BD_EVENT *event)
         _init_event_queue(bd);
 
         bd_psr_register_cb(bd->regs, _process_psr_event, bd);
+        _queue_initial_psr_events(bd);
     }
 
     return _get_event(bd, event);



More information about the libbluray-devel mailing list