From 633152e55a6f851c58267793081dea3162acfb48 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 23 Jun 2017 20:42:20 +0200 Subject: options: remove weird --really-quiet special behavior This was especially grating because it causes problems with the option/property unification, uses as only thing OPT_FLAG_STORE, and behaves weird with the client API or scripts. It can be reimplemented in a much simpler way, although it needs slightly more code. (Simpler because less special cases.) --- DOCS/interface-changes.rst | 1 + common/msg.c | 6 +++++- options/options.c | 3 +-- options/options.h | 1 + 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst index 7f5c7219c5..4810a58c84 100644 --- a/DOCS/interface-changes.rst +++ b/DOCS/interface-changes.rst @@ -36,6 +36,7 @@ Interface changes - renamed the TRCs `st2084` and `std-b67` to `pq` and `hlg` respectively - the "osd" command is deprecated (use "cycle osd-level") - --field-dominance is deprecated (no replacement) + - --really-quiet subtle behavior change --- mpv 0.25.0 --- - remove opengl-cb dxva2 dummy hwdec interop (see git "vo_opengl: remove dxva2 dummy hwdec backend") diff --git a/common/msg.c b/common/msg.c index cf2bd5c242..6e981406ff 100644 --- a/common/msg.c +++ b/common/msg.c @@ -57,6 +57,7 @@ struct mp_log_root { int status_lines; // number of current status lines bool color; int verbose; + bool really_quiet; bool force_stderr; struct mp_log_buffer **buffers; int num_buffers; @@ -110,7 +111,9 @@ static void update_loglevel(struct mp_log *log) { struct mp_log_root *root = log->root; pthread_mutex_lock(&mp_msg_lock); - log->level = MSGL_STATUS + log->root->verbose; // default log level + log->level = MSGL_STATUS; // default log level + if (root->really_quiet) + log->level -= 10; for (int n = 0; root->msg_levels && root->msg_levels[n * 2 + 0]; n++) { if (match_mod(log->verbose_prefix, root->msg_levels[n * 2 + 0])) log->level = mp_msg_find_level(root->msg_levels[n * 2 + 1]); @@ -511,6 +514,7 @@ void mp_msg_update_msglevels(struct mpv_global *global) pthread_mutex_lock(&mp_msg_lock); root->verbose = opts->verbose; + root->really_quiet = opts->msg_really_quiet; root->module = opts->msg_module; root->use_terminal = opts->use_terminal; root->show_time = opts->msg_time; diff --git a/options/options.c b/options/options.c index 620cc67318..03ab7c89bc 100644 --- a/options/options.c +++ b/options/options.c @@ -261,8 +261,7 @@ const m_option_t mp_opts[] = { // ------------------------- common options -------------------- OPT_FLAG("quiet", quiet, 0), - OPT_FLAG_STORE("really-quiet", verbose, - M_OPT_FIXED | CONF_PRE_PARSE | M_OPT_NOPROP, -10), + OPT_FLAG("really-quiet", msg_really_quiet, CONF_PRE_PARSE | UPDATE_TERM), OPT_FLAG("terminal", use_terminal, CONF_PRE_PARSE | UPDATE_TERM), OPT_GENERAL(char**, "msg-level", msg_levels, CONF_PRE_PARSE | UPDATE_TERM, .type = &m_option_type_msglevels), diff --git a/options/options.h b/options/options.h index 851b9c507f..8c28a70d99 100644 --- a/options/options.h +++ b/options/options.h @@ -73,6 +73,7 @@ typedef struct MPOpts { int use_terminal; char *dump_stats; int verbose; + int msg_really_quiet; char **msg_levels; int msg_color; int msg_module; -- cgit v1.2.3