summaryrefslogtreecommitdiffstats
path: root/input/input.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-09-24 21:57:43 +0200
committerwm4 <wm4@nowhere>2012-10-12 10:10:32 +0200
commit88849fd1d4056bc22305cc4433dc56360dd6d0e9 (patch)
treed444c8533404a303a07e36c288474d7d927457f9 /input/input.h
parenta441cd3eeb9291e20d5a8052d32ce8180b017763 (diff)
downloadmpv-88849fd1d4056bc22305cc4433dc56360dd6d0e9.tar.bz2
mpv-88849fd1d4056bc22305cc4433dc56360dd6d0e9.tar.xz
commands: add choice type to input commands
Allow using the choice type (as it used for command line) for arguments of input commands. Change the magic integer arguments of some commands (like seek) to use choices instead. The old numeric values are still allowed (but only those which made sense before, not arbitrary integers). In order to do this, remove the input.c specific types (like MP_CMD_ARG_INT) completely and specify commands using the m_option types. Also, add the special choice "-" to some arguments. It's supposed to signify the default value, so arguments can be easily skipped. Maybe the choice option should recognize this and not change the previous value, but we'll leave this for later. For now, leave compatibility integer values for all new choice arguments, e.g. "0" maps to 0. We could let the choice option type do this automatically, but we don't, because we want user input values and internal mplayer values decoupled in general. The compatibility options will be removed one day, too. Also, remove optional args for strings - would require either annoying additional code, or copying strings twice. It's not used, so remove it.
Diffstat (limited to 'input/input.h')
-rw-r--r--input/input.h8
1 files changed, 2 insertions, 6 deletions
diff --git a/input/input.h b/input/input.h
index 4823ab75f0..e4eb0a8d32 100644
--- a/input/input.h
+++ b/input/input.h
@@ -21,6 +21,7 @@
#include <stdbool.h>
#include "bstr.h"
+#include "m_option.h"
// All command IDs
enum mp_command_type {
@@ -80,11 +81,6 @@ enum mp_command_type {
MP_CMD_VO_CMDLINE,
};
-// The arg types
-#define MP_CMD_ARG_INT 1
-#define MP_CMD_ARG_FLOAT 2
-#define MP_CMD_ARG_STRING 3
-
#define MP_CMD_MAX_ARGS 10
// Error codes for the drivers
@@ -115,7 +111,7 @@ enum mp_input_section_flags {
struct input_ctx;
struct mp_cmd_arg {
- int type;
+ struct m_option type;
bool optional;
union {
int i;