From f8ab59eacdde31af39f4defeb964adf4de140a50 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 21 May 2018 16:25:52 +0200 Subject: player: get rid of mpv_global.opts This was always a legacy thing. Remove it by applying an orgy of mp_get_config_group() calls, and sometimes m_config_cache_alloc() or mp_read_option_raw(). win32 changes untested. --- common/global.h | 4 ---- common/msg.c | 11 ++--------- common/msg_control.h | 3 ++- 3 files changed, 4 insertions(+), 14 deletions(-) (limited to 'common') diff --git a/common/global.h b/common/global.h index 8adc59e02c..f6f83cf68c 100644 --- a/common/global.h +++ b/common/global.h @@ -9,10 +9,6 @@ struct mpv_global { struct m_config_shadow *config; struct mp_client_api *client_api; char *configdir; - - // Using this is deprecated and should be avoided (missing synchronization). - // Use m_config_cache to access mpv_global.config instead. - struct MPOpts *opts; }; #endif diff --git a/common/msg.c b/common/msg.c index b8e89bec31..cb41ea4168 100644 --- a/common/msg.c +++ b/common/msg.c @@ -460,8 +460,6 @@ void mp_msg_init(struct mpv_global *global) struct mp_log *log = mp_log_new(root, &dummy, ""); global->log = log; - - mp_msg_update_msglevels(global); } // If opt is different from *current_path, reopen *file and update *current_path. @@ -501,13 +499,9 @@ static void reopen_file(char *opt, char **current_path, FILE **file, talloc_free(tmp); } -void mp_msg_update_msglevels(struct mpv_global *global) +void mp_msg_update_msglevels(struct mpv_global *global, struct MPOpts *opts) { struct mp_log_root *root = global->log->root; - struct MPOpts *opts = global->opts; - - if (!opts) - return; pthread_mutex_lock(&mp_msg_lock); @@ -522,8 +516,7 @@ void mp_msg_update_msglevels(struct mpv_global *global) } m_option_type_msglevels.free(&root->msg_levels); - m_option_type_msglevels.copy(NULL, &root->msg_levels, - &global->opts->msg_levels); + m_option_type_msglevels.copy(NULL, &root->msg_levels, &opts->msg_levels); atomic_fetch_add(&root->reload_counter, 1); pthread_mutex_unlock(&mp_msg_lock); diff --git a/common/msg_control.h b/common/msg_control.h index 4b67190155..1e41191f6f 100644 --- a/common/msg_control.h +++ b/common/msg_control.h @@ -4,9 +4,10 @@ #include struct mpv_global; +struct MPOpts; void mp_msg_init(struct mpv_global *global); void mp_msg_uninit(struct mpv_global *global); -void mp_msg_update_msglevels(struct mpv_global *global); +void mp_msg_update_msglevels(struct mpv_global *global, struct MPOpts *opts); void mp_msg_force_stderr(struct mpv_global *global, bool force_stderr); bool mp_msg_has_status_line(struct mpv_global *global); bool mp_msg_has_log_file(struct mpv_global *global); -- cgit v1.2.3