[libbluray-devel] Always update selected button when page changes

hpi1 git at videolan.org
Wed Feb 23 12:22:48 CET 2011


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Wed Feb 23 00:18:36 2011 +0200| [cf37de60f7023bb414d2f1b05c3336337dfd652a] | committer: hpi1

Always update selected button when page changes

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=cf37de60f7023bb414d2f1b05c3336337dfd652a
---

 src/libbluray/decoders/graphics_controller.c |   18 ++++++------------
 1 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/src/libbluray/decoders/graphics_controller.c b/src/libbluray/decoders/graphics_controller.c
index 9e8bcc3..7d2aa3c 100644
--- a/src/libbluray/decoders/graphics_controller.c
+++ b/src/libbluray/decoders/graphics_controller.c
@@ -178,7 +178,7 @@ static int _is_button_enabled(GRAPHICS_CONTROLLER *gc, BD_IG_PAGE *page, unsigne
     return 0;
 }
 
-static int _find_selected_button_id(GRAPHICS_CONTROLLER *gc)
+static uint16_t _find_selected_button_id(GRAPHICS_CONTROLLER *gc)
 {
     /* executed when playback condition changes (ex. new page, popup-on, ...) */
     PG_DISPLAY_SET *s         = gc->igs;
@@ -282,6 +282,9 @@ static void _select_page(GRAPHICS_CONTROLLER *gc, uint16_t page_id)
     bd_psr_write(gc->regs, PSR_MENU_PAGE_ID, page_id);
     _gc_clear_osd(gc, 1);
     _reset_enabled_button(gc);
+
+    uint16_t button_id = _find_selected_button_id(gc);
+    bd_psr_write(gc->regs, PSR_SELECTED_BUTTON_ID, button_id);
 }
 
 static void _gc_reset(GRAPHICS_CONTROLLER *gc)
@@ -453,10 +456,6 @@ static void _render_page(GRAPHICS_CONTROLLER *gc,
     TRACE("rendering page #%d using palette #%d. page has %d bogs\n",
           page->id, page->palette_id_ref, page->num_bogs);
 
-    if (selected_button_id == 0xffff) {
-        selected_button_id = page->default_selected_button_id_ref;
-    }
-
     for (ii = 0; ii < page->num_bogs; ii++) {
         BD_IG_BOG    *bog      = &page->bog[ii];
         unsigned      valid_id = gc->enabled_button[ii];
@@ -659,16 +658,11 @@ static void _set_button_page(GRAPHICS_CONTROLLER *gc, uint32_t param, GC_NAV_CMD
         }
     }
 
-    if (!button) {
-        button_id = 0xffff; // run 5.9.7.4 and 5.9.8.3
-    } else {
+    if (button) {
         gc->enabled_button[bog_idx] = button_id;
+        bd_psr_write(gc->regs, PSR_SELECTED_BUTTON_ID, button_id);
     }
 
-    bd_psr_write(gc->regs, PSR_SELECTED_BUTTON_ID, button_id);
-
-    gc->ig_drawn = 0;
-
     _render_page(gc, 0xffff, cmds);
 }
 



More information about the libbluray-devel mailing list