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. --- input/input.c | 7 +++++-- input/ipc-unix.c | 7 +++++-- input/ipc-win.c | 5 ++++- 3 files changed, 14 insertions(+), 5 deletions(-) (limited to 'input') diff --git a/input/input.c b/input/input.c index c8f1a64ad5..9e96da267d 100644 --- a/input/input.c +++ b/input/input.c @@ -1370,8 +1370,11 @@ void mp_input_load_config(struct input_ctx *ictx) } #if HAVE_WIN32_PIPES - if (ictx->global->opts->input_file && *ictx->global->opts->input_file) - mp_input_pipe_add(ictx, ictx->global->opts->input_file); + char *ifile; + mp_read_option_raw(ictx->global, "input-file", &m_option_type_string, &ifile); + if (ifile && ifile[0]) + mp_input_pipe_add(ictx, ifile); + talloc_free(ifile); #endif input_unlock(ictx); diff --git a/input/ipc-unix.c b/input/ipc-unix.c index 778f2f1e46..d39623fe4f 100644 --- a/input/ipc-unix.c +++ b/input/ipc-unix.c @@ -36,6 +36,7 @@ #include "common/msg.h" #include "input/input.h" #include "libmpv/client.h" +#include "options/m_config.h" #include "options/options.h" #include "options/path.h" #include "player/client.h" @@ -386,7 +387,7 @@ done: struct mp_ipc_ctx *mp_init_ipc(struct mp_client_api *client_api, struct mpv_global *global) { - struct MPOpts *opts = global->opts; + struct MPOpts *opts = mp_get_config_group(NULL, global, GLOBAL_CONFIG); struct mp_ipc_ctx *arg = talloc_ptrtype(NULL, arg); *arg = (struct mp_ipc_ctx){ @@ -397,10 +398,12 @@ struct mp_ipc_ctx *mp_init_ipc(struct mp_client_api *client_api, }; char *input_file = mp_get_user_path(arg, global, opts->input_file); + talloc_free(opts); + if (input_file && *input_file) ipc_start_client_text(arg, input_file); - if (!opts->ipc_path || !*opts->ipc_path) + if (!arg->path || !arg->path[0]) goto out; if (mp_make_wakeup_pipe(arg->death_pipe) < 0) diff --git a/input/ipc-win.c b/input/ipc-win.c index 3cbdad3749..8bfbaf409b 100644 --- a/input/ipc-win.c +++ b/input/ipc-win.c @@ -29,6 +29,7 @@ #include "common/msg.h" #include "input/input.h" #include "libmpv/client.h" +#include "options/m_config.h" #include "options/options.h" #include "player/client.h" @@ -449,7 +450,7 @@ done: struct mp_ipc_ctx *mp_init_ipc(struct mp_client_api *client_api, struct mpv_global *global) { - struct MPOpts *opts = global->opts; + struct MPOpts *opts = mp_get_config_group(NULL, global, GLOBAL_CONFIG); struct mp_ipc_ctx *arg = talloc_ptrtype(NULL, arg); *arg = (struct mp_ipc_ctx){ @@ -478,12 +479,14 @@ struct mp_ipc_ctx *mp_init_ipc(struct mp_client_api *client_api, if (pthread_create(&arg->thread, NULL, ipc_thread, arg)) goto out; + talloc_free(opts); return arg; out: if (arg->death_event) CloseHandle(arg->death_event); talloc_free(arg); + talloc_free(opts); return NULL; } -- cgit v1.2.3