summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2011-01-11 17:28:10 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2011-01-11 17:28:10 +0200
commitb26fbeddd85aae6cda93d01335bed5f108a3ff57 (patch)
tree5f188a36267498b116eef50a60c8ca1f7f480822
parent0b59e33b4e17fae9e0c318fcfeabba52e57dda4a (diff)
downloadmpv-b26fbeddd85aae6cda93d01335bed5f108a3ff57.tar.bz2
mpv-b26fbeddd85aae6cda93d01335bed5f108a3ff57.tar.xz
options: move -noconfig to option struct, simplify
-rw-r--r--cfg-common.h3
-rw-r--r--mpcommon.c19
-rw-r--r--mpcommon.h3
-rw-r--r--mplayer.c5
-rw-r--r--options.h1
5 files changed, 6 insertions, 25 deletions
diff --git a/cfg-common.h b/cfg-common.h
index 7657864f02..e71ec8c0df 100644
--- a/cfg-common.h
+++ b/cfg-common.h
@@ -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 --------------------
diff --git a/mpcommon.c b/mpcommon.c
index 2fa7b6d0a8..a5e71b839e 100644
--- a/mpcommon.c
+++ b/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}
-};
-
diff --git a/mpcommon.h b/mpcommon.h
index f1f01d7942..5f11c5e458 100644
--- a/mpcommon.h
+++ b/mpcommon.h
@@ -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;
diff --git a/mplayer.c b/mplayer.c
index 893ae77694..6565f75904 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -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);
diff --git a/options.h b/options.h
index 12ac475f9e..0fb0a7d809 100644
--- a/options.h
+++ b/options.h
@@ -39,6 +39,7 @@ typedef struct MPOpts {
int ordered_chapters;
int chapter_merge_threshold;
int quiet;
+ int noconfig;
float stream_cache_min_percent;
float stream_cache_seek_min_percent;
int chapterrange[2];