summaryrefslogtreecommitdiffstats
path: root/input
diff options
context:
space:
mode:
authoralbeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-03-20 13:30:57 +0000
committeralbeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-03-20 13:30:57 +0000
commitaa655ff79720fdb56693478fff585c891a64cff0 (patch)
tree6ebe4e8cd90a8e0b66bbccab87ed73c82aeb880f /input
parent61f5edf208440f02a29494ad27f7d8faa50e0f59 (diff)
downloadmpv-aa655ff79720fdb56693478fff585c891a64cff0.tar.bz2
mpv-aa655ff79720fdb56693478fff585c891a64cff0.tar.xz
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
Diffstat (limited to 'input')
-rw-r--r--input/input.c54
1 files changed, 49 insertions, 5 deletions
diff --git a/input/input.c b/input/input.c
index 50a1aea9fc..cb74313223 100644
--- a/input/input.c
+++ b/input/input.c
@@ -116,23 +116,23 @@ static mp_key_name_t key_names[] = {
{ JOY_AXIS0_PLUS, "JOY_AXIS0_PLUS" },
{ JOY_AXIS0_MINUS, "JOY_AXIS0_MINUS" },
- { JOY_AXIS1_PLUS, " JOY_AXIS1_PLUS" },
+ { JOY_AXIS1_PLUS, "JOY_AXIS1_PLUS" },
{ JOY_AXIS1_MINUS, "JOY_AXIS1_MINUS" },
{ JOY_AXIS2_PLUS, "JOY_AXIS2_PLUS" },
{ JOY_AXIS2_MINUS, "JOY_AXIS2_MINUS" },
- { JOY_AXIS3_PLUS, " JOY_AXIS3_PLUS" },
+ { JOY_AXIS3_PLUS, "JOY_AXIS3_PLUS" },
{ JOY_AXIS3_MINUS, "JOY_AXIS3_MINUS" },
{ JOY_AXIS4_PLUS, "JOY_AXIS4_PLUS" },
{ JOY_AXIS4_MINUS, "JOY_AXIS4_MINUS" },
- { JOY_AXIS5_PLUS, " JOY_AXIS5_PLUS" },
+ { JOY_AXIS5_PLUS, "JOY_AXIS5_PLUS" },
{ JOY_AXIS5_MINUS, "JOY_AXIS5_MINUS" },
{ JOY_AXIS6_PLUS, "JOY_AXIS6_PLUS" },
{ JOY_AXIS6_MINUS, "JOY_AXIS6_MINUS" },
- { JOY_AXIS7_PLUS, " JOY_AXIS7_PLUS" },
+ { JOY_AXIS7_PLUS, "JOY_AXIS7_PLUS" },
{ JOY_AXIS7_MINUS, "JOY_AXIS7_MINUS" },
{ JOY_AXIS8_PLUS, "JOY_AXIS8_PLUS" },
{ JOY_AXIS8_MINUS, "JOY_AXIS8_MINUS" },
- { JOY_AXIS9_PLUS, " JOY_AXIS9_PLUS" },
+ { JOY_AXIS9_PLUS, "JOY_AXIS9_PLUS" },
{ JOY_AXIS9_MINUS, "JOY_AXIS9_MINUS" },
{ JOY_BTN0, "JOY_BTN0" },
@@ -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 */