diff options
author | wm4 <wm4@nowhere> | 2013-07-27 21:26:00 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-07-28 18:44:21 +0200 |
commit | c070fa865fcf75cace05bf492a68f6a2c6137fb3 (patch) | |
tree | 87cdc963094ed5604121d5f2f6e354cf52503c1e /core/options.c | |
parent | da2b4aa5870f407ad322b6116ed8d66a66dbeadf (diff) | |
download | mpv-c070fa865fcf75cace05bf492a68f6a2c6137fb3.tar.bz2 mpv-c070fa865fcf75cace05bf492a68f6a2c6137fb3.tar.xz |
m_config: refactor some things
Change how m_config is initialized. Make it more uniform; now all
m_config structs are intialized in exactly the same way. Make sure
there's only a single m_option[] array defining the options, and keep
around the pointer to the optstruct default value, and the optstruct
size as well. This will allow reconstructing the option default values
in the following commit.
In particular, stop pretending that the handling of some special options
(like --profile, --v, and some others) is in any way elegant, and make
them explicit hacks. This is really more readable and easier to
understand than what was before, and simplifies the code.
Diffstat (limited to 'core/options.c')
-rw-r--r-- | core/options.c | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/core/options.c b/core/options.c index dd517dbb22..ee4f783b35 100644 --- a/core/options.c +++ b/core/options.c @@ -313,12 +313,30 @@ static const m_option_t screenshot_conf[] = { extern const m_option_t lavc_decode_opts_conf[]; extern const m_option_t ad_lavc_decode_opts_conf[]; +extern const m_option_t mp_input_opts[]; + const m_option_t mp_opts[] = { + // handled in command line pre-parser (parser-mpcmd.c) + {"v", NULL, CONF_TYPE_STORE, CONF_GLOBAL | CONF_NOCFG, 0, 0, NULL}, + + // handled in command line parser (parser-mpcmd.c) + {"playlist", NULL, CONF_TYPE_STRING, CONF_NOCFG | M_OPT_MIN, 1, 0, NULL}, + {"shuffle", NULL, CONF_TYPE_FLAG, CONF_NOCFG, 0, 0, NULL}, + {"{", NULL, CONF_TYPE_STORE, CONF_NOCFG, 0, 0, NULL}, + {"}", NULL, CONF_TYPE_STORE, CONF_NOCFG, 0, 0, NULL}, + + // handled in m_config.c + { "include", NULL, CONF_TYPE_STRING }, + { "profile", NULL, CONF_TYPE_STRING_LIST }, + { "show-profile", NULL, CONF_TYPE_STRING, CONF_NOCFG }, + { "list-options", NULL, CONF_TYPE_STORE, CONF_NOCFG }, + + // handled in mplayer.c (looks at the raw argv[]) + {"leak-report", "", CONF_TYPE_STORE, CONF_GLOBAL | CONF_NOCFG }, + // ------------------------- common options -------------------- OPT_FLAG("quiet", quiet, CONF_GLOBAL), {"really-quiet", &verbose, CONF_TYPE_STORE, CONF_GLOBAL|CONF_PRE_PARSE, 0, -10, NULL}, - // -v is handled in command line preparser - {"v", NULL, CONF_TYPE_STORE, CONF_GLOBAL | CONF_NOCFG, 0, 0, NULL}, {"msglevel", (void *) msgl_config, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL}, {"msgcolor", &mp_msg_color, CONF_TYPE_FLAG, CONF_GLOBAL | CONF_PRE_PARSE, 0, 1, NULL}, {"msgmodule", &mp_msg_module, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL}, @@ -630,17 +648,10 @@ const m_option_t mp_opts[] = { {"lircconf", &lirc_configfile, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL}, #endif - {"leak-report", "", CONF_TYPE_PRINT, 0, 0, 0, (void*)1}, - OPT_CHOICE_OR_INT("loop", loop_times, M_OPT_GLOBAL, 1, 10000, ({"no", -1}, {"0", -1}, {"inf", 0})), - {"playlist", NULL, CONF_TYPE_STRING, CONF_NOCFG | M_OPT_MIN, 1, 0, NULL}, - {"shuffle", NULL, CONF_TYPE_FLAG, CONF_NOCFG, 0, 0, NULL}, - {"{", NULL, CONF_TYPE_STORE, CONF_NOCFG, 0, 0, NULL}, - {"}", NULL, CONF_TYPE_STORE, CONF_NOCFG, 0, 0, NULL}, - OPT_FLAG("resume-playback", position_resume, 0), OPT_FLAG("save-position-on-quit", position_save_on_quit, 0), @@ -682,6 +693,8 @@ const m_option_t mp_opts[] = { {"screenshot", (void *) screenshot_conf, CONF_TYPE_SUBCONFIG}, + {"", (void *) mp_input_opts, CONF_TYPE_SUBCONFIG}, + OPT_FLAG("list-properties", list_properties, CONF_GLOBAL), {"identify", &mp_msg_levels[MSGT_IDENTIFY], CONF_TYPE_FLAG, CONF_GLOBAL, 0, MSGL_V, NULL}, {"help", (void *) mp_help_text, CONF_TYPE_PRINT, CONF_NOCFG|CONF_GLOBAL, 0, 0, NULL}, |