0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

Added options -input keylist and -input cmdlist to list all know

keys and commands


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@5219 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
albeu 2002-03-20 13:30:57 +00:00
parent 61f5edf208
commit aa655ff797

View File

@ -278,11 +278,16 @@ static unsigned int ar_delay = 100, ar_rate = 8, last_ar = 0;
static int use_joystick = 1, use_lirc = 1;
static char* config_file = "input.conf";
static int mp_input_print_key_list(config_t* cfg);
static int mp_input_print_cmd_list(config_t* cfg);
// Our command line options
static config_t input_conf[] = {
{ "conf", &config_file, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL },
{ "ar-delay", &ar_delay, CONF_TYPE_INT, CONF_GLOBAL, 0, 0, NULL },
{ "ar-rate", &ar_rate, CONF_TYPE_INT, CONF_GLOBAL, 0, 0, NULL },
{ "keylist", mp_input_print_key_list, CONF_TYPE_FUNC, CONF_GLOBAL, 0, 0, NULL },
{ "cmdlist", mp_input_print_cmd_list, CONF_TYPE_FUNC, CONF_GLOBAL, 0, 0, NULL },
{ NULL, NULL, 0, 0, 0, 0, NULL}
};
@ -1247,4 +1252,43 @@ mp_input_register_options(m_config_t* cfg) {
m_config_register_options(cfg,mp_input_opts);
}
static int mp_input_print_key_list(config_t* cfg) {
int i;
printf("\n");
for(i= 0; key_names[i].name != NULL ; i++)
printf("%s\n",key_names[i].name);
exit(0);
}
static int mp_input_print_cmd_list(config_t* cfg) {
mp_cmd_t *cmd;
int i,j;
char* type;
for(i = 0; (cmd = &mp_cmds[i])->name != NULL ; i++) {
printf("%-20.20s",cmd->name);
for(j= 0 ; j < MP_CMD_MAX_ARGS && cmd->args[j].type != -1 ; j++) {
switch(cmd->args[j].type) {
case MP_CMD_ARG_INT:
type = "Integer";
break;
case MP_CMD_ARG_FLOAT:
type = "Float";
break;
case MP_CMD_ARG_STRING:
type = "String";
break;
default:
type = "??";
}
if(j+1 > cmd->nargs)
printf(" [%s]",type);
else
printf(" %s",type);
}
printf("\n");
}
exit(0);
}
#endif /* HAVE_NEW_INPUT */