[libdvdnav-devel] [PATCH] Add button forced selection when FOSL_BTNN is present

Pierre Lamot pierre at videolabs.io
Tue Jan 16 18:06:59 CET 2018


  This patch allows to force the the selection of the current button when
  activating a SPU stream. The behavior is innacurate though, FOSL_BTNN is
  supposed to update the register at time HLI_S_PTM.
---
 src/dvdnav.c    | 8 ++++++++
 src/vm/getset.c | 7 +++++++
 src/vm/getset.h | 1 +
 3 files changed, 16 insertions(+)

diff --git a/src/dvdnav.c b/src/dvdnav.c
index 07352db..e20cc79 100644
--- a/src/dvdnav.c
+++ b/src/dvdnav.c
@@ -790,6 +790,14 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, uint8_t **buf,
     fprintf(MSG_OUT, "libdvdnav: SPU_STREAM_CHANGE stream_id_pan_scan=%d\n",stream_change->physical_pan_scan);
     fprintf(MSG_OUT, "libdvdnav: SPU_STREAM_CHANGE returning DVDNAV_STATUS_OK\n");
 #endif
+    /* This is not realy the right place to do this. FOSL_BTNN should set the register
+     * at HLI_S_PTM rather than when we enter the SPU. As well we should activate FOAC_BTNN
+     * at HLI_E_PTM
+     */
+    if (this->pci.hli.hl_gi.fosl_btnn != 0) {
+      set_HL_BTN(this->vm, this->pci.hli.hl_gi.fosl_btnn);
+    }
+
     pthread_mutex_unlock(&this->vm_lock);
     return DVDNAV_STATUS_OK;
   }
diff --git a/src/vm/getset.c b/src/vm/getset.c
index f60c0da..a93ba3e 100644
--- a/src/vm/getset.c
+++ b/src/vm/getset.c
@@ -216,6 +216,13 @@ void set_RSMinfo(vm_t *vm, int cellN, int blockN) {
   }
 }
 
+
+/* Force the highlight button number register */
+void set_HL_BTN(vm_t *vm, int btnn)
+{
+    (vm->state).HL_BTNN_REG = btnn << 10;
+}
+
 /* Get functions */
 
 /* Searches the TT tables, to find the current TT.
diff --git a/src/vm/getset.h b/src/vm/getset.h
index da2d53e..2b0577f 100644
--- a/src/vm/getset.h
+++ b/src/vm/getset.h
@@ -38,6 +38,7 @@ int  set_MENU(vm_t *vm, int menu);
 int  set_PGCN(vm_t *vm, int pgcN);
 int  set_PGN(vm_t *vm); /* Set PGN based on (vm->state).CellN */
 void set_RSMinfo(vm_t *vm, int cellN, int blockN);
+void set_BTN(vm_t *vm, int btnn);
 
 /* Get */
 int get_TT(vm_t *vm, int vtsN, int vts_ttn);
-- 
2.14.1



More information about the libdvdnav-devel mailing list