changeset 125:87400040e4a4 src

try-run menu jumps
author mroi
date Fri, 14 Mar 2003 18:48:25 +0000
parents e404d210ff91
children 42d06bc1251d
files searching.c
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/searching.c	Fri Mar 14 18:47:51 2003 +0000
+++ b/searching.c	Fri Mar 14 18:48:25 2003 +0000
@@ -344,6 +344,7 @@
 }
 
 dvdnav_status_t dvdnav_menu_call(dvdnav_t *this, DVDMenuID_t menu) {
+  vm_t *try_vm;
   
   if(!this) {
     printerr("Passed a NULL pointer.");
@@ -357,12 +358,18 @@
     return S_ERR;
   }
   
-  if (vm_jump_menu(this->vm, menu)) {
+  /* make a copy of current VM and try to navigate the copy to the menu */
+  try_vm = vm_new_copy(this->vm);
+  if (vm_jump_menu(try_vm, menu) && !try_vm->stopped) {
+    /* merge changes on success */
+    vm_merge(this->vm, try_vm);
+    vm_free_copy(try_vm);
     this->vm->hop_channel++;
     pthread_mutex_unlock(&this->vm_lock); 
     return S_OK;
   } else {
-    printerr("No such menu.");
+    vm_free_copy(try_vm);
+    printerr("No such menu or menu not reachable.");
     pthread_mutex_unlock(&this->vm_lock); 
     return S_ERR;
   }