mirror of https://github.com/mpv-player/mpv
msg: change hack to silence command line pre-parse error messages
mp_msg_levels[] will go away.
This commit is contained in:
parent
78292058cc
commit
591a6722d2
|
@ -59,6 +59,7 @@ static struct mp_log *legacy_logs[MSGT_MAX];
|
|||
int mp_msg_levels[MSGT_MAX]; // verbose level of this module. initialized to -2
|
||||
int mp_msg_level_all = MSGL_STATUS;
|
||||
int verbose = 0;
|
||||
bool mp_msg_mute;
|
||||
int mp_msg_color = 1;
|
||||
int mp_msg_module = 0;
|
||||
int mp_msg_cancolor = 0;
|
||||
|
@ -79,6 +80,8 @@ static void mp_msg_do_init(void){
|
|||
|
||||
int mp_msg_test(int mod, int lev)
|
||||
{
|
||||
if (mp_msg_mute)
|
||||
return false;
|
||||
if (lev == MSGL_STATUS) {
|
||||
// skip status line output if stderr is a tty but in background
|
||||
if (terminal_in_background())
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
|
||||
struct mp_log;
|
||||
|
||||
// defined in mplayer.c
|
||||
extern int verbose;
|
||||
extern bool mp_msg_mute;
|
||||
|
||||
// verbosity elevel:
|
||||
|
||||
|
|
|
@ -265,8 +265,6 @@ err_out:
|
|||
return ret;
|
||||
}
|
||||
|
||||
extern int mp_msg_levels[];
|
||||
|
||||
/* Parse some command line options early before main parsing.
|
||||
* --no-config prevents reading configuration files (otherwise done before
|
||||
* command line parsing), and --really-quiet suppresses messages printed
|
||||
|
@ -275,8 +273,7 @@ extern int mp_msg_levels[];
|
|||
void m_config_preparse_command_line(m_config_t *config, int argc, char **argv)
|
||||
{
|
||||
// Hack to shut up parser error messages
|
||||
int msg_lvl_backup = mp_msg_levels[MSGT_CFGPARSER];
|
||||
mp_msg_levels[MSGT_CFGPARSER] = -11;
|
||||
mp_msg_mute = true;
|
||||
|
||||
struct parse_state p = {config, argc, argv};
|
||||
while (split_opt_silent(&p) == 0) {
|
||||
|
@ -290,5 +287,5 @@ void m_config_preparse_command_line(m_config_t *config, int argc, char **argv)
|
|||
}
|
||||
}
|
||||
|
||||
mp_msg_levels[MSGT_CFGPARSER] = msg_lvl_backup;
|
||||
mp_msg_mute = false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue