summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/man/input.rst12
-rw-r--r--player/command.c26
2 files changed, 38 insertions, 0 deletions
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst
index 651b93f7c3..21d0751447 100644
--- a/DOCS/man/input.rst
+++ b/DOCS/man/input.rst
@@ -1438,6 +1438,18 @@ Property list
access the local value, and the ``old`` value, which will be restored on
end of playback, can not be read or written until end of playback.)
+``option-flags/<name>``
+ Minor additional per-option information.
+
+ This has a number of sub-properties. Replace ``<name>`` with the name of
+ a top-level option.
+
+ ``option-flags/<name>/set-from-commandline``
+
+ Return ``yes`` if the option was set from the mpv command line,
+ ``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).
+
``property-list``
Return the list of top-level properties.
diff --git a/player/command.c b/player/command.c
index 27ba3244a1..198ed64242 100644
--- a/player/command.c
+++ b/player/command.c
@@ -3001,6 +3001,31 @@ static int mp_property_local_options(void *ctx, struct m_property *prop,
return access_option_list(action, arg, true, mpctx);
}
+static int mp_property_option_flags(void *ctx, struct m_property *prop,
+ int action, void *arg)
+{
+ MPContext *mpctx = ctx;
+ switch (action) {
+ case M_PROPERTY_KEY_ACTION: {
+ struct m_property_action_arg *ka = arg;
+ bstr key;
+ char *rem;
+ m_property_split_path(ka->key, &key, &rem);
+ struct m_config_option *co = m_config_get_co(mpctx->mconfig, key);
+ if (!co)
+ return M_PROPERTY_UNKNOWN;
+
+ struct m_sub_property props[] = {
+ {"set-from-commandline", SUB_PROP_FLAG(co->is_set_from_cmdline)},
+ {0}
+ };
+
+ return m_property_read_sub(props, ka->action, ka->arg);
+ }
+ }
+ return M_PROPERTY_NOT_IMPLEMENTED;
+}
+
static const struct m_property mp_properties[];
static int mp_property_list(void *ctx, struct m_property *prop,
@@ -3212,6 +3237,7 @@ static const struct m_property mp_properties[] = {
{"options", mp_property_options},
{"file-local-options", mp_property_local_options},
+ {"option-flags", mp_property_option_flags},
{"property-list", mp_property_list},
{0},