From b81ae52f508fa1e4447e97223f79f4c59ff99197 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 29 Sep 2016 16:26:54 +0200 Subject: player: enable reading from stdin after loading input.conf Someone requested this. --- player/command.c | 2 +- player/core.h | 2 +- player/main.c | 11 ++++++----- 3 files changed, 8 insertions(+), 7 deletions(-) (limited to 'player') diff --git a/player/command.c b/player/command.c index 9b771a2e1d..7c0cfb82ee 100644 --- a/player/command.c +++ b/player/command.c @@ -5668,7 +5668,7 @@ void mp_option_change_callback(void *ctx, struct m_config_option *co, int flags) struct command_ctx *cmd = mpctx->command_ctx; if (flags & UPDATE_TERM) - mp_update_logging(mpctx); + mp_update_logging(mpctx, false); if (mpctx->video_out) { if (flags & UPDATE_VIDEOPOS) diff --git a/player/core.h b/player/core.h index 53e6e6f99c..770df4aa6e 100644 --- a/player/core.h +++ b/player/core.h @@ -486,7 +486,7 @@ int mp_initialize(struct MPContext *mpctx, char **argv); struct MPContext *mp_create(void); void mp_destroy(struct MPContext *mpctx); void mp_print_version(struct mp_log *log, int always); -void mp_update_logging(struct MPContext *mpctx); +void mp_update_logging(struct MPContext *mpctx, bool preinit); // misc.c double rel_time_to_abs(struct MPContext *mpctx, struct m_rel_time t); diff --git a/player/main.c b/player/main.c index 7dcc266094..1f32d375bd 100644 --- a/player/main.c +++ b/player/main.c @@ -112,7 +112,7 @@ static bool cas_terminal_owner(struct MPContext *old, struct MPContext *new) return r; } -void mp_update_logging(struct MPContext *mpctx) +void mp_update_logging(struct MPContext *mpctx, bool preinit) { mp_msg_update_msglevels(mpctx->global); @@ -121,13 +121,14 @@ void mp_update_logging(struct MPContext *mpctx) if (enable != enabled) { if (enable && cas_terminal_owner(NULL, mpctx)) { terminal_init(); + enabled = true; } else if (!enable) { terminal_uninit(); cas_terminal_owner(mpctx, NULL); } } - if (cas_terminal_owner(mpctx, mpctx) && mpctx->opts->consolecontrols) + if (enabled && !preinit && mpctx->opts->consolecontrols) terminal_setup_getch(mpctx->input); } @@ -384,7 +385,7 @@ int mp_initialize(struct MPContext *mpctx, char **options) if (options) m_config_preparse_command_line(mpctx->mconfig, mpctx->global, options); - mp_update_logging(mpctx); + mp_update_logging(mpctx, true); if (options) { MP_VERBOSE(mpctx, "Command line options:"); @@ -412,6 +413,8 @@ int mp_initialize(struct MPContext *mpctx, char **options) mp_get_resume_defaults(mpctx); + mp_input_load_config(mpctx->input); + // From this point on, all mpctx members are initialized. mpctx->initialized = true; mpctx->mconfig->option_set_callback = mp_on_set_option; @@ -443,8 +446,6 @@ int mp_initialize(struct MPContext *mpctx, char **options) MP_STATS(mpctx, "start init"); - mp_input_load_config(mpctx->input); - #if HAVE_ENCODING if (opts->encode_opts->file && opts->encode_opts->file[0]) { mpctx->encode_lavc_ctx = encode_lavc_init(opts->encode_opts, -- cgit v1.2.3