changeset 197:a20a5976a207 src

last_cmd_nav_lbn has to be initialized with an invalid value, so that the first test to filter double commands will always fail, but 0 is not invalid here! * use SRI_END_OF_CELL and reenable double command filter * fix return values of get_current_button() * use return value of button_auto_action()
author mroi
date Mon, 12 May 2003 19:43:11 +0000
parents b751f0790ac6
children 373f27da196b
files dvdnav.c highlight.c
diffstat 2 files changed, 9 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/dvdnav.c	Sun May 11 13:18:04 2003 +0000
+++ b/dvdnav.c	Mon May 12 19:43:11 2003 +0000
@@ -51,7 +51,7 @@
 
   memset(&this->pci,0,sizeof(this->pci));
   memset(&this->dsi,0,sizeof(this->dsi));
-  this->last_cmd_nav_lbn = 0;
+  this->last_cmd_nav_lbn = SRI_END_OF_CELL;
 
   /* Set initial values of flags */
   this->position_current.still = 0;
--- a/highlight.c	Sun May 11 13:18:04 2003 +0000
+++ b/highlight.c	Mon May 12 19:43:11 2003 +0000
@@ -223,18 +223,16 @@
 
   if(!this || !pci) {
     printerr("Passed a NULL pointer.");
-    return DVDNAV_STATUS_ERR;
+    return NULL;
   }
   if(!pci->hli.hl_gi.hli_ss) {
     printerr("Not in a menu.");
-    return DVDNAV_STATUS_ERR;
+    return NULL;
   }
-#if 0  /* This causes some DVDs to fail to activate buttons. */
   if(this->last_cmd_nav_lbn == pci->pci_gi.nv_pck_lbn) {
     printerr("This NAV has already been left.");
-    return DVDNAV_STATUS_ERR;
+    return NULL;
   }
-#endif
 
   button = this->vm->state.HL_BTNN_REG >> 10;
 #ifdef BUTTON_TESTING
@@ -247,6 +245,7 @@
 static dvdnav_status_t button_auto_action(dvdnav_t *this, pci_t *pci) {
   if (get_current_button(this, pci)->auto_action_mode)
     return dvdnav_button_activate(this, pci);
+  return DVDNAV_STATUS_OK;
 }
 
 dvdnav_status_t dvdnav_upper_button_select(dvdnav_t *this, pci_t *pci) {
@@ -256,9 +255,7 @@
     return DVDNAV_STATUS_ERR;
 
   dvdnav_button_select(this, pci, button_ptr->up);
-  button_auto_action(this, pci);
- 
-  return DVDNAV_STATUS_OK;
+  return button_auto_action(this, pci);
 }
 
 dvdnav_status_t dvdnav_lower_button_select(dvdnav_t *this, pci_t *pci) {
@@ -268,9 +265,7 @@
     return DVDNAV_STATUS_ERR;
 
   dvdnav_button_select(this, pci, button_ptr->down);
-  button_auto_action(this, pci);
-  
-  return DVDNAV_STATUS_OK;
+  return button_auto_action(this, pci);
 }
 
 dvdnav_status_t dvdnav_right_button_select(dvdnav_t *this, pci_t *pci) {
@@ -280,9 +275,7 @@
     return DVDNAV_STATUS_ERR;
 
   dvdnav_button_select(this, pci, button_ptr->right);
-  button_auto_action(this, pci);
-  
-  return DVDNAV_STATUS_OK;
+  return button_auto_action(this, pci);
 }
 
 dvdnav_status_t dvdnav_left_button_select(dvdnav_t *this, pci_t *pci) {
@@ -292,9 +285,7 @@
     return DVDNAV_STATUS_ERR;
 
   dvdnav_button_select(this, pci, button_ptr->left);
-  button_auto_action(this, pci);
-  
-  return DVDNAV_STATUS_OK;
+  return button_auto_action(this, pci);
 }
 
 dvdnav_status_t dvdnav_get_highlight_area(pci_t *nav_pci , int32_t button, int32_t mode, 
@@ -347,12 +338,10 @@
     printerr("Not in a menu.");
     return DVDNAV_STATUS_ERR;
   }
-#if 0  /* This causes some DVDs to fail to activate buttons. */
   if(this->last_cmd_nav_lbn == pci->pci_gi.nv_pck_lbn) {
     printerr("This NAV has already been left.");
     return DVDNAV_STATUS_ERR;
   }
-#endif
   pthread_mutex_lock(&this->vm_lock); 
 
   button = this->vm->state.HL_BTNN_REG >> 10;
@@ -436,12 +425,10 @@
     printerr("Not in a menu.");
     return DVDNAV_STATUS_ERR;
   }
-#if 0  /* This causes some DVDs to fail to activate buttons. */
   if(this->last_cmd_nav_lbn == pci->pci_gi.nv_pck_lbn) {
     printerr("This NAV has already been left.");
     return DVDNAV_STATUS_ERR;
   }
-#endif
  
 #ifdef BUTTON_TESTING
   fprintf(MSG_OUT, "libdvdnav: Button select %i\n", button); 
@@ -479,12 +466,10 @@
     printerr("Not in a menu.");
     return DVDNAV_STATUS_ERR;
   }
-#if 0  /* This causes some DVDs to fail to activate buttons. */
   if(this->last_cmd_nav_lbn == pci->pci_gi.nv_pck_lbn) {
     printerr("This NAV has already been left.");
     return DVDNAV_STATUS_ERR;
   }
-#endif
 
   cur_button = this->vm->state.HL_BTNN_REG >> 10;