diff options
author | wm4 <wm4@nowhere> | 2013-11-28 19:04:16 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-11-28 19:04:16 +0100 |
commit | 5318a1bea1e477033cd355e19be366f0504222e9 (patch) | |
tree | 23d400653b1bed44eb4901d72f57accbf8d6e5da /mpvcore/m_option.h | |
parent | 5411fbdb2341433dfa3241034390c19c257ce57e (diff) | |
download | mpv-5318a1bea1e477033cd355e19be366f0504222e9.tar.bz2 mpv-5318a1bea1e477033cd355e19be366f0504222e9.tar.xz |
input: use separate type for command definitions
Introduce a mp_cmd_def struct to define commands, instead of using
mp_cmd for this. This way each command parameter can be a m_option,
instead of m_option plus some more stuff.
Define the ARG_ macros directly in terms of the OPT_ macros. Not sure if
this makes it easier to read (maybe not, even if it looks simpler), but
at least it makes it easier to add other option types.
Another idea was adding a name for each parameter (so you could have
named parameters), but not today.
Diffstat (limited to 'mpvcore/m_option.h')
-rw-r--r-- | mpvcore/m_option.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/mpvcore/m_option.h b/mpvcore/m_option.h index 5e3184a964..684fc2c715 100644 --- a/mpvcore/m_option.h +++ b/mpvcore/m_option.h @@ -503,8 +503,10 @@ int m_option_required_params(const m_option_t *opt); #define OPTION_PATH_SEPARATOR ':' #endif -#define OPTDEF_STR(s) .defval = (void *)&(char * const){s} -#define OPTDEF_INT(i) .defval = (void *)&(const int){i} +#define OPTDEF_STR(s) .defval = (void *)&(char * const){s} +#define OPTDEF_INT(i) .defval = (void *)&(const int){i} +#define OPTDEF_FLOAT(f) .defval = (void *)&(const float){f} +#define OPTDEF_DOUBLE(d) .defval = (void *)&(const double){d} #define OPT_GENERAL(ctype, optname, varname, flagv, ...) \ {.name = optname, .flags = flagv, .is_new_option = 1, \ |