summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-07-23 22:59:04 +0200
committerwm4 <wm4@nowhere>2015-07-23 22:59:04 +0200
commit3cbf68b47079df130d2a767da7f6af352202112c (patch)
tree588c6ca85a5d20a0768fc73ccedf9e4918f4afb1
parent86a60a4dd22a717a069346acf4a6171837fb01b3 (diff)
downloadmpv-3cbf68b47079df130d2a767da7f6af352202112c.tar.bz2
mpv-3cbf68b47079df130d2a767da7f6af352202112c.tar.xz
command: add property indicating per-file options
Fixes #2165, more or less.
-rw-r--r--DOCS/interface-changes.rst1
-rw-r--r--DOCS/man/input.rst6
-rw-r--r--options/m_config.c2
-rw-r--r--options/m_config.h1
-rw-r--r--player/command.c1
5 files changed, 11 insertions, 0 deletions
diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst
index cad78108fb..79b8327f82 100644
--- a/DOCS/interface-changes.rst
+++ b/DOCS/interface-changes.rst
@@ -20,6 +20,7 @@ Interface changes
::
--- mpv 0.10.0 will be released ---
+ - add "option-info/<name>/set-locally" property
- add --cache-backbuffer; change --cache-default default to 75MB
the new total cache size is the sum of backbuffer and the cache size
specified by --cache-default or --cache
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst
index e46d802888..14c1f3f5fa 100644
--- a/DOCS/man/input.rst
+++ b/DOCS/man/input.rst
@@ -1872,6 +1872,12 @@ Property list
``no`` otherwise. What this is set to if the option is e.g. changed
at runtime is left undefined (meaning it could change in the future).
+ ``option-info/<name>/set-locally``
+ Return ``yes`` if the option was set per-file. This is the case with
+ automatically loaded profiles, file-dir configs, and other cases. It
+ means the option value will be restored to the value before playback
+ start when playback ends.
+
``option-info/<name>/default-value``
The default value of the option. May not always be available.
diff --git a/options/m_config.c b/options/m_config.c
index e513019c59..030c144dfc 100644
--- a/options/m_config.c
+++ b/options/m_config.c
@@ -272,6 +272,7 @@ static void ensure_backup(struct m_config *config, struct m_config_option *co)
m_option_copy(co->opt, bc->backup, co->data);
bc->next = config->backup_opts;
config->backup_opts = bc;
+ co->is_set_locally = true;
}
void m_config_restore_backups(struct m_config *config)
@@ -282,6 +283,7 @@ void m_config_restore_backups(struct m_config *config)
m_option_copy(bc->co->opt, bc->co->data, bc->backup);
m_option_free(bc->co->opt, bc->backup);
+ bc->co->is_set_locally = false;
talloc_free(bc);
}
}
diff --git a/options/m_config.h b/options/m_config.h
index 4b29c9cde3..89f620b6d3 100644
--- a/options/m_config.h
+++ b/options/m_config.h
@@ -39,6 +39,7 @@ struct mp_log;
struct m_config_option {
bool is_generated : 1; // Automatically added ("no-" options)
bool is_set_from_cmdline : 1; // Set by user from command line
+ bool is_set_locally : 1; // Has a backup entry
bool warning_was_printed : 1;
const char *name; // Full name (ie option-subopt)
const struct m_option *opt; // Option description
diff --git a/player/command.c b/player/command.c
index 8e78099dfb..bc9031ebb3 100644
--- a/player/command.c
+++ b/player/command.c
@@ -3261,6 +3261,7 @@ static int mp_property_option_info(void *ctx, struct m_property *prop,
{"name", SUB_PROP_STR(co->name)},
{"type", SUB_PROP_STR(opt->type->name)},
{"set-from-commandline", SUB_PROP_FLAG(co->is_set_from_cmdline)},
+ {"set-locally", SUB_PROP_FLAG(co->is_set_locally)},
{"default-value", *opt, def},
{"min", SUB_PROP_DOUBLE(opt->min),
.unavailable = !(has_minmax && (opt->flags & M_OPT_MIN))},