path: root/player/main.c
diff options
authorwm4 <wm4@nowhere>2016-09-02 15:45:22 +0200
committerwm4 <wm4@nowhere>2016-09-02 15:50:40 +0200
commit423e53ba0bad034685e5229720d55548afb1efbe (patch)
tree08c8ed2d32f7c7ed88b3d468d09249adec6017ee /player/main.c
parentf2e25e9e1f5aa28689d152d7a7cb4c39bdac9c82 (diff)
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 'player/main.c')
1 files changed, 1 insertions, 0 deletions
diff --git a/player/main.c b/player/main.c
index 6acb617520..b60c522cb0 100644
--- a/player/main.c
+++ b/player/main.c
@@ -364,6 +364,7 @@ struct MPContext *mp_create(void)
mpctx->mconfig->is_toplevel = true;
mpctx->mconfig->global = mpctx->global;
m_config_parse(mpctx->mconfig, "", bstr0(def_config), NULL, 0);
+ m_config_create_shadow(mpctx->mconfig);
mpctx->global->opts = mpctx->opts;