[libbluray-devel] Splitted _process_psr_event()

hpi1 git at videolan.org
Thu Jun 30 14:13:03 CEST 2011


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Thu Jun 30 15:11:47 2011 +0300| [7c615b77c85e21bd0cf219d0cc8cf21e99f366e7] | committer: hpi1

Splitted _process_psr_event()

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

 src/libbluray/bluray.c |   88 ++++++++++++++++++++++++++---------------------
 1 files changed, 49 insertions(+), 39 deletions(-)

diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index 9ced815..f54e561 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -1692,53 +1692,63 @@ void bd_stop_bdj(BLURAY *bd)
  * Navigation mode interface
  */
 
+static void _process_psr_restore_event(BLURAY *bd, BD_PSR_EVENT *ev)
+{
+    /* PSR restore events are handled internally.
+     * Restore stored playback position.
+     */
+
+    BD_DEBUG(DBG_BLURAY, "PSR restore: psr%u = %u (%p)\n", ev->psr_idx, ev->new_val, bd);
+
+    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 */
+            _queue_event(bd, (BD_EVENT){BD_EVENT_TITLE, ev->new_val});
+            return;
+        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:
+            /* handled by graphics controller */
+            return;
+
+        default:
+            /* others: ignore */
+            return;
+    }
+}
+
 /*
  * notification events to APP
  */
+
 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) {
+    switch (ev->ev_type) {
+        case BD_PSR_RESTORE:
+            _process_psr_restore_event(bd, ev);
+            return;
 
-        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;
-        }
+        case BD_PSR_SAVE:
+        default:
+            return;
     }
 
     BD_DEBUG(DBG_BLURAY, "PSR event %d %d (%p)\n", ev->psr_idx, ev->new_val, bd);



More information about the libbluray-devel mailing list