[Mplayer-cvslog] CVS: main mp_msg.h,NONE,1.1 mp_msg.c,NONE,1.1 Makefile,1.64,1.65

Arpi of Ize arpi at mplayer.dev.hu
Fri Aug 17 00:13:22 CEST 2001


Update of /cvsroot/mplayer/main
In directory mplayer:/var/tmp.root/cvs-serv18539

Modified Files:
	Makefile 
Added Files:
	mp_msg.h mp_msg.c 
Log Message:
new message printing system

--- NEW FILE ---

// verbosity elevel:

#define MSGL_FATAL 0  // will exit/abort
#define MSGL_ERROR 1  // continues
#define MSGL_WARN 2   // only warning
#define MSGL_INFO 3   // -quiet
#define MSGL_STATUS 4 // v=0
#define MSGL_VERBOSE 5// v=1
#define MSGL_DEBUG2 6 // v=2
#define MSGL_DEBUG3 7 // v=3
#define MSGL_DEBUG4 8 // v=4

// code/module:

#define MSGT_GLOBAL 0        // fatal errors
#define MSGT_CPLAYER 1       // console player
#define MSGT_GPLAYER 2       // gui player

#define MSGT_VO 3	       // libvo
#define MSGT_AO 4	       // libao

#define MSGT_DEMUXER 5    // demuxer.c (general stuff)
#define MSGT_DS 6         // demux stream (add/read packet etc)
#define MSGT_DEMUX 7      // fileformat-specific stuff (demux_*.c)

#define MSGT_MAX 64

void mp_msg_init(int verbose);
void mp_msg_c( int x, const char *format, ... );

#define mp_msg(mod,lev,...) mp_msg_c((mod<<8)|lev,__VA_ARGS__)
#define mp_dbg(mod,lev,...) mp_msg_c((mod<<8)|lev,__VA_ARGS__)


--- NEW FILE ---

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>

#include "mp_msg.h"

static int mp_msg_levels[MSGT_MAX]; // verbose level of this module

#if 1

void mp_msg_init(int verbose){
    int i;
    for(i=0;i<MSGT_MAX;i++){
	mp_msg_levels[i]=verbose;
    }
}

void mp_msg_c( int x, const char *format, ... ){
    va_list va;
    if((x&255)>mp_msg_levels[x>>8]) return; // do not display
    va_start(va, format);
    if((x&255)<=MSGL_ERROR){
	vfprintf(stderr,format, va);
    } else {
	vprintf(format, va);
    }
    va_end(va);
}

#else

FILE *mp_msg_file[MSGT_MAX]; // print message to this file (can be stdout/err)
static FILE* mp_msg_last_file=NULL;

// how to handle errors->stderr messages->stdout  ?
void mp_msg( int x, const char *format, ... ){
    if((x&255)>mp_msg_levels[x>>8] || !mp_msg_file[x>>8]) return; // do not display
    va_list va;
    va_start(va, format);
    vfprintf(mp_msg_file[x>>8],format, va);
    if(mp_msg_last_file!=mp_msg_file[x>>8]){
	fflush(mp_msg_file[x>>8]);
	mp_msg_last_file=mp_msg_file[x>>8];
    }
    va_end(va);
}

#endif

Index: Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/Makefile,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -r1.64 -r1.65
--- Makefile	15 Aug 2001 11:46:13 -0000	1.64
+++ Makefile	16 Aug 2001 22:13:20 -0000	1.65
@@ -16,7 +16,7 @@
 #prefix = /usr/local
 BINDIR = ${prefix}/bin
 # BINDIR = /usr/local/bin
-SRCS = open.c parse_es.c ac3-iec958.c find_sub.c aviprint.c dec_audio.c dec_video.c aviwrite.c aviheader.c asfheader.c demux_avi.c demux_asf.c demux_mpg.c demux_mov.c demuxer.c stream.c codec-cfg.c subreader.c linux/getch2.c linux/timer-lx.c linux/shmem.c xa/xa_gsm.c lirc_mp.c cfgparser.c mixer.c dvdauth.c spudec.c $(STREAM_SRCS)
+SRCS = mp_msg.c open.c parse_es.c ac3-iec958.c find_sub.c aviprint.c dec_audio.c dec_video.c aviwrite.c aviheader.c asfheader.c demux_avi.c demux_asf.c demux_mpg.c demux_mov.c demuxer.c stream.c codec-cfg.c subreader.c linux/getch2.c linux/timer-lx.c linux/shmem.c xa/xa_gsm.c lirc_mp.c cfgparser.c mixer.c dvdauth.c spudec.c $(STREAM_SRCS)
 OBJS = $(SRCS:.c=.o)
 CFLAGS = $(OPTFLAGS) -Iloader -Ilibvo $(CSS_INC) $(EXTRA_INC) # -Wall
 A_LIBS = -Lmp3lib -lMP3 -Llibac3 -lac3 $(ALSA_LIB) $(ESD_LIB)




More information about the MPlayer-cvslog mailing list