Mercurial > mplayer.hg
changeset 16379:cdd8c0dfc19b
improve colorization
author | michael |
---|---|
date | Sat, 03 Sep 2005 19:27:48 +0000 |
parents | 430ca60471ba |
children | 73afe41bb7c3 |
files | mp_msg.c |
diffstat | 1 files changed, 65 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mp_msg.c Sat Sep 03 19:20:51 2005 +0000 +++ b/mp_msg.c Sat Sep 03 19:27:48 2005 +0000 @@ -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){