[MPlayer-dev-eng] [PATCH] -msgl option
Oded Shimon
ods15 at ods15.dyndns.org
Mon Dec 5 21:58:38 CET 2005
On Mon, Dec 05, 2005 at 10:57:46PM +0200, Oded Shimon wrote:
> <>
bah(TM)
- ods15
-------------- next part --------------
Index: cfg-common.h
===================================================================
RCS file: /cvsroot/mplayer/main/cfg-common.h,v
retrieving revision 1.148
diff -u -r1.148 cfg-common.h
--- cfg-common.h 5 Aug 2005 19:57:44 -0000 1.148
+++ cfg-common.h 5 Dec 2005 20:42:55 -0000
@@ -5,6 +5,7 @@
{"noquiet", &quiet, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, NULL},
{"verbose", &verbose, CONF_TYPE_INT, CONF_RANGE|CONF_GLOBAL, 0, 100, NULL},
{"v", cfg_inc_verbose, CONF_TYPE_FUNC, CONF_GLOBAL|CONF_NOSAVE, 0, 0, NULL},
+ {"msglevel", msgl_config, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL},
{"include", cfg_include, CONF_TYPE_FUNC_PARAM, CONF_NOSAVE, 0, 0, NULL},
#ifdef WIN32
{"priority", &proc_priority, CONF_TYPE_STRING, 0, 0, 0, NULL},
@@ -476,6 +479,51 @@
{NULL, NULL, 0, 0, 0, 0, NULL}
};
+m_option_t msgl_config[]={
+ { "all", &mp_msg_level_all, CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL},
+
+ { "global", &mp_msg_levels[MSGT_GLOBAL], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "cplayer", &mp_msg_levels[MSGT_CPLAYER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "gplayer", &mp_msg_levels[MSGT_GPLAYER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "vo", &mp_msg_levels[MSGT_VO], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "ao", &mp_msg_levels[MSGT_AO], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "demuxer", &mp_msg_levels[MSGT_DEMUXER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "ds", &mp_msg_levels[MSGT_DS], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "demux", &mp_msg_levels[MSGT_DEMUX], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "header", &mp_msg_levels[MSGT_HEADER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "avsync", &mp_msg_levels[MSGT_AVSYNC], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "autoq", &mp_msg_levels[MSGT_AUTOQ], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "cfgparser", &mp_msg_levels[MSGT_CFGPARSER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "decaudio", &mp_msg_levels[MSGT_DECAUDIO], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "decvideo", &mp_msg_levels[MSGT_DECVIDEO], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "seek", &mp_msg_levels[MSGT_SEEK], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "win32", &mp_msg_levels[MSGT_WIN32], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "open", &mp_msg_levels[MSGT_OPEN], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "dvd", &mp_msg_levels[MSGT_DVD], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "parsees", &mp_msg_levels[MSGT_PARSEES], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "lirc", &mp_msg_levels[MSGT_LIRC], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "stream", &mp_msg_levels[MSGT_STREAM], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "cache", &mp_msg_levels[MSGT_CACHE], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "mencoder", &mp_msg_levels[MSGT_MENCODER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "xacodec", &mp_msg_levels[MSGT_XACODEC], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "tv", &mp_msg_levels[MSGT_TV], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "osdep", &mp_msg_levels[MSGT_OSDEP], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "spudec", &mp_msg_levels[MSGT_SPUDEC], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "playtree", &mp_msg_levels[MSGT_PLAYTREE], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "input", &mp_msg_levels[MSGT_INPUT], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "vfilter", &mp_msg_levels[MSGT_VFILTER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "osd", &mp_msg_levels[MSGT_OSD], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "network", &mp_msg_levels[MSGT_NETWORK], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "cpudetect", &mp_msg_levels[MSGT_CPUDETECT], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "codeccfg", &mp_msg_levels[MSGT_CODECCFG], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "sws", &mp_msg_levels[MSGT_SWS], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "vobsub", &mp_msg_levels[MSGT_VOBSUB], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "subreader", &mp_msg_levels[MSGT_SUBREADER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "afilter", &mp_msg_levels[MSGT_AFILTER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "netst", &mp_msg_levels[MSGT_NETST], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+ { "muxer", &mp_msg_levels[MSGT_MUXER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+};
+
#ifdef WIN32
extern char * proc_priority;
Index: mp_msg.c
===================================================================
RCS file: /cvsroot/mplayer/main/mp_msg.c,v
retrieving revision 1.28
diff -u -r1.28 mp_msg.c
--- mp_msg.c 29 Sep 2005 05:21:12 -0000 1.28
+++ mp_msg.c 5 Dec 2005 20:42:55 -0000
@@ -20,9 +19,12 @@
/* maximum message length of mp_msg */
#define MSGSIZE_MAX 3072
-static int mp_msg_levels[MSGT_MAX]; // verbose level of this module
+extern int mp_msg_levels[MSGT_MAX]; // verbose level of this module
+extern int mp_msg_level_all;
+extern int verbose;
void mp_msg_init(){
+ int i;
#ifdef USE_I18N
#ifdef MP_DEBUG
fprintf(stdout, "Using GNU internationalization\n");
@@ -36,26 +38,19 @@
fprintf(stdout, "Current dirname: %s\n\n", bindtextdomain(textdomain(NULL),NULL));
#endif
#endif
- mp_msg_set_level(MSGL_STATUS);
-}
-
-void mp_msg_set_level(int verbose){
- int i;
- for(i=0;i<MSGT_MAX;i++){
- mp_msg_levels[i]=verbose;
- }
+ for(i=0;i<MSGT_MAX;i++) mp_msg_levels[i] = -2;
}
int mp_msg_test(int mod, int lev)
{
- return lev <= mp_msg_levels[mod];
+ return lev <= (mp_msg_levels[mod] == -2 ? mp_msg_level_all + verbose : mp_msg_levels[mod]);
}
void mp_msg(int mod, int lev, const char *format, ... ){
va_list va;
char tmp[MSGSIZE_MAX];
- if (lev > mp_msg_levels[mod]) return; // do not display
+ if (!mp_msg_test(mod, lev)) return; // do not display
va_start(va, format);
vsnprintf(tmp, MSGSIZE_MAX, mp_gettext(format), va);
va_end(va);
Index: mp_msg.h
===================================================================
RCS file: /cvsroot/mplayer/main/mp_msg.h,v
retrieving revision 1.35
diff -u -r1.35 mp_msg.h
--- mp_msg.h 30 Sep 2005 05:57:59 -0000 1.35
+++ mp_msg.h 5 Dec 2005 20:42:55 -0000
@@ -95,7 +95,6 @@
#define MSGT_MAX 64
void mp_msg_init();
-void mp_msg_set_level(int verbose);
int mp_msg_test(int mod, int lev);
#include "config.h"
Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.879
diff -u -r1.879 mplayer.c
--- mplayer.c 17 Oct 2005 18:16:28 -0000 1.879
+++ mplayer.c 5 Dec 2005 20:43:01 -0000
@@ -335,6 +335,9 @@
int global_sub_indices[SUB_SOURCES];
int global_sub_quiet_osd_hack = 0;
+int mp_msg_levels[MSGT_MAX]; // inited to -2
+int mp_msg_level_all = MSGL_STATUS;
+
static stream_t* stream=NULL;
static demuxer_t *demuxer=NULL;
static sh_audio_t *sh_audio=NULL;
@@ -1082,7 +1085,6 @@
InitTimer();
mp_msg_init();
- mp_msg_set_level(MSGL_STATUS);
mp_msg(MSGT_CPLAYER,MSGL_INFO, "MPlayer " VERSION " (C) 2000-2005 MPlayer Team\n");
/* Test for cpu capabilities (and corresponding OS support) for optimizing */
@@ -1318,8 +1320,6 @@
mp_msg(MSGT_CPLAYER, MSGL_INFO, "\n");
}
- mp_msg_set_level(verbose+MSGL_STATUS);
-
//------ load global data first ------
// check font
Index: mencoder.c
===================================================================
RCS file: /cvsroot/mplayer/main/mencoder.c,v
retrieving revision 1.317
diff -u -r1.317 mencoder.c
--- mencoder.c 23 Oct 2005 15:05:11 -0000 1.317
+++ mencoder.c 5 Dec 2005 20:43:04 -0000
@@ -140,6 +140,9 @@
double cur_vout_time_usage=0;
int benchmark=0;
+int mp_msg_levels[MSGT_MAX]; // inited to -2
+int mp_msg_level_all = MSGL_STATUS;
+
#ifdef WIN32
char * proc_priority=NULL;
#endif
@@ -402,7 +405,6 @@
audio_encoder_t *aencoder = NULL;
mp_msg_init();
- mp_msg_set_level(MSGL_STATUS);
mp_msg(MSGT_CPLAYER,MSGL_INFO, "MEncoder " VERSION " (C) 2000-2005 MPlayer Team\n");
/* Test for cpu capabilities (and corresponding OS support) for optimizing */
@@ -463,8 +465,6 @@
filelist = m_config_parse_me_command_line(mconfig, argc, argv);
if(!filelist) mencoder_exit(1, MSGTR_ErrorParsingCommandLine);
- mp_msg_set_level(verbose+MSGL_STATUS);
-
if (frameno_filename) {
stream2=open_stream(frameno_filename,0,&i);
if(stream2){
More information about the MPlayer-dev-eng
mailing list