changeset 91:df9712507b30 src

Add a new API function, to allow for more flexible menu button control. The current menu button control code relies on wrong NAV PCI packet information which is out of sync with what is actually being displayed.
author jcdutton
date Wed, 04 Sep 2002 11:41:52 +0000
parents eeabf5a51b2b
children 82af243658bd
files dvd_types.h dvdnav.h highlight.c
diffstat 3 files changed, 34 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/dvd_types.h	Tue Sep 03 07:50:45 2002 +0000
+++ b/dvd_types.h	Wed Sep 04 11:41:52 2002 +0000
@@ -296,5 +296,4 @@
   uint32_t buttonN;     /*!< Button number for the SPU decoder. */
 } dvdnav_highlight_area_t;
 
-
 #endif /* DVD_H_INCLUDED */
--- a/dvdnav.h	Tue Sep 03 07:50:45 2002 +0000
+++ b/dvdnav.h	Wed Sep 04 11:41:52 2002 +0000
@@ -41,6 +41,7 @@
 #include "dvd_types.h"
 
 #include <dvdread/dvd_reader.h>
+#include <dvdread/ifo_types.h> /* For vm_cmd_t */
 
 /**
  * Opaque data-type can be viewed as a 'DVD handle'. You should get
@@ -575,6 +576,14 @@
 dvdnav_status_t dvdnav_button_select_and_activate(dvdnav_t *self, int button);
 
 /**
+ * Activate (press) a button and execute specified command.
+ *
+ * \param self Pointer to dvdnav_t associated with this operation.
+ * \param cmd DVD Command to execute.
+ */
+dvdnav_status_t dvdnav_button_activate_cmd(dvdnav_t *self, int32_t button, vm_cmd_t *cmd);
+
+/**
  * Select button at specified (image) co-ordinates.
  *
  * \param self Pointer to dvdnav_t associated with this operation.
--- a/highlight.c	Tue Sep 03 07:50:45 2002 +0000
+++ b/highlight.c	Wed Sep 04 11:41:52 2002 +0000
@@ -410,6 +410,31 @@
   return S_OK;
 }
 
+dvdnav_status_t dvdnav_button_activate_cmd(dvdnav_t *this, int32_t button, vm_cmd_t *cmd)
+{
+  if(!this || !this->vm) 
+    return S_ERR;
+  pthread_mutex_lock(&this->vm_lock); 
+  /* make the VM execute the appropriate code and
+   * schedule a jump */
+#ifdef BUTTON_TESTING
+  fprintf(MSG_OUT, "libdvdnav:dvdnav_button_activate_cmd: Evaluating Button Activation commands.\n");
+#endif
+  if(button > 0) {
+    printerrf("Select button number %i\n ",
+	      button);
+    this->vm->state.HL_BTNN_REG = (button << 10);
+    if( (vm_eval_cmd(this->vm, cmd)) == 1) {
+      /* Command caused a jump */
+      this->vm->hop_channel++;
+    }
+  }
+  /* Always remove still, because some still menus have no buttons. */
+  this->position_current.still = 0;
+  pthread_mutex_unlock(&this->vm_lock);
+  return S_OK;
+}  
+
 dvdnav_status_t dvdnav_button_select(dvdnav_t *this, int button) {
   
   if(!this) {