[MPlayer-cvslog] CVS: main cfg-common.h, 1.148, 1.149 mp_msg.c, 1.28, 1.29 mp_msg.h, 1.35, 1.36 mplayer.c, 1.891, 1.892 mencoder.c, 1.322, 1.323

Oded Shimon CVS syncmail at mplayerhq.hu
Tue Dec 6 09:42:50 CET 2005


CVS change done by Oded Shimon CVS

Update of /cvsroot/mplayer/main
In directory mail:/var2/tmp/cvs-serv26621

Modified Files:
	cfg-common.h mp_msg.c mp_msg.h mplayer.c mencoder.c 
Log Message:
new -msglevel option, constrols msg level for every msg module


Index: cfg-common.h
===================================================================
RCS file: /cvsroot/mplayer/main/cfg-common.h,v
retrieving revision 1.148
retrieving revision 1.149
diff -u -r1.148 -r1.149
--- cfg-common.h	5 Aug 2005 19:57:44 -0000	1.148
+++ cfg-common.h	6 Dec 2005 08:42:47 -0000	1.149
@@ -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},
@@ -224,6 +225,10 @@
 	{"xvidopts", xvid_dec_opts, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
 #endif
 	{"codecs-file", &codecs_file, CONF_TYPE_STRING, 0, 0, 0, NULL},
+#ifdef WIN32_LOADER
+	{"codecs-dir", &def_path, CONF_TYPE_STRING, 0, 0, 0, NULL},
+#endif
+
 // ------------------------- subtitles options --------------------
 
 #ifdef USE_SUB
@@ -309,6 +314,10 @@
 /* defined in codec-cfg.c */
 extern char * codecs_file;
 
+#ifdef WIN32_LOADER
+extern char * def_path;
+#endif
+
 /* from dec_audio, currently used for ac3surround decoder only */
 extern int audio_output_channels;
 
@@ -476,6 +485,93 @@
 	{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 },
+        {"help", "\nAvailable msg mdoules:\n"
+        "   global     - common player errors/information\n"
+        "   cplayer    - console player (mplayer.c)\n"
+        "   gplayer    - gui player\n"
+        "   vo         - libvo\n"
+        "   ao         - libao\n"
+        "   demuxer    - demuxer.c (general stuff)\n"
+        "   ds         - demux stream (add/read packet etc)\n"
+        "   demux      - fileformat-specific stuff (demux_*.c)\n"
+        "   header     - fileformat-specific header (*header.c)\n"
+        "   avsync     - mplayer.c timer stuff\n"
+        "   autoq      - mplayer.c auto-quality stuff\n"
+        "   cfgparser  - cfgparser.c\n"
+        "   decaudio   - av decoder\n"
+        "   decvideo\n"
+        "   seek       - seeking code\n"
+        "   win32      - win32 dll stuff\n"
+        "   open       - open.c (stream opening)\n"
+        "   dvd        - open.c (DVD init/read/seek)\n"
+        "   parsees    - parse_es.c (mpeg stream parser)\n"
+        "   lirc       - lirc_mp.c and input lirc driver\n"
+        "   stream     - stream.c\n"
+        "   cache      - cache2.c\n"
+        "   mencoder\n"
+        "   xacodec    - XAnim codecs\n"
+        "   tv         - TV input subsystem\n"
+        "   osdep      - OS Dependant parts (linux/ for now)\n"
+        "   spudec     - spudec.c\n"
+        "   playtree   - Playtree handeling (playtree.c, playtreeparser.c)\n"
+        "   input\n"
+        "   vfilter\n"
+        "   osd\n"
+        "   network\n"
+        "   cpudetect\n"
+        "   codeccfg\n"
+        "   sws\n"
+        "   vobsub\n"
+        "   subreader\n"
+        "   afilter    - Audio filter messages\n"
+        "   netst      - Netstream\n"
+        "   muxer      - muxer layer\n"
+        "\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
+};
+
 #ifdef WIN32
 
 extern char * proc_priority;

Index: mp_msg.c
===================================================================
RCS file: /cvsroot/mplayer/main/mp_msg.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- mp_msg.c	29 Sep 2005 05:21:12 -0000	1.28
+++ mp_msg.c	6 Dec 2005 08:42:47 -0000	1.29
@@ -1,5 +1,5 @@
 
-//#define MSG_USE_COLORS
+#define MSG_USE_COLORS
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -20,9 +20,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 +39,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);
@@ -141,7 +137,7 @@
         }
         fprintf(stream, "\033[%d;3%dm",c>>3,c&7);
         header=    tmp[strlen(tmp)-1] == '\n'
-                 /*||tmp[strlen(tmp)-1] == '\r'*/;
+                 ||tmp[strlen(tmp)-1] == '\r';
     }
 #endif
     if (lev <= MSGL_WARN){

Index: mp_msg.h
===================================================================
RCS file: /cvsroot/mplayer/main/mp_msg.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- mp_msg.h	30 Sep 2005 05:57:59 -0000	1.35
+++ mp_msg.h	6 Dec 2005 08:42:47 -0000	1.36
@@ -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.891
retrieving revision 1.892
diff -u -r1.891 -r1.892
--- mplayer.c	5 Dec 2005 01:18:10 -0000	1.891
+++ mplayer.c	6 Dec 2005 08:42:47 -0000	1.892
@@ -343,6 +343,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;
@@ -1328,7 +1331,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 */
@@ -1564,8 +1566,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.322
retrieving revision 1.323
diff -u -r1.322 -r1.323
--- mencoder.c	2 Dec 2005 19:41:25 -0000	1.322
+++ mencoder.c	6 Dec 2005 08:42:47 -0000	1.323
@@ -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-cvslog mailing list