From 9f0e7bb9982eef36bf2f14fd750bbe6a359011ba Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 6 Sep 2016 20:09:44 +0200 Subject: input, demux_tv: remove some older option access methods --- demux/demux_tv.c | 4 ++-- input/input.c | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/demux/demux_tv.c b/demux/demux_tv.c index 4f1e3ac1c2..005a693732 100644 --- a/demux/demux_tv.c +++ b/demux/demux_tv.c @@ -25,8 +25,8 @@ static int demux_open_tv(demuxer_t *demuxer, enum demux_check check) if (check > DEMUX_CHECK_REQUEST || demuxer->stream->type != STREAMTYPE_TV) return -1; - tv_param_t *params = m_sub_options_copy(demuxer, &tv_params_conf, - demuxer->opts->tv_params); + tv_param_t *params = mp_get_config_group(demuxer, demuxer->global, + &tv_params_conf); struct tv_stream_params *sparams = demuxer->stream->priv; if (sparams->channel && sparams->channel[0]) { talloc_free(params->channel); diff --git a/input/input.c b/input/input.c index e93fc6ec17..f820b8b174 100644 --- a/input/input.c +++ b/input/input.c @@ -99,6 +99,7 @@ struct input_ctx { sem_t wakeup; struct mp_log *log; struct mpv_global *global; + struct m_config_cache *opts_cache; struct input_opts *opts; bool using_alt_gr; @@ -1201,12 +1202,14 @@ struct input_ctx *mp_input_init(struct mpv_global *global) struct input_ctx *ictx = talloc_ptrtype(NULL, ictx); *ictx = (struct input_ctx){ .global = global, - .opts = talloc_zero(ictx, struct input_opts), // replaced later .ar_state = -1, .log = mp_log_new(ictx, global->log, "input"), .mouse_section = "default", + .opts_cache = m_config_cache_alloc(ictx, global, &input_config), }; + ictx->opts = ictx->opts_cache->opts; + if (sem_init(&ictx->wakeup, 0, 0)) { MP_FATAL(ictx, "mpv doesn't work on systems without POSIX semaphores.\n"); abort(); @@ -1223,11 +1226,9 @@ struct input_ctx *mp_input_init(struct mpv_global *global) void mp_input_load(struct input_ctx *ictx) { - struct input_opts *input_conf = - m_sub_options_copy(ictx, &input_config, ictx->global->opts->input_opts); + struct input_opts *input_conf = ictx->opts; - talloc_free(ictx->opts); - ictx->opts = input_conf; + m_config_cache_update(ictx->opts_cache); // "Uncomment" the default key bindings in etc/input.conf and add them. // All lines that do not start with '# ' are parsed. -- cgit v1.2.3