Mercurial > mplayer.hg
changeset 27068:d7e0e33c546f
Change DVDNAV command key names.
Parameters now use a string much more intuitive than previous int value.
author | ben |
---|---|
date | Thu, 19 Jun 2008 18:51:42 +0000 |
parents | 833ec0c12cb9 |
children | 1a6930933140 |
files | DOCS/tech/slave.txt command.c etc/input.conf input/input.c input/input.h |
diffstat | 5 files changed, 66 insertions(+), 39 deletions(-) [+] |
line wrap: on
line diff
--- a/DOCS/tech/slave.txt Thu Jun 19 07:13:50 2008 +0000 +++ b/DOCS/tech/slave.txt Thu Jun 19 18:51:42 2008 +0000 @@ -66,14 +66,16 @@ dvb_set_channel <channel_number> <card_number> Set DVB channel. -dvdnav <button> +dvdnav <button_name> Press the given dvdnav button. - 1 up - 2 down - 3 left - 4 right - 5 menu - 6 select + up + down + left + right + menu + select + prev + mouse edl_mark Write the current position into the EDL file.
--- a/command.c Thu Jun 19 07:13:50 2008 +0000 +++ b/command.c Thu Jun 19 18:51:42 2008 +0000 @@ -2281,6 +2281,22 @@ return 1; } +#ifdef USE_DVDNAV +static const struct { + const char *name; + const mp_command_type cmd; +} mp_dvdnav_bindings[] = { + { "up", MP_CMD_DVDNAV_UP }, + { "down", MP_CMD_DVDNAV_DOWN }, + { "left", MP_CMD_DVDNAV_LEFT }, + { "right", MP_CMD_DVDNAV_RIGHT }, + { "menu", MP_CMD_DVDNAV_MENU }, + { "select", MP_CMD_DVDNAV_SELECT }, + { "prev", MP_CMD_DVDNAV_PREVMENU }, + { "mouse", MP_CMD_DVDNAV_MOUSECLICK }, + { NULL, 0 } +}; +#endif int run_command(MPContext * mpctx, mp_cmd_t * cmd) { @@ -3105,10 +3121,18 @@ #ifdef USE_DVDNAV case MP_CMD_DVDNAV:{ int button = -1; + int i; + mp_command_type command = 0; if (mpctx->stream->type != STREAMTYPE_DVDNAV) break; - mp_dvdnav_handle_input(mpctx->stream,cmd->args[0].v.i,&button); + for (i = 0; mp_dvdnav_bindings[i].name; i++) + if (cmd->args[0].v.s && + !strcasecmp (cmd->args[0].v.s, + mp_dvdnav_bindings[i].name)) + command = mp_dvdnav_bindings[i].cmd; + + mp_dvdnav_handle_input(mpctx->stream,command,&button); if (osd_level > 1 && button > 0) set_osd_msg(OSD_MSG_TEXT, 1, osd_duration, "Selected button number %d", button);
--- a/etc/input.conf Thu Jun 19 07:13:50 2008 +0000 +++ b/etc/input.conf Thu Jun 19 18:51:42 2008 +0000 @@ -149,20 +149,20 @@ ## Requires dvdnav:// ## -UP {dvdnav} dvdnav 1 # DVDNav UP -DOWN {dvdnav} dvdnav 2 # DVDNav DOWN -LEFT {dvdnav} dvdnav 3 # DVDNav LEFT -RIGHT {dvdnav} dvdnav 4 # DVDNav RIGHT -ESC {dvdnav} dvdnav 5 # DVDNav MENU -ENTER {dvdnav} dvdnav 6 # DVDNav SELECT (ok) -BS {dvdnav} dvdnav 7 # DVDNav PREVIOUS menu (in the order chapter->title->root) +UP {dvdnav} dvdnav up # DVDNav UP +DOWN {dvdnav} dvdnav down # DVDNav DOWN +LEFT {dvdnav} dvdnav left # DVDNav LEFT +RIGHT {dvdnav} dvdnav right # DVDNav RIGHT +ESC {dvdnav} dvdnav menu # DVDNav MENU +ENTER {dvdnav} dvdnav select # DVDNav SELECT (ok) +BS {dvdnav} dvdnav prev # DVDNav PREVIOUS menu (in the order chapter->title->root) -AR_VUP {dvdnav} dvdnav 1 # DVDNav UP -AR_VDOWN {dvdnav} dvdnav 2 # DVDNav DOWN -AR_PREV {dvdnav} dvdnav 3 # DVDNav LEFT -AR_NEXT {dvdnav} dvdnav 4 # DVDNav RIGHT -AR_MENU {dvdnav} dvdnav 5 # DVDNav MENU -AR_PLAY {dvdnav} dvdnav 6 # DVDNav SELECT (ok) +AR_VUP {dvdnav} dvdnav up # DVDNav UP +AR_VDOWN {dvdnav} dvdnav down # DVDNav DOWN +AR_PREV {dvdnav} dvdnav left # DVDNav LEFT +AR_NEXT {dvdnav} dvdnav right # DVDNav RIGHT +AR_MENU {dvdnav} dvdnav menu # DVDNav MENU +AR_PLAY {dvdnav} dvdnav select # DVDNav SELECT (ok) #? seek_chapter -1 # skip to previous dvd chapter #? seek_chapter +1 # next
--- a/input/input.c Thu Jun 19 07:13:50 2008 +0000 +++ b/input/input.c Thu Jun 19 18:51:42 2008 +0000 @@ -171,7 +171,7 @@ #endif #ifdef USE_DVDNAV - { MP_CMD_DVDNAV, "dvdnav", 1, { {MP_CMD_ARG_INT,{0}}, {-1,{0}} } }, + { MP_CMD_DVDNAV, "dvdnav", 1, { {MP_CMD_ARG_STRING, {0}}, {-1,{0}} } }, #endif #ifdef HAVE_MENU @@ -347,14 +347,14 @@ { { MOUSE_BTN6, 0 }, "volume -1" }, #ifdef USE_DVDNAV - { { KEY_KP8, 0 }, "dvdnav 1" }, // up - { { KEY_KP2, 0 }, "dvdnav 2" }, // down - { { KEY_KP4, 0 }, "dvdnav 3" }, // left - { { KEY_KP6, 0 }, "dvdnav 4" }, // right - { { KEY_KP5, 0 }, "dvdnav 5" }, // menu - { { KEY_KPENTER, 0 }, "dvdnav 6" }, // select - { { MOUSE_BTN0, 0 }, "dvdnav 8" }, //select - { { KEY_KP7, 0 }, "dvdnav 7" }, // previous menu + { { KEY_KP8, 0 }, "dvdnav up" }, // up + { { KEY_KP2, 0 }, "dvdnav down" }, // down + { { KEY_KP4, 0 }, "dvdnav left" }, // left + { { KEY_KP6, 0 }, "dvdnav right" }, // right + { { KEY_KP5, 0 }, "dvdnav menu" }, // menu + { { KEY_KPENTER, 0 }, "dvdnav select" }, // select + { { MOUSE_BTN0, 0 }, "dvdnav mouse" }, //select + { { KEY_KP7, 0 }, "dvdnav prev" }, // previous menu #endif { { KEY_RIGHT, 0 }, "seek 10" },
--- a/input/input.h Thu Jun 19 07:13:50 2008 +0000 +++ b/input/input.h Thu Jun 19 18:51:42 2008 +0000 @@ -112,6 +112,16 @@ MP_CMD_SWITCH_TITLE, MP_CMD_STOP, + /// DVDNAV commands + MP_CMD_DVDNAV_UP = 1000, + MP_CMD_DVDNAV_DOWN, + MP_CMD_DVDNAV_LEFT, + MP_CMD_DVDNAV_RIGHT, + MP_CMD_DVDNAV_MENU, + MP_CMD_DVDNAV_SELECT, + MP_CMD_DVDNAV_PREVMENU, + MP_CMD_DVDNAV_MOUSECLICK, + /// GUI commands MP_CMD_GUI_EVENTS = 5000, MP_CMD_GUI_LOADFILE, @@ -133,15 +143,6 @@ MP_CMD_CHIDE, } mp_command_type; -#define MP_CMD_DVDNAV_UP 1 -#define MP_CMD_DVDNAV_DOWN 2 -#define MP_CMD_DVDNAV_LEFT 3 -#define MP_CMD_DVDNAV_RIGHT 4 -#define MP_CMD_DVDNAV_MENU 5 -#define MP_CMD_DVDNAV_SELECT 6 -#define MP_CMD_DVDNAV_PREVMENU 7 -#define MP_CMD_DVDNAV_MOUSECLICK 8 - // The arg types #define MP_CMD_ARG_INT 0 #define MP_CMD_ARG_FLOAT 1