Mercurial > mplayer.hg
diff command.c @ 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 | 4bee4b9ec054 |
| children | 1a6930933140 |
line wrap: on
line diff
--- 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);
