summaryrefslogtreecommitdiffstats
path: root/options
diff options
context:
space:
mode:
Diffstat (limited to 'options')
-rw-r--r--options/m_config.c26
-rw-r--r--options/m_config.h10
2 files changed, 31 insertions, 5 deletions
diff --git a/options/m_config.c b/options/m_config.c
index c6c1bf9af1..7cc9a46792 100644
--- a/options/m_config.c
+++ b/options/m_config.c
@@ -676,9 +676,11 @@ static int handle_set_opt_flags(struct m_config *config,
return set ? 2 : 1;
}
-// The type data points to is as in: co->opt
-int m_config_set_option_raw(struct m_config *config, struct m_config_option *co,
- void *data, int flags)
+// Unlike m_config_set_option_raw() this does not go through the property layer
+// via config.option_set_callback.
+int m_config_set_option_raw_direct(struct m_config *config,
+ struct m_config_option *co,
+ void *data, int flags)
{
if (!co)
return M_OPT_UNKNOWN;
@@ -702,6 +704,24 @@ int m_config_set_option_raw(struct m_config *config, struct m_config_option *co,
return 0;
}
+// Similar to m_config_set_option_ext(), but set as data in its native format.
+// This takes care of some details like sending change notifications.
+// The type data points to is as in: co->opt
+int m_config_set_option_raw(struct m_config *config, struct m_config_option *co,
+ void *data, int flags)
+{
+ if (config->option_set_callback) {
+ int r = handle_set_opt_flags(config, co, flags);
+ if (r <= 1)
+ return r;
+
+ return config->option_set_callback(config->option_set_callback_cb,
+ co, data, flags);
+ } else {
+ return m_config_set_option_raw_direct(config, co, data, flags);
+ }
+}
+
static int parse_subopts(struct m_config *config, char *name, char *prefix,
struct bstr param, int flags);
diff --git a/options/m_config.h b/options/m_config.h
index e7c095623b..9440bd5833 100644
--- a/options/m_config.h
+++ b/options/m_config.h
@@ -77,6 +77,10 @@ typedef struct m_config {
int (*includefunc)(void *ctx, char *filename, int flags);
void *includefunc_ctx;
+ int (*option_set_callback)(void *ctx, struct m_config_option *co,
+ void *data, int flags);
+ void *option_set_callback_cb;
+
// For the command line parser
int recursion_depth;
@@ -170,11 +174,13 @@ static inline int m_config_set_option0(struct m_config *config,
return m_config_set_option(config, bstr0(name), bstr0(param));
}
-// Similar to m_config_set_option_ext(), but set as data in its native format.
-// The type data points to is as in co->opt
int m_config_set_option_raw(struct m_config *config, struct m_config_option *co,
void *data, int flags);
+int m_config_set_option_raw_direct(struct m_config *config,
+ struct m_config_option *co,
+ void *data, int flags);
+
// Similar to m_config_set_option_ext(), but set as data using mpv_node.
struct mpv_node;
int m_config_set_option_node(struct m_config *config, bstr name,