summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-09-02 15:45:22 +0200
committerwm4 <wm4@nowhere>2016-09-02 15:50:40 +0200
commit423e53ba0bad034685e5229720d55548afb1efbe (patch)
tree08c8ed2d32f7c7ed88b3d468d09249adec6017ee /common
parentf2e25e9e1f5aa28689d152d7a7cb4c39bdac9c82 (diff)
downloadmpv-423e53ba0bad034685e5229720d55548afb1efbe.tar.bz2
mpv-423e53ba0bad034685e5229720d55548afb1efbe.tar.xz
m_config: introduce basic mechanism to synchronize global option updates
The way option runtime changes are handled is pretty bad in the current codebase. There's a big option struct (MPOpts), which contains almost everything, and for which no synchronization mechanism exists. This was handled by either making some options read-only after initialization, duplicating the option struct, using sub-options (in the VO), and so on. Introduce a mechanism that creates a copy of the global options (or parts of it), and provides a well-defined way to update them in a thread-safe way. Most code can remain the same, just that all the component glue code has to explicitly make use of it first. There is still lots of room for improvement. For example, the update mechanism could be better.
Diffstat (limited to 'common')
-rw-r--r--common/global.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/common/global.h b/common/global.h
index fb70b4ff01..879ca72386 100644
--- a/common/global.h
+++ b/common/global.h
@@ -5,9 +5,13 @@
// The only purpose of this is to make mpv library-safe.
// Think hard before adding new members.
struct mpv_global {
- struct MPOpts *opts;
struct mp_log *log;
+ struct m_config_shadow *config;
struct mp_client_api *client_api;
+
+ // Using this is deprecated and should be avoided (missing synchronization).
+ // Use m_config_cache to access mpv_global.config instead.
+ struct MPOpts *opts;
};
#endif