[MPlayer-cvslog] CVS: main mp_msg.c,1.26,1.27

Michael Niedermayer CVS syncmail at mplayerhq.hu
Sat Sep 3 21:27:51 CEST 2005


CVS change done by Michael Niedermayer CVS

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

Modified Files:
	mp_msg.c 
Log Message:
improve colorization


Index: mp_msg.c
===================================================================
RCS file: /cvsroot/mplayer/main/mp_msg.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- mp_msg.c	3 Sep 2005 15:19:52 -0000	1.26
+++ mp_msg.c	3 Sep 2005 19:27:48 -0000	1.27
@@ -76,18 +76,79 @@
 
 #ifdef MSG_USE_COLORS
 /* that's only a silly color test */
-#ifdef MP_DEBUG
+#ifdef MP_ANNOY_ME
     { int c;
       static int flag=1;
       if(flag)
-      for(c=0;c<16;c++)
+      for(c=0;c<24;c++)
           printf("\033[%d;3%dm***  COLOR TEST %d  ***\n",(c>7),c&7,c);
       flag=0;
     }
 #endif    
-    {	unsigned char v_colors[10]={9,9,11,14,15,7,6,5,5,5};
+    {	unsigned char v_colors[10]={9,1,3,15,7,2,2,8,8,8};
+        static const char *lev_text[]= {
+                                "FATAL",
+                                "ERROR",
+                                "WARN",
+                                "HINT",
+                                "INFO",
+                                "STATUS",
+                                "V",
+                                "DGB2",
+                                "DGB3",
+                                "DGB4"};
+        static const char *mod_text[]= {
+                                "GLOBAL",
+                                "CPLAYER",
+                                "GPLAYER",
+                                "VIDEOOUT",
+                                "AUDIOOUT",
+                                "DEMUXER",
+                                "DS",
+                                "DEMUX",
+                                "HEADER",
+                                "AVSYNC",
+                                "AUTOQ",
+                                "CFGPARSER",
+                                "DECAUDIO",
+                                "DECVIDEO",
+                                "SEEK",
+                                "WIN32",
+                                "OPEN",
+                                "DVD",
+                                "PARSEES",
+                                "LIRC",
+                                "STREAM",
+                                "CACHE",
+                                "MENCODER",
+                                "XACODEC",
+                                "TV",
+                                "OSDEP",
+                                "SPUDEC",
+                                "PLAYTREE",
+                                "INPUT",
+                                "VFILTER",
+                                "OSD",
+                                "NETWORK",
+                                "CPUDETECT",
+                                "CODECCFG",
+                                "SWS",
+                                "VOBSUB",
+                                "SUBREADER",
+                                "AFILTER",
+                                "NETST",
+                                "MUXER"};
+
 	int c=v_colors[(x & 255)];
-	fprintf(((x & 255) <= MSGL_WARN)?stderr:stdout, "\033[%d;3%dm",(c>7),c&7);
+        int c2=((x>>8)+1)%15+1;
+        static int header=1;
+        FILE *stream= (x & 255) <= MSGL_WARN ? stderr : stdout;
+        if(header){
+            fprintf(stream, "\033[%d;3%dm%9s\033[0;37m: ",c2>>3,c2&7, mod_text[x>>8]);
+        }
+        fprintf(stream, "\033[%d;3%dm",c>>3,c&7);
+        header=    tmp[strlen(tmp)-1] == '\n'
+                 /*||tmp[strlen(tmp)-1] == '\r'*/;
     }
 #endif
     if ((x & 255) <= MSGL_WARN){




More information about the MPlayer-cvslog mailing list