From 25a4d10c8e75d9ff94e843d4951ab1eb2917435e Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 22 May 2017 18:30:39 +0200 Subject: player: make sure version information is always included in --log-file If --log-file was used in config files, this could be missing due to the exact timing when the messages are print, and when the options are applied. Fix this by always dumping the version again when a log file is opened. --- common/msg.c | 13 +++++++++++++ common/msg_control.h | 1 + 2 files changed, 14 insertions(+) (limited to 'common') diff --git a/common/msg.c b/common/msg.c index 875d933822..cf2bd5c242 100644 --- a/common/msg.c +++ b/common/msg.c @@ -537,7 +537,20 @@ void mp_msg_force_stderr(struct mpv_global *global, bool force_stderr) { struct mp_log_root *root = global->log->root; + pthread_mutex_lock(&mp_msg_lock); root->force_stderr = force_stderr; + pthread_mutex_unlock(&mp_msg_lock); +} + +bool mp_msg_has_log_file(struct mpv_global *global) +{ + struct mp_log_root *root = global->log->root; + + pthread_mutex_lock(&mp_msg_lock); + bool res = !!root->log_file; + pthread_mutex_unlock(&mp_msg_lock); + + return res; } void mp_msg_uninit(struct mpv_global *global) diff --git a/common/msg_control.h b/common/msg_control.h index 56091fdc2d..4b67190155 100644 --- a/common/msg_control.h +++ b/common/msg_control.h @@ -9,6 +9,7 @@ void mp_msg_uninit(struct mpv_global *global); void mp_msg_update_msglevels(struct mpv_global *global); 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); void mp_msg_flush_status_line(struct mp_log *log); -- cgit v1.2.3