summaryrefslogtreecommitdiffstats
path: root/options/m_config.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-09-02 15:58:15 +0200
committerwm4 <wm4@nowhere>2016-09-02 15:58:15 +0200
commit72c6bf1345235801dc8916a907360fd7e2514933 (patch)
tree7d8405e476d821e0222b63570ff1581300e9d96b /options/m_config.c
parent2c917219cffc74fcc64f04113fe260f2b88d5841 (diff)
downloadmpv-72c6bf1345235801dc8916a907360fd7e2514933.tar.bz2
mpv-72c6bf1345235801dc8916a907360fd7e2514933.tar.xz
m_config: add some convenience functions
To be used by the following commits.
Diffstat (limited to 'options/m_config.c')
-rw-r--r--options/m_config.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/options/m_config.c b/options/m_config.c
index 25b7d75c7f..19eb61d082 100644
--- a/options/m_config.c
+++ b/options/m_config.c
@@ -1143,6 +1143,27 @@ void m_config_notify_change_co(struct m_config *config,
mp_msg_update_msglevels(config->global);
}
+void *mp_get_config_group(void *ta_parent, struct mpv_global *global,
+ const struct m_sub_options *group)
+{
+ assert(ta_parent); // without you'd necessarily leak memory
+ struct m_config_cache *cache = m_config_cache_alloc(ta_parent, global, group);
+ return cache->opts;
+}
+
+void mp_read_option_raw(struct mpv_global *global, const char *name,
+ const struct m_option_type *type, void *dst)
+{
+ struct m_config_shadow *shadow = global->config;
+ struct m_config_option *co = m_config_get_co(shadow->root, bstr0(name));
+ assert(co);
+ assert(co->shadow_offset >= 0);
+ assert(co->opt->type == type);
+
+ memset(dst, 0, co->opt->type->size);
+ m_option_copy(co->opt, dst, shadow->data + co->shadow_offset);
+}
+
struct m_config *mp_get_root_config(struct mpv_global *global)
{
return global->config->root;