1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-28 10:02:17 +00:00

options: kill M_OPT_GLOBAL flag

This meant "cannot be used as per-file option" (wrt. playlist items).
Doesn't make too much sense anymore, especially given how obscure
per-file options are.
This commit is contained in:
wm4 2016-09-17 17:04:13 +02:00
parent 4395a4f837
commit 7fa26bfd9c
3 changed files with 7 additions and 21 deletions

View File

@ -350,8 +350,6 @@ static void ensure_backup(struct m_config *config, struct m_config_option *co)
{
if (co->opt->type->flags & M_OPT_TYPE_HAS_CHILD)
return;
if (co->opt->flags & M_OPT_GLOBAL)
return;
if (!co->data)
return;
for (struct m_opt_backup *cur = config->backup_opts; cur; cur = cur->next) {
@ -671,15 +669,8 @@ static int handle_set_opt_flags(struct m_config *config,
co->name);
return M_OPT_INVALID;
}
if (flags & M_SETOPT_BACKUP) {
if (optflags & M_OPT_GLOBAL) {
MP_ERR(config, "The %s option is global and can't be set per-file.\n",
co->name);
return M_OPT_INVALID;
}
if (set)
ensure_backup(config, co);
}
if ((flags & M_SETOPT_BACKUP) && set)
ensure_backup(config, co);
return set ? 2 : 1;
}
@ -979,8 +970,6 @@ void m_config_print_option_list(const struct m_config *config, const char *name)
MP_INFO(config, " (default: %s)", def);
talloc_free(def);
}
if (opt->flags & M_OPT_GLOBAL)
MP_INFO(config, " [global]");
if (opt->flags & M_OPT_NOCFG)
MP_INFO(config, " [nocfg]");
if (opt->flags & M_OPT_FILE)

View File

@ -360,9 +360,6 @@ struct m_option {
// The option is forbidden in config files.
#define M_OPT_NOCFG (1 << 2)
// This option can't be set per-file when used with struct m_config.
#define M_OPT_GLOBAL (1 << 4)
// Can not be freely changed at runtime (normally, all options can be changed,
// even if the settings don't get effective immediately). Note that an option
// might still change even if this is set, e.g. via properties or per-file
@ -386,7 +383,7 @@ struct m_option {
#define CONF_MAX M_OPT_MAX
#define CONF_RANGE M_OPT_RANGE
#define CONF_NOCFG M_OPT_NOCFG
#define CONF_GLOBAL (M_OPT_GLOBAL | M_OPT_FIXED)
#define CONF_GLOBAL M_OPT_FIXED
#define CONF_PRE_PARSE M_OPT_PRE_PARSE
// These flags are used to describe special parser capabilities or behavior.
@ -686,7 +683,7 @@ extern const char m_option_path_separator;
#define OPT_PRINT(optname, fn) \
{.name = optname, \
.flags = M_OPT_FIXED | M_OPT_GLOBAL | M_OPT_NOCFG | M_OPT_PRE_PARSE, \
.flags = M_OPT_FIXED | M_OPT_NOCFG | M_OPT_PRE_PARSE, \
.type = &m_option_type_print_fn, \
.priv = MP_EXPECT_TYPE(m_opt_print_fn, fn), \
.offset = -1}

View File

@ -277,11 +277,11 @@ const m_option_t mp_opts[] = {
OPT_FLAG("config", load_config, CONF_GLOBAL | CONF_PRE_PARSE),
OPT_STRING("config-dir", force_configdir,
CONF_GLOBAL | CONF_NOCFG | CONF_PRE_PARSE),
OPT_STRINGLIST("reset-on-next-file", reset_options, M_OPT_GLOBAL),
OPT_STRINGLIST("reset-on-next-file", reset_options, 0),
#if HAVE_LUA
OPT_STRINGLIST("script", script_files, CONF_GLOBAL | M_OPT_FILE),
OPT_KEYVALUELIST("script-opts", script_opts, M_OPT_GLOBAL),
OPT_KEYVALUELIST("script-opts", script_opts, 0),
OPT_FLAG("osc", lua_load_osc, CONF_GLOBAL),
OPT_FLAG("ytdl", lua_load_ytdl, CONF_GLOBAL),
OPT_STRING("ytdl-format", lua_ytdl_format, CONF_GLOBAL),
@ -650,7 +650,7 @@ const m_option_t mp_opts[] = {
OPT_FLAG("input-terminal", consolecontrols, CONF_GLOBAL),
OPT_STRING("input-file", input_file, M_OPT_FILE | M_OPT_GLOBAL),
OPT_STRING("input-file", input_file, M_OPT_FILE),
OPT_STRING("input-ipc-server", ipc_path, M_OPT_FILE | M_OPT_FIXED),
OPT_SUBSTRUCT("screenshot", screenshot_image_opts, screenshot_conf, 0),