[libbluray-devel] Store current playback location when entering top menu

hpi1 git at videolan.org
Sat Apr 30 14:06:07 CEST 2011


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Sat Apr 30 14:49:48 2011 +0300| [d50758eda9d31e69a5b23a044a139068acd69a60] | committer: hpi1

Store current playback location when entering top menu

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

 src/libbluray/bluray.c       |    4 ++++
 src/libbluray/hdmv/hdmv_vm.c |   18 +++++++++++++++---
 src/libbluray/hdmv/hdmv_vm.h |   30 +++++++++++++++++++++++++++++-
 3 files changed, 48 insertions(+), 4 deletions(-)

diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index 6e53186..f526217 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -1938,6 +1938,10 @@ int bd_menu_call(BLURAY *bd, int64_t pts)
             BD_DEBUG(DBG_BLURAY|DBG_CRIT, "menu call masked by movie object\n");
             return 0;
         }
+
+        if (hdmv_vm_suspend_pl(bd->hdmv_vm) < 0) {
+            BD_DEBUG(DBG_BLURAY|DBG_CRIT, "bd_menu_call(): error storing playback location\n");
+        }
     }
 
     return _play_title(bd, BLURAY_TITLE_TOP_MENU);
diff --git a/src/libbluray/hdmv/hdmv_vm.c b/src/libbluray/hdmv/hdmv_vm.c
index 3453d2f..bda4e16 100644
--- a/src/libbluray/hdmv/hdmv_vm.c
+++ b/src/libbluray/hdmv/hdmv_vm.c
@@ -974,13 +974,25 @@ int hdmv_vm_resume(HDMV_VM *p)
     return result;
 }
 
-int hdmv_vm_suspend(HDMV_VM *p)
+int hdmv_vm_suspend_pl(HDMV_VM *p)
 {
     int result = -1;
     bd_mutex_lock(&p->mutex);
 
-    if (p->object && !p->ig_object) {
-        _suspend_object(p, 1);
+    if (p->object || p->ig_object) {
+        BD_DEBUG(DBG_HDMV, "hdmv_vm_suspend_pl(): HDMV VM is still running\n");
+
+    } else if (!p->suspended_object) {
+        BD_DEBUG(DBG_HDMV, "hdmv_vm_suspend_pl(): No suspended object\n");
+
+    } else if (!p->suspended_object->resume_intention_flag) {
+        BD_DEBUG(DBG_HDMV, "hdmv_vm_suspend_pl(): no resume intention flag\n");
+
+        p->suspended_object = NULL;
+        result = 0;
+
+    } else {
+        bd_psr_save_state(p->regs);
         result = 0;
     }
 
diff --git a/src/libbluray/hdmv/hdmv_vm.h b/src/libbluray/hdmv/hdmv_vm.h
index 9c0d945..cfb92a8 100644
--- a/src/libbluray/hdmv/hdmv_vm.h
+++ b/src/libbluray/hdmv/hdmv_vm.h
@@ -79,7 +79,35 @@ BD_PRIVATE int      hdmv_vm_running(HDMV_VM *p);
 #define HDMV_TITLE_SEARCH_MASK  0x02
 BD_PRIVATE uint32_t hdmv_vm_get_uo_mask(HDMV_VM *p);
 
-BD_PRIVATE int      hdmv_vm_suspend(HDMV_VM *p);
+/**
+ *
+ *  Suspend playlist playback
+ *
+ *  This function assumes playlist is currently playing and
+ *  movie object execution is suspended at PLAY_PL instruction.
+ *
+ *  If resume_intention_flag of current movie object is 1:
+ *    Copy playback position PSRs to backup registers
+ *    (suspend playlist playback at current position)
+ *  If resume_intention_flag of current movie object is 0:
+ *    Discard current movie object
+ *
+ * @param p  HDMV_VM object
+ * @return 0 on success, -1 if error
+ */
+BD_PRIVATE int      hdmv_vm_suspend_pl(HDMV_VM *p);
+
+/**
+ *
+ *  Resume HDMV execution
+ *
+ *  Continue execution of movie object after playlist playback.
+ *  Do not restore backup PSRs.
+ *  This function is called when playlist playback ends.
+ *
+ * @param p  HDMV_VM object
+ * @return 0 on success, -1 if error
+ */
 BD_PRIVATE int      hdmv_vm_resume(HDMV_VM *p);
 
 #endif // _HDMV_VM_H_



More information about the libbluray-devel mailing list