changeset 162:0fd70a257b44 src

Implement ESCAPE key jumping from TITLE to MENU and back again.
author jcdutton
date Sun, 06 Apr 2003 16:56:22 +0000
parents 81b9602f780c
children 5d8955d7a01a
files dvd_types.h searching.c vm.c vm.h
diffstat 4 files changed, 32 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/dvd_types.h	Sun Apr 06 13:05:45 2003 +0000
+++ b/dvd_types.h	Sun Apr 06 16:56:22 2003 +0000
@@ -48,6 +48,7 @@
  * DVD Menu
  */
 typedef enum {
+  DVD_MENU_Escape     = 0, /**< TBD */
   DVD_MENU_Title      = 2, /**< TBD */
   DVD_MENU_Root       = 3, /**< TBD */
   DVD_MENU_Subpicture = 4, /**< TBD */
--- a/searching.c	Sun Apr 06 13:05:45 2003 +0000
+++ b/searching.c	Sun Apr 06 16:56:22 2003 +0000
@@ -357,6 +357,20 @@
   
   /* make a copy of current VM and try to navigate the copy to the menu */
   try_vm = vm_new_copy(this->vm);
+  if ( (menu == DVD_MENU_Escape) && (this->vm->state.domain != VTS_DOMAIN)) {
+    /* Try resume */
+    if (!try_vm->stopped && vm_resume(try_vm)) {
+        /* merge changes on success */
+        vm_merge(this->vm, try_vm);
+        vm_free_copy(try_vm);
+        this->position_current.still = 0;
+        this->vm->hop_channel++;
+        pthread_mutex_unlock(&this->vm_lock); 
+        return S_OK;
+    }
+  }
+  if (menu == DVD_MENU_Escape) menu = DVD_MENU_Title;
+ 
   if (vm_jump_menu(try_vm, menu) && !try_vm->stopped) {
     /* merge changes on success */
     vm_merge(this->vm, try_vm);
--- a/vm.c	Sun Apr 06 13:05:45 2003 +0000
+++ b/vm.c	Sun Apr 06 16:56:22 2003 +0000
@@ -527,6 +527,18 @@
   }
   return 0;
 }
+int vm_resume(vm_t *vm) {
+  link_t link_values;
+
+  if (!(vm->state).rsm_vtsN) { /* Do we have resume info. */
+    return S_ERR;
+  }
+  link_values.command = LinkRSM;
+  if (!process_command(vm, link_values)) {
+    return S_ERR;
+  }
+  return S_OK;
+}
 
 int vm_jump_menu(vm_t *vm, DVDMenuID_t menuid) {
   domain_t old_domain = (vm->state).domain;
@@ -539,6 +551,7 @@
   case VMGM_DOMAIN:
     switch(menuid) {
     case DVD_MENU_Title:
+    case DVD_MENU_Escape:
       (vm->state).domain = VMGM_DOMAIN;
       break;
     case DVD_MENU_Root:
@@ -1831,6 +1844,9 @@
 
 /*
  * $Log$
+ * Revision 1.56  2003/04/06 16:56:22  jcdutton
+ * Implement ESCAPE key jumping from TITLE to MENU and back again.
+ *
  * Revision 1.55  2003/04/06 12:47:32  jcdutton
  * Remove an unneeded printf.
  *
--- a/vm.h	Sun Apr 06 13:05:45 2003 +0000
+++ b/vm.h	Sun Apr 06 16:56:22 2003 +0000
@@ -149,6 +149,7 @@
 int vm_jump_prev_pg(vm_t *vm);
 int vm_jump_up(vm_t *vm);
 int vm_jump_menu(vm_t *vm, DVDMenuID_t menuid);
+int vm_resume(vm_t *vm);
 int vm_exec_cmd(vm_t *vm, vm_cmd_t *cmd);
 
 /* getting information */