libbluray | branch: master | hpi1 <[email protected]> | Tue Jun 14 15:10:15 2011 +0300| [d71fb09f8f975717e1d950c07f5a46ded4070431] | committer: hpi1
Added return value for bd_user_input() and bd_mouse_select() > http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=d71fb09f8f975717e1d950c07f5a46ded4070431 --- src/libbluray/bluray.c | 20 ++++++++++++++------ src/libbluray/bluray.h | 14 +++++++++----- src/libbluray/decoders/graphics_controller.c | 2 +- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c index e6984ba..e21919d 100644 --- a/src/libbluray/bluray.c +++ b/src/libbluray/bluray.c @@ -1986,18 +1986,22 @@ int bd_menu_call(BLURAY *bd, int64_t pts) return _play_title(bd, BLURAY_TITLE_TOP_MENU); } -static void _run_gc(BLURAY *bd, gc_ctrl_e msg, uint32_t param) +static int _run_gc(BLURAY *bd, gc_ctrl_e msg, uint32_t param) { + int result = -1; + if (bd && bd->graphics_controller && bd->hdmv_vm) { GC_NAV_CMDS cmds = {-1, NULL, -1}; - gc_run(bd->graphics_controller, msg, param, &cmds); + result = gc_run(bd->graphics_controller, msg, param, &cmds); if (cmds.num_nav_cmds > 0) { hdmv_vm_set_object(bd->hdmv_vm, cmds.num_nav_cmds, cmds.nav_cmds); bd->hdmv_suspended = !hdmv_vm_running(bd->hdmv_vm); } } + + return result; } static void _process_hdmv_vm_event(BLURAY *bd, HDMV_EVENT *hev) @@ -2148,22 +2152,22 @@ int bd_get_event(BLURAY *bd, BD_EVENT *event) * user interaction */ -void bd_mouse_select(BLURAY *bd, int64_t pts, uint16_t x, uint16_t y) +int bd_mouse_select(BLURAY *bd, int64_t pts, uint16_t x, uint16_t y) { if (pts >= 0) { bd_psr_write(bd->regs, PSR_TIME, (uint32_t)(((uint64_t)pts) >> 1)); } - _run_gc(bd, GC_CTRL_MOUSE_MOVE, (x << 16) | y); + return _run_gc(bd, GC_CTRL_MOUSE_MOVE, (x << 16) | y); } -void bd_user_input(BLURAY *bd, int64_t pts, uint32_t key) +int bd_user_input(BLURAY *bd, int64_t pts, uint32_t key) { if (pts >= 0) { bd_psr_write(bd->regs, PSR_TIME, (uint32_t)(((uint64_t)pts) >> 1)); } - _run_gc(bd, GC_CTRL_VK_KEY, key); + return _run_gc(bd, GC_CTRL_VK_KEY, key); } void bd_register_overlay_proc(BLURAY *bd, void *handle, bd_overlay_proc_f func) @@ -2179,6 +2183,10 @@ void bd_register_overlay_proc(BLURAY *bd, void *handle, bd_overlay_proc_f func) } } +/* + * + */ + struct meta_dl *bd_get_meta(BLURAY *bd) { if (!bd) { diff --git a/src/libbluray/bluray.h b/src/libbluray/bluray.h index c0566d9..a5b44ca 100644 --- a/src/libbluray/bluray.h +++ b/src/libbluray/bluray.h @@ -523,7 +523,7 @@ int bd_get_event(BLURAY *bd, BD_EVENT *event); /** * - * Start playing disc in navigation mode. + * Start playing disc in navigation mode (using on-disc menus). * * Playback is started from "First Play" title. * @@ -599,9 +599,9 @@ void bd_register_overlay_proc(BLURAY *bd, void *handle, bd_overlay_proc_f func); * @param bd BLURAY object * @param pts current playback position (1/90000s) or -1 * @param key input key - * @return 1 on success, 0 if error + * @return <0 on error, 0 on success, >0 if selection/activation changed */ -void bd_user_input(BLURAY *bd, int64_t pts, uint32_t key); +int bd_user_input(BLURAY *bd, int64_t pts, uint32_t key); /** * @@ -611,9 +611,13 @@ void bd_user_input(BLURAY *bd, int64_t pts, uint32_t key); * @param pts current playback position (1/90000s) or -1 * @param x mouse pointer x-position * @param y mouse pointer y-position - * @return none + * @return <0 on error, 0 when mouse is outside of buttons, 1 when mouse is inside button + */ +int bd_mouse_select(BLURAY *bd, int64_t pts, uint16_t x, uint16_t y); + +/* + * */ -void bd_mouse_select(BLURAY *bd, int64_t pts, uint16_t x, uint16_t y); struct meta_dl; /** diff --git a/src/libbluray/decoders/graphics_controller.c b/src/libbluray/decoders/graphics_controller.c index dd3109c..7567987 100644 --- a/src/libbluray/decoders/graphics_controller.c +++ b/src/libbluray/decoders/graphics_controller.c @@ -821,7 +821,7 @@ static int _mouse_move(GRAPHICS_CONTROLLER *gc, unsigned x, unsigned y, GC_NAV_C /* is button already selected? */ if (button->id == cur_btn_id) { - return 0; + return 1; } new_btn_id = button->id; _______________________________________________ libbluray-devel mailing list [email protected] http://mailman.videolan.org/listinfo/libbluray-devel
