summaryrefslogtreecommitdiffstats
path: root/options/m_config.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-11-28 21:59:39 +0100
committerwm4 <wm4@nowhere>2019-11-29 12:14:43 +0100
commitf73881fa10e3ba1e43d3a8b984379533c0c40284 (patch)
tree7bb16052e4d332586d958d09a12cd419395c1bd7 /options/m_config.h
parent591494b271f17c4bfae0cfb860ae12bdad98a2ca (diff)
downloadmpv-f73881fa10e3ba1e43d3a8b984379533c0c40284.tar.bz2
mpv-f73881fa10e3ba1e43d3a8b984379533c0c40284.tar.xz
m_config: allow writing options through m_config_cache
This will allow any other threads to write to the global option data in a safe way. The typical example for this is the fullscreen option, which needs to be written by VO (or even some other thing running completely separate from the main thread). We have a complicated and annoying contraption which gets the value updated on the main thread, and this function will help get rid of it. As of this commit, this doesn't really work yet, because he main thread uses its own weird copy of the option data.
Diffstat (limited to 'options/m_config.h')
-rw-r--r--options/m_config.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/options/m_config.h b/options/m_config.h
index e2dcc0e51c..0f05e117a3 100644
--- a/options/m_config.h
+++ b/options/m_config.h
@@ -338,6 +338,20 @@ bool m_config_cache_update(struct m_config_cache *cache);
// returns: *out_ptr!=NULL (true if there was a changed option)
bool m_config_cache_get_next_changed(struct m_config_cache *cache, void **out_ptr);
+// Copy the option field pointed to by ptr to the global option storage. This
+// is sort of similar to m_config_set_option_raw(), except doesn't require
+// access to the main thread. (And you can't pass any flags.)
+// You write the new value to the option struct, and then call this function
+// with the pointer to it. You will not get a change notification for it (though
+// you might still get a redundant wakeup callback).
+// Changing the option struct and not calling this function before any update
+// function (like m_config_cache_update()) will leave the value inconsistent,
+// and will possibly (but not necessarily) overwrite it with the next update
+// call.
+// ptr: points to any field in cache->opts that is managed by an option. If
+// this is not the case, the function crashes for your own good.
+void m_config_cache_write_opt(struct m_config_cache *cache, void *ptr);
+
// Like m_config_cache_alloc(), but return the struct (m_config_cache->opts)
// directly, with no way to update the config. Basically this returns a copy
// with a snapshot of the current option values.