[libbluray-devel] Handle PSR restore events (restore stored playback position)

hpi1 git at videolan.org
Sat Apr 30 13:41:13 CEST 2011


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Sat Apr 30 14:40:21 2011 +0300| [8b43eb228f8476d5283b7d4bd94e6e8c998ed4d1] | committer: hpi1

Handle PSR restore events (restore stored playback position)

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

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

diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index 43b5119..6e53186 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -1674,6 +1674,43 @@ static void _process_psr_event(void *handle, BD_PSR_EVENT *ev)
 {
     BLURAY *bd = (BLURAY*)handle;
 
+    /* PSR restore events are handled internally */
+
+    if (ev->ev_type == BD_PSR_RESTORE) {
+
+        BD_DEBUG(DBG_BLURAY, "PSR RESTORE event %d %d (%p)\n", ev->psr_idx, ev->new_val, bd);
+
+        /* Restore stored playback position */
+
+        switch (ev->psr_idx) {
+            case PSR_ANGLE_NUMBER:
+                /* can't set angle before playlist is opened */
+                return;
+            case PSR_TITLE_NUMBER:
+                /* pass to the application */
+                break;
+            case PSR_CHAPTER:
+                /* will be selected automatically */
+                return;
+            case PSR_PLAYLIST:
+                bd_select_playlist(bd, ev->new_val);
+                nav_set_angle(bd->title, bd->st0.clip, bd_psr_read(bd->regs, PSR_ANGLE_NUMBER) - 1);
+                return;
+            case PSR_PLAYITEM:
+                bd_seek_playitem(bd, ev->new_val);
+                return;
+            case PSR_TIME:
+                bd_seek_time(bd, ((int64_t)ev->new_val) << 1);
+                return;
+            case PSR_SELECTED_BUTTON_ID:
+            case PSR_MENU_PAGE_ID:
+                /* TODO: need to inform graphics controller ? */
+            default:
+                /* others: ignore */
+                return;
+        }
+    }
+
     BD_DEBUG(DBG_BLURAY, "PSR event %d %d (%p)\n", ev->psr_idx, ev->new_val, bd);
 
     switch (ev->psr_idx) {



More information about the libbluray-devel mailing list