summaryrefslogtreecommitdiffstats
path: root/options/m_config.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-11-04 15:44:37 +0100
committerwm4 <wm4@nowhere>2015-11-04 21:49:54 +0100
commit3ad03f6673b3b1e56020994f90c8cde9f8932b6c (patch)
treeca0b6c4c1bdd55f7ba826d6cdf60931e4d836400 /options/m_config.c
parentf00edfd9c57367478927cb58adbbc21e3d62e237 (diff)
downloadmpv-3ad03f6673b3b1e56020994f90c8cde9f8932b6c.tar.bz2
mpv-3ad03f6673b3b1e56020994f90c8cde9f8932b6c.tar.xz
options: handle terminal/logging settings eagerly
Update msg.c state immediately if a terminal or logging setting is set. Until now, this was delayed until mp[v]_initialize() was called. When using the client API, you could easily miss logged error messages, even when logging was initialized early on by calling mpv_request_log_messages(). (Properties can't be used for this either, because properties do not work before mpv_initialize().)
Diffstat (limited to 'options/m_config.c')
-rw-r--r--options/m_config.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/options/m_config.c b/options/m_config.c
index 030c144dfc..c39f3ab41a 100644
--- a/options/m_config.c
+++ b/options/m_config.c
@@ -35,6 +35,7 @@
#include "m_config.h"
#include "options/m_option.h"
#include "common/msg.h"
+#include "common/msg_control.h"
static const union m_option_value default_value;
@@ -557,18 +558,23 @@ static int handle_set_opt_flags(struct m_config *config,
return set ? 2 : 1;
}
-static void handle_set_from_cmdline(struct m_config *config,
- struct m_config_option *co)
+static void handle_on_set(struct m_config *config, struct m_config_option *co,
+ int flags)
{
- co->is_set_from_cmdline = true;
- // Mark aliases too
- if (co->data) {
- for (int n = 0; n < config->num_opts; n++) {
- struct m_config_option *co2 = &config->opts[n];
- if (co2->data == co->data)
- co2->is_set_from_cmdline = true;
+ if (flags & M_SETOPT_FROM_CMDLINE) {
+ co->is_set_from_cmdline = true;
+ // Mark aliases too
+ if (co->data) {
+ for (int n = 0; n < config->num_opts; n++) {
+ struct m_config_option *co2 = &config->opts[n];
+ if (co2->data == co->data)
+ co2->is_set_from_cmdline = true;
+ }
}
}
+
+ if (config->global && (co->opt->flags & M_OPT_TERM))
+ mp_msg_update_msglevels(config->global);
}
// The type data points to is as in: m_config_get_co(config, name)->opt
@@ -588,8 +594,7 @@ int m_config_set_option_raw(struct m_config *config, struct m_config_option *co,
return r;
m_option_copy(co->opt, co->data, data);
- if (flags & M_SETOPT_FROM_CMDLINE)
- handle_set_from_cmdline(config, co);
+ handle_on_set(config, co, flags);
return 0;
}
@@ -637,8 +642,8 @@ static int m_config_parse_option(struct m_config *config, struct bstr name,
r = m_option_parse(config->log, co->opt, name, param, set ? co->data : NULL);
- if (r >= 0 && set && (flags & M_SETOPT_FROM_CMDLINE))
- handle_set_from_cmdline(config, co);
+ if (r >= 0 && set)
+ handle_on_set(config, co, flags);
return r;
}