mirror of
https://github.com/mpv-player/mpv
synced 2024-12-24 07:33:46 +01:00
options: move -noconfig to option struct, simplify
This commit is contained in:
parent
0b59e33b4e
commit
b26fbeddd8
@ -381,7 +381,8 @@ const m_option_t common_opts[] = {
|
||||
{"priority", &proc_priority, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
||||
#endif
|
||||
{"codecpath", &codec_path, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
||||
{"noconfig", (void *) noconfig_opts, CONF_TYPE_SUBCONFIG, CONF_GLOBAL|CONF_NOCFG|CONF_PRE_PARSE, 0, 0, NULL},
|
||||
OPT_CHOICE("noconfig", noconfig, CONF_GLOBAL | CONF_NOCFG | CONF_PRE_PARSE,
|
||||
({"off", 0}, {"user", 1}, {"system", 2}, {"all", 3})),
|
||||
|
||||
// ------------------------- stream options --------------------
|
||||
|
||||
|
19
mpcommon.c
19
mpcommon.c
@ -346,22 +346,3 @@ bool attachment_is_font(struct demux_attachment *att)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Parse -noconfig common to both programs */
|
||||
int disable_system_conf=0;
|
||||
int disable_user_conf=0;
|
||||
|
||||
/* Disable all configuration files */
|
||||
static void noconfig_all(void)
|
||||
{
|
||||
disable_system_conf = 1;
|
||||
disable_user_conf = 1;
|
||||
}
|
||||
|
||||
const m_option_t noconfig_opts[] = {
|
||||
{"all", noconfig_all, CONF_TYPE_FUNC, CONF_GLOBAL|CONF_NOCFG|CONF_PRE_PARSE, 0, 0, NULL},
|
||||
{"system", &disable_system_conf, CONF_TYPE_FLAG, CONF_GLOBAL|CONF_NOCFG|CONF_PRE_PARSE, 0, 1, NULL},
|
||||
{"user", &disable_user_conf, CONF_TYPE_FLAG, CONF_GLOBAL|CONF_NOCFG|CONF_PRE_PARSE, 0, 1, NULL},
|
||||
{NULL, NULL, 0, 0, 0, 0, NULL}
|
||||
};
|
||||
|
||||
|
@ -27,9 +27,6 @@ extern double sub_last_pts;
|
||||
extern struct ass_track *ass_track;
|
||||
extern struct subtitle *vo_sub_last;
|
||||
|
||||
extern int disable_system_conf;
|
||||
extern int disable_user_conf;
|
||||
|
||||
extern const char *mencoder_version;
|
||||
extern const char *mplayer_version;
|
||||
|
||||
|
@ -869,9 +869,10 @@ static int cfg_include(m_option_t *conf, char *filename)
|
||||
|
||||
static void parse_cfgfiles(struct MPContext *mpctx, m_config_t* conf)
|
||||
{
|
||||
struct MPOpts *opts = &mpctx->opts;
|
||||
char *conffile;
|
||||
int conffile_fd;
|
||||
if (!disable_system_conf &&
|
||||
if (!(opts->noconfig & 2) &&
|
||||
m_config_parse_config_file(conf, MPLAYER_CONFDIR "/mplayer.conf") < 0)
|
||||
exit_player(mpctx, EXIT_NONE);
|
||||
if ((conffile = get_path("")) == NULL) {
|
||||
@ -891,7 +892,7 @@ if ((conffile = get_path("")) == NULL) {
|
||||
write(conffile_fd, default_config, strlen(default_config));
|
||||
close(conffile_fd);
|
||||
}
|
||||
if (!disable_user_conf &&
|
||||
if (!(opts->noconfig & 1) &&
|
||||
m_config_parse_config_file(conf, conffile) < 0)
|
||||
exit_player(mpctx, EXIT_NONE);
|
||||
free(conffile);
|
||||
|
Loading…
Reference in New Issue
Block a user