1
mirror of https://github.com/mpv-player/mpv synced 2024-11-07 01:47:00 +01:00
mpv/common/global.h
wm4 423e53ba0b 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.
2016-09-02 15:50:40 +02:00

18 lines
499 B
C

#ifndef MPV_MPV_H
#define MPV_MPV_H
// This should be accessed by glue code only, never normal code.
// The only purpose of this is to make mpv library-safe.
// Think hard before adding new members.
struct mpv_global {
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