changeset 17932:3fe3b2b3a6ce

Convert all if(verbose>X) to mp_msg_test calls.
author diego
date Fri, 24 Mar 2006 08:12:03 +0000
parents ed9950b8200d
children 2b2ee6c92b24
files libao2/ao_sun.c libmpcodecs/ad_acm.c libmpcodecs/ad_twin.c libmpcodecs/ae_lame.c libmpcodecs/vd.c libmpcodecs/vd_ffmpeg.c libmpcodecs/vd_vfw.c libmpcodecs/vf_scale.c libmpdemux/asf_streaming.c libmpdemux/asfheader.c libmpdemux/aviheader.c libmpdemux/demux_asf.c libmpdemux/demux_audio.c libmpdemux/demux_lavf.c libmpdemux/demux_mov.c libmpdemux/demux_ogg.c libmpdemux/demux_real.c libmpdemux/demuxer.c libmpdemux/http.c libmpdemux/stream.c libmpdemux/video.c libvo/vesa_lvo.c libvo/vo_png.c libvo/vo_sdl.c libvo/vo_svga.c libvo/vo_vesa.c libvo/vo_xvmc.c libvo/vosub_vidix.c loader/win32.c mencoder.c mplayer.c
diffstat 31 files changed, 261 insertions(+), 204 deletions(-) [+]
line wrap: on
line diff
--- a/libao2/ao_sun.c	Fri Mar 24 02:31:29 2006 +0000
+++ b/libao2/ao_sun.c	Fri Mar 24 08:12:03 2006 +0000
@@ -64,7 +64,6 @@
     RTSC_DISABLED
 } enable_sample_timing;
 
-extern int verbose;
 
 
 // convert an OSS audio format specification into a sun audio encoding
@@ -127,19 +126,19 @@
     info.play.encoding = AUDIO_ENCODING_LINEAR;
     info.play.samples = 0;
     if (ioctl(fd, AUDIO_SETINFO, &info)) {
-	if (verbose>0)
+	if ( mp_msg_test(MSGT_AO,MSGL_V) )
 	    mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_SUN_RtscSetinfoFailed);
 	goto error;
     }
     
     if (write(fd, silence, len) != len) {
-	if (verbose>0)
+	if ( mp_msg_test(MSGT_AO,MSGL_V) )
 	    mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_SUN_RtscWriteFailed);
 	goto error;
     }
 
     if (ioctl(fd, AUDIO_GETINFO, &info)) {
-	if (verbose>0)
+	if ( mp_msg_test(MSGT_AO,MSGL_V) )
 	    perror("rtsc: GETINFO1");
 	goto error;
     }
@@ -161,18 +160,18 @@
 	    break;
 
 	if (ioctl(fd, AUDIO_GETINFO, &info)) {
-	    if (verbose>0)
+	    if ( mp_msg_test(MSGT_AO,MSGL_V) )
 		perror("rtsc: GETINFO2 failed");
 	    goto error;
 	}
 	if (info.play.samples < last_samplecnt) {
-	    if (verbose>0)
+	    if ( mp_msg_test(MSGT_AO,MSGL_V) )
 		printf("rtsc: %d > %d?\n", last_samplecnt, info.play.samples);
 	    goto error;
 	}
 
 	if ((increment = info.play.samples - last_samplecnt) > 0) {
-	    if (verbose>0)
+	    if ( mp_msg_test(MSGT_AO,MSGL_V) )
 		printf("ao_sun: sample counter increment: %d\n", increment);
 	    if (increment < min_increment) {
 		min_increment = increment;
@@ -195,7 +194,7 @@
     if (min_increment < 2000)
 	rtsc_ok = RTSC_ENABLED;
 
-    if (verbose>0)
+    if ( mp_msg_test(MSGT_AO,MSGL_V) )
 	printf("ao_sun: minimum sample counter increment per 10msec interval: %d\n"
 	       "\t%susing sample counter based timing code\n",
 	       min_increment, rtsc_ok == RTSC_ENABLED ? "" : "not ");
--- a/libmpcodecs/ad_acm.c	Fri Mar 24 02:31:29 2006 +0000
+++ b/libmpcodecs/ad_acm.c	Fri Mar 24 08:12:03 2006 +0000
@@ -74,7 +74,7 @@
 //    priv->o_wf->wBitsPerSample = inf_fmt->wBitsPerSample;
     priv->o_wf->cbSize = 0;
     
-    if (verbose>0)
+    if ( mp_msg_test(MSGT_DECAUDIO,MSGL_V) )
     {
 	mp_msg(MSGT_DECAUDIO, MSGL_V, "Input format:\n");
 	print_wave_header(in_fmt);
@@ -98,7 +98,7 @@
     mp_msg(MSGT_WIN32, MSGL_V, "Audio codec opened OK! ;-)\n");
     
     acmStreamSize(priv->handle, in_fmt->nBlockAlign, &srcsize, ACM_STREAMSIZEF_SOURCE);
-    //if (verbose) printf("Audio ACM output buffer min. size: %ld (reported by codec)\n", srcsize);
+    //if ( mp_msg_test(MSGT_DECAUDIO,MSGL_V) ) printf("Audio ACM output buffer min. size: %ld (reported by codec)\n", srcsize);
     srcsize *= 2;
     //if (srcsize < MAX_OUTBURST) srcsize = MAX_OUTBURST;
     if (!srcsize)
--- a/libmpcodecs/ad_twin.c	Fri Mar 24 02:31:29 2006 +0000
+++ b/libmpcodecs/ad_twin.c	Fri Mar 24 08:12:03 2006 +0000
@@ -110,11 +110,11 @@
     priv->o_wf.wBitsPerSample=in_fmt->wBitsPerSample;
     priv->o_wf.cbSize=0;
 
-    if(verbose)
+    if( mp_msg_test(MSGT_DECAUDIO,MSGL_V) )
     {
-    mp_msg(MSGT_DECAUDIO, MSGL_INFO, "Input format:\n");
+    mp_msg(MSGT_DECAUDIO, MSGL_V, "Input format:\n");
     print_wave_header(in_fmt);
-    mp_msg(MSGT_DECAUDIO, MSGL_INFO, "Output fmt:\n");
+    mp_msg(MSGT_DECAUDIO, MSGL_V, "Output fmt:\n");
     print_wave_header(&priv->o_wf);
     }
     memcpy(&priv->hi,&in_fmt[1],sizeof(headerInfo));
--- a/libmpcodecs/ae_lame.c	Fri Mar 24 02:31:29 2006 +0000
+++ b/libmpcodecs/ae_lame.c	Fri Mar 24 08:12:03 2006 +0000
@@ -70,7 +70,6 @@
 
 
 static int pass;
-extern int verbose;
 
 static int bind_lame(audio_encoder_t *encoder, muxer_stream_t *mux_a)
 {
@@ -192,7 +191,7 @@
         mp_msg(MSGT_MENCODER, MSGL_FATAL, MSGTR_LameCantInit); 
         return 0;
     }
-    if(verbose>0) {
+    if( mp_msg_test(MSGT_MENCODER,MSGL_V) ) {
         lame_print_config(lame);
         lame_print_internals(lame);
     }
--- a/libmpcodecs/vd.c	Fri Mar 24 02:31:29 2006 +0000
+++ b/libmpcodecs/vd.c	Fri Mar 24 08:12:03 2006 +0000
@@ -174,7 +174,7 @@
     // check if libvo and codec has common outfmt (no conversion):
 csp_again:
 
-    if(verbose>0){
+    if( mp_msg_test(MSGT_DECVIDEO,MSGL_V) ){
 	vf_instance_t* f=vf;
 	mp_msg(MSGT_DECVIDEO,MSGL_V,"Trying filter chain:");
 	for(f = vf ; f ; f = f->next)
--- a/libmpcodecs/vd_ffmpeg.c	Fri Mar 24 02:31:29 2006 +0000
+++ b/libmpcodecs/vd_ffmpeg.c	Fri Mar 24 08:12:03 2006 +0000
@@ -1001,7 +1001,7 @@
     }
     assert(avctx->draw_horiz_band == mc_render_slice);
     assert(avctx->release_buffer == mc_release_buffer);
-    if(verbose > 4)
+    if( mp_msg_test(MSGT_DECVIDEO,MSGL_DBG5) )
         printf("vd_ffmpeg::mc_get_buffer\n");
 
     if(init_vo(sh,avctx->pix_fmt) < 0){
@@ -1068,7 +1068,7 @@
     pic->type= FF_BUFFER_TYPE_USER;
 
     render=(xvmc_render_state_t*)mpi->priv;//same as data[2]
-    if(verbose > 4)
+    if( mp_msg_test(MSGT_DECVIDEO,MSGL_DBG5) )
         printf("vd_ffmpeg::mc_get_buffer (render=%p)\n",render);
     assert(render != 0);
     assert(render->magic == MP_XVMC_RENDER_MAGIC);
@@ -1095,7 +1095,7 @@
 //printf("R%X %X\n", pic->linesize[0], pic->data[0]);
 //mark the surface as not requared for prediction
     render=(xvmc_render_state_t*)pic->data[2];//same as mpi->priv
-    if(verbose > 4)
+    if( mp_msg_test(MSGT_DECVIDEO,MSGL_DBG5) )
         printf("vd_ffmpeg::mc_release_buffer (render=%p)\n",render);
     assert(render!=NULL);
     assert(render->magic==MP_XVMC_RENDER_MAGIC);
--- a/libmpcodecs/vd_vfw.c	Fri Mar 24 02:31:29 2006 +0000
+++ b/libmpcodecs/vd_vfw.c	Fri Mar 24 08:12:03 2006 +0000
@@ -241,9 +241,9 @@
 	set_csp(priv->o_bih,sh->codec->outfmt[sh->outfmtidx]);
 
     mp_msg(MSGT_WIN32, MSGL_V, "Input format:\n");
-    if(verbose>0) print_video_header(sh->bih);
+    if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_video_header(sh->bih);
     mp_msg(MSGT_WIN32, MSGL_V, "Output format:\n");
-    if(verbose>0) print_video_header(priv->o_bih);
+    if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_video_header(priv->o_bih);
 
     // set postprocessing level in xvid/divx4 .dll
     ICSendMessage(priv->handle, ICM_USER+80, (long)(&divx_quality), 0);
--- a/libmpcodecs/vf_scale.c	Fri Mar 24 02:31:29 2006 +0000
+++ b/libmpcodecs/vf_scale.c	Fri Mar 24 08:12:03 2006 +0000
@@ -522,7 +522,7 @@
 		firstTime=0;
 		*flags= SWS_PRINT_INFO;
 	}
-	else if(verbose>1) *flags= SWS_PRINT_INFO;
+	else if( mp_msg_test(MSGT_VFILTER,MSGL_DBG2) ) *flags= SWS_PRINT_INFO;
 
 	if(src_filter) sws_freeFilter(src_filter);
 
--- a/libmpdemux/asf_streaming.c	Fri Mar 24 02:31:29 2006 +0000
+++ b/libmpdemux/asf_streaming.c	Fri Mar 24 08:12:03 2006 +0000
@@ -31,7 +31,6 @@
 	((guid)[3] << 24 | (guid)[2] << 16 | (guid)[1] << 8 | (guid)[0])
 #endif
 
-extern int verbose;
 extern int network_bandwidth;
 
 int asf_mmst_streaming_start( stream_t *stream );
@@ -759,7 +758,7 @@
 			}
 			http_response_append( http_hdr, buffer, i );
 		} while( !http_is_header_entire( http_hdr ) );
-		if( verbose>0 ) {
+		if( mp_msg_test(MSGT_NETWORK,MSGL_V) ) {
 			http_hdr->buffer[http_hdr->buffer_size]='\0';
 			mp_msg(MSGT_NETWORK,MSGL_DBG2,"Response [%s]\n", http_hdr->buffer );
 		}
--- a/libmpdemux/asfheader.c	Fri Mar 24 02:31:29 2006 +0000
+++ b/libmpdemux/asfheader.c	Fri Mar 24 08:12:03 2006 +0000
@@ -5,8 +5,6 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-extern int verbose; // defined in mplayer.c
-
 #include "config.h"
 #include "mp_msg.h"
 #include "help_mp.h"
@@ -212,7 +210,7 @@
         sh_audio->wf=calloc((streamh->type_size<sizeof(WAVEFORMATEX))?sizeof(WAVEFORMATEX):streamh->type_size,1);
         memcpy(sh_audio->wf,buffer,streamh->type_size);
 	le2me_WAVEFORMATEX(sh_audio->wf);
-        if(verbose>=1) print_wave_header(sh_audio->wf);
+        if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_wave_header(sh_audio->wf);
 	if(ASF_LOAD_GUID_PREFIX(streamh->concealment)==ASF_GUID_PREFIX_audio_conceal_interleave){
           buffer = &hdr[pos];
           pos += streamh->stream_size;
@@ -240,7 +238,7 @@
 	  mp_msg(MSGT_DEMUXER, MSGL_WARN, MSGTR_MPDEMUX_ASFHDR_DVRWantsLibavformat);
         //sh_video->fps=(float)sh_video->video.dwRate/(float)sh_video->video.dwScale;
         //sh_video->frametime=(float)sh_video->video.dwScale/(float)sh_video->video.dwRate;
-        if(verbose>=1) print_video_header(sh_video->bih);
+        if( mp_msg_test(MSGT_DEMUX,MSGL_V) ) print_video_header(sh_video->bih);
         //asf_video_id=streamh.stream_no & 0x7F;
 	//if(demuxer->video->id==-1) demuxer->video->id=streamh.stream_no & 0x7F;
         break;
@@ -283,7 +281,7 @@
           string = &hdr[pos];
           pos += contenth->title_size;
           if (pos > hdr_len) goto len_err_out;
-          if(verbose>0)
+          if( mp_msg_test(MSGT_HEADER,MSGL_V) )
             print_asf_string(" Title: ", string, contenth->title_size);
 	  else
 	    pack_asf_string(string, contenth->title_size);
@@ -294,7 +292,7 @@
           string = &hdr[pos];
           pos += contenth->author_size;
           if (pos > hdr_len) goto len_err_out;
-          if(verbose>0)
+          if( mp_msg_test(MSGT_HEADER,MSGL_V) )
             print_asf_string(" Author: ", string, contenth->author_size);
 	  else
 	    pack_asf_string(string, contenth->author_size);
@@ -305,7 +303,7 @@
           string = &hdr[pos];
           pos += contenth->copyright_size;
           if (pos > hdr_len) goto len_err_out;
-          if(verbose>0)
+          if( mp_msg_test(MSGT_HEADER,MSGL_V) )
             print_asf_string(" Copyright: ", string, contenth->copyright_size);
 	  else
 	    pack_asf_string(string, contenth->copyright_size);
@@ -316,7 +314,7 @@
           string = &hdr[pos];
           pos += contenth->comment_size;
           if (pos > hdr_len) goto len_err_out;
-          if(verbose>0)
+          if( mp_msg_test(MSGT_HEADER,MSGL_V) )
             print_asf_string(" Comment: ", string, contenth->comment_size);
 	  else
 	    pack_asf_string(string, contenth->comment_size);
@@ -327,7 +325,7 @@
           string = &hdr[pos];
           pos += contenth->rating_size;
           if (pos > hdr_len) goto len_err_out;
-          if(verbose>0)
+          if( mp_msg_test(MSGT_HEADER,MSGL_V) )
             print_asf_string(" Rating: ", string, contenth->rating_size);
         }
 	mp_msg(MSGT_HEADER,MSGL_V,"\n");
@@ -418,7 +416,7 @@
 } else if (best_video > 0 && demuxer->video->id == -1) demuxer->video->id = best_video;
 
 #if 0
-if(verbose){
+if( mp_msg_test(MSGT_HEADER,MSGL_V) ){
     printf("ASF duration: %d\n",(int)fileh.duration);
     printf("ASF start pts: %d\n",(int)fileh.start_timestamp);
     printf("ASF end pts: %d\n",(int)fileh.end_timestamp);
--- a/libmpdemux/aviheader.c	Fri Mar 24 02:31:29 2006 +0000
+++ b/libmpdemux/aviheader.c	Fri Mar 24 08:12:03 2006 +0000
@@ -185,7 +185,7 @@
       stream_read(demuxer->stream,(char*) &avih,MIN(size2,sizeof(avih)));
       le2me_MainAVIHeader(&avih); // swap to machine endian
       chunksize-=MIN(size2,sizeof(avih));
-      if(verbose>0) print_avih(&avih); // else print_avih_flags(&avih);
+      if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_avih(&avih); // else print_avih_flags(&avih);
       break;
     case ckidSTREAMHEADER: {      // read 'strh'
       AVIStreamHeader h;
@@ -202,7 +202,7 @@
         memcpy(&sh_audio->audio,&h,sizeof(h));
       }
       last_fccType=h.fccType;
-      if(verbose>=1) print_strh(&h);
+      if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_strh(&h);
       break; }
     case mmioFOURCC('i', 'n', 'd', 'x'): {
       uint32_t i;
@@ -254,7 +254,7 @@
 	// fixup MS-RLE header (seems to be broken for <256 color files)
 	if(sh_video->bih->biCompression<=1 && sh_video->bih->biSize==40)
 	    sh_video->bih->biSize=chunksize;
-        if(verbose>=1) print_video_header(sh_video->bih);
+        if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_video_header(sh_video->bih);
         chunksize=0;
 //        sh_video->fps=(float)sh_video->video.dwRate/(float)sh_video->video.dwScale;
 //        sh_video->frametime=(float)sh_video->video.dwScale/(float)sh_video->video.dwRate;
@@ -309,7 +309,7 @@
 	    sh_audio->wf=realloc(sh_audio->wf, sizeof(WAVEFORMATEX)+sh_audio->wf->cbSize);
 	}
         chunksize=0;
-        if(verbose>=1) print_wave_header(sh_audio->wf);
+        if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_wave_header(sh_audio->wf);
 	++priv->audio_streams;
 //        if(demuxer->audio->id==-1) demuxer->audio->id=stream_id;
       }
@@ -332,7 +332,7 @@
 	if (sh_video) {
 		sh_video->aspect = GET_AVI_ASPECT(vprp->dwFrameAspectRatio);
 	}
-	if(verbose>=1) print_vprp(vprp);
+	if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_vprp(vprp);
 	free(vprp);
 	break;
     }
@@ -368,7 +368,7 @@
 	entry->dwFlags&=0xffff;
       }
       chunksize-=priv->idx_size<<4;
-      if(verbose>=2) print_index(priv->idx,priv->idx_size);
+      if( mp_msg_test(MSGT_HEADER,MSGL_DBG2) ) print_index(priv->idx,priv->idx_size);
     }
     break;
     /* added May 2002 */
@@ -539,7 +539,7 @@
 	}
     }
 
-    if (verbose>=2) print_index(priv->idx, priv->idx_size);
+    if ( mp_msg_test(MSGT_HEADER,MSGL_DBG2) ) print_index(priv->idx, priv->idx_size);
 
     demuxer->movi_end=demuxer->stream->end_pos;
 
@@ -677,7 +677,7 @@
   }
   priv->idx_size=priv->idx_pos;
   mp_msg(MSGT_HEADER,MSGL_INFO,MSGTR_MPDEMUX_AVIHDR_IdxGeneratedForHowManyChunks,priv->idx_size);
-  if(verbose>=2) print_index(priv->idx,priv->idx_size);
+  if( mp_msg_test(MSGT_HEADER,MSGL_DBG2) ) print_index(priv->idx,priv->idx_size);
 
   /* Write generated index to a file */
   if (index_file_save) {
--- a/libmpdemux/demux_asf.c	Fri Mar 24 02:31:29 2006 +0000
+++ b/libmpdemux/demux_asf.c	Fri Mar 24 08:12:03 2006 +0000
@@ -178,7 +178,7 @@
             unsigned char segsizetype=0x80;
             int seg=-1;
             
-            if(verbose>1){
+            if( mp_msg_test(MSGT_DEMUX,MSGL_DBG2) ){
                 int i;
                 for(i=0;i<16;i++) printf(" %02X",asf_packet[i]);
                 printf("\n");
@@ -260,7 +260,7 @@
 
               if(p>=p_end) mp_msg(MSGT_DEMUX,MSGL_V,"Warning! invalid packet 1, sig11 coming soon...\n");
 
-              if(verbose>1){
+              if( mp_msg_test(MSGT_DEMUX,MSGL_DBG2) ){
                 int i;
                 printf("seg %d:",seg);
                 for(i=0;i<16;i++) printf(" %02X",p[i]);
--- a/libmpdemux/demux_audio.c	Fri Mar 24 02:31:29 2006 +0000
+++ b/libmpdemux/demux_audio.c	Fri Mar 24 08:12:03 2006 +0000
@@ -438,7 +438,7 @@
      }
     }
 
-    if(verbose>0) print_wave_header(w);
+    if( mp_msg_test(MSGT_DEMUX,MSGL_V) ) print_wave_header(w);
     if(l)
       stream_skip(s,l);
     do
--- a/libmpdemux/demux_lavf.c	Fri Mar 24 02:31:29 2006 +0000
+++ b/libmpdemux/demux_lavf.c	Fri Mar 24 08:12:03 2006 +0000
@@ -237,7 +237,7 @@
                 sh_audio->format = 0x7;
                 break;
             }
-            if(verbose>=1) print_wave_header(sh_audio->wf);
+            if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_wave_header(sh_audio->wf);
             if(demuxer->audio->id != i && demuxer->audio->id != -1)
                 st->discard= AVDISCARD_ALL;
             else{
@@ -286,7 +286,7 @@
             sh_video->ds= demuxer->video;
             if(codec->extradata_size)
                 memcpy(sh_video->bih + 1, codec->extradata, codec->extradata_size);
-            if(verbose>=1) print_video_header(sh_video->bih);
+            if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_video_header(sh_video->bih);
 /*    short 	biPlanes;
     int  	biXPelsPerMeter;
     int  	biYPelsPerMeter;
--- a/libmpdemux/demux_mov.c	Fri Mar 24 02:31:29 2006 +0000
+++ b/libmpdemux/demux_mov.c	Fri Mar 24 08:12:03 2006 +0000
@@ -1802,7 +1802,7 @@
     }
 
 #if 1
-    if(verbose>2){
+    if( mp_msg_test(MSGT_DEMUX,MSGL_DBG3) ){
 	for(t_no=0;t_no<priv->track_db;t_no++){
 	    mov_track_t* trak=priv->tracks[t_no];
 	    if(trak->type==MOV_TRAK_GENERIC){
--- a/libmpdemux/demux_ogg.c	Fri Mar 24 02:31:29 2006 +0000
+++ b/libmpdemux/demux_ogg.c	Fri Mar 24 08:12:03 2006 +0000
@@ -993,7 +993,7 @@
 		   (int)inf.version_minor, 
 		   (int)inf.version_subminor, 
 		   n_video - 1);
-	    if(verbose>0) print_video_header(sh_v->bih);
+	    if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_video_header(sh_v->bih);
 	}
 #   endif /* HAVE_OGGTHEORA */
 #   ifdef HAVE_FLAC
@@ -1036,7 +1036,7 @@
 	n_video++;
 	mp_msg(MSGT_DEMUX,MSGL_INFO,"[Ogg] stream %d: video (FOURCC %c%c%c%c), -vid %d\n",
 	       ogg_d->num_sub,pack.packet[68],pack.packet[69],pack.packet[70],pack.packet[71],n_video-1);
-	if(verbose>0) print_video_header(sh_v->bih);
+	if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_video_header(sh_v->bih);
 	// Old audio header
       } else if(get_uint32(pack.packet+96) == 0x05589F81) {
 	unsigned int extra_size;
@@ -1060,7 +1060,7 @@
 	ogg_d->subs[ogg_d->num_sub].id = n_audio;
 	n_audio++;
 	mp_msg(MSGT_DEMUX,MSGL_INFO,"[Ogg] stream %d: audio (format 0x%04x), -aid %d\n",ogg_d->num_sub,sh_a->format,n_audio-1);
-	if(verbose>0) print_wave_header(sh_a->wf);
+	if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_wave_header(sh_a->wf);
       } else
 	mp_msg(MSGT_DEMUX,MSGL_WARN,"Ogg stream %d contains an old header but the header type is unknown\n",ogg_d->num_sub);
 
@@ -1092,7 +1092,7 @@
 	n_video++;
 	mp_msg(MSGT_DEMUX,MSGL_INFO,"[Ogg] stream %d: video (FOURCC %c%c%c%c), -vid %d\n",
 	       ogg_d->num_sub,st->subtype[0],st->subtype[1],st->subtype[2],st->subtype[3],n_video-1);
-	if(verbose>0) print_video_header(sh_v->bih);
+	if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_video_header(sh_v->bih);
 	/// New audio header
       } else if(strncmp(st->streamtype,"audio",5) == 0) {
 	char buffer[5];
@@ -1131,7 +1131,7 @@
 	ogg_d->subs[ogg_d->num_sub].id = n_audio;
 	n_audio++;
 	mp_msg(MSGT_DEMUX,MSGL_INFO,"[Ogg] stream %d: audio (format 0x%04x), -aid %d\n",ogg_d->num_sub,sh_a->format,n_audio-1);
-	if(verbose>0) print_wave_header(sh_a->wf);
+	if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_wave_header(sh_a->wf);
 
 	/// Check for text (subtitles) header
       } else if (strncmp(st->streamtype, "text", 4) == 0) {
--- a/libmpdemux/demux_real.c	Fri Mar 24 02:31:29 2006 +0000
+++ b/libmpdemux/demux_real.c	Fri Mar 24 08:12:03 2006 +0000
@@ -159,7 +159,7 @@
     real_index_table_t *index;
     int i, entries;
 
-    if (verbose<=1)
+    if ( mp_msg_test(MSGT_DEMUX,MSGL_V) )
 	return;
     
     if (stream_id >= MAX_STREAMS)
@@ -1448,7 +1448,7 @@
 		    sh->wf->wFormatTag = sh->format;
 		    
 		    mp_msg(MSGT_DEMUX,MSGL_V,"audio fourcc: %.4s (%x)\n", (char *)&sh->format, sh->format);
-		    if (verbose > 0)
+		    if ( mp_msg_test(MSGT_DEMUX,MSGL_V) )
 		    print_wave_header(sh->wf);
 
 		    /* Select audio stream with highest bitrate if multirate file*/
--- a/libmpdemux/demuxer.c	Fri Mar 24 02:31:29 2006 +0000
+++ b/libmpdemux/demuxer.c	Fri Mar 24 08:12:03 2006 +0000
@@ -340,7 +340,7 @@
 int ds_fill_buffer(demux_stream_t *ds){
   demuxer_t *demux=ds->demuxer;
   if(ds->current) free_demux_packet(ds->current);
-  if(verbose>2){
+  if( mp_msg_test(MSGT_DEMUXER,MSGL_DBG3) ){
     if(ds==demux->audio) mp_dbg(MSGT_DEMUXER,MSGL_DBG3,"ds_fill_buffer(d_audio) called\n");else
     if(ds==demux->video) mp_dbg(MSGT_DEMUXER,MSGL_DBG3,"ds_fill_buffer(d_video) called\n");else
     if(ds==demux->sub)   mp_dbg(MSGT_DEMUXER,MSGL_DBG3,"ds_fill_buffer(d_sub) called\n");else
--- a/libmpdemux/http.c	Fri Mar 24 02:31:29 2006 +0000
+++ b/libmpdemux/http.c	Fri Mar 24 08:12:03 2006 +0000
@@ -735,7 +735,7 @@
 		}
 
 		stream->fd=fd;
-		if( verbose>0 ) {
+		if( mp_msg_test(MSGT_NETWORK,MSGL_V) ) {
 			http_debug_hdr( http_hdr );
 		}
 		
--- a/libmpdemux/stream.c	Fri Mar 24 02:31:29 2006 +0000
+++ b/libmpdemux/stream.c	Fri Mar 24 08:12:03 2006 +0000
@@ -32,7 +32,6 @@
 #include "m_struct.h"
 
 
-extern int verbose; // defined in mplayer.c
 void cache_uninit(stream_t *s); // defined in cache2.c
 
 //#include "vcd_read_bincue.h"
@@ -246,7 +245,7 @@
 int stream_seek_long(stream_t *s,off_t pos){
 off_t newpos=0;
 
-//  if(verbose>=3) printf("seek_long to 0x%X\n",(unsigned int)pos);
+//  if( mp_msg_test(MSGT_STREAM,MSGL_DBG3) ) printf("seek_long to 0x%X\n",(unsigned int)pos);
 
   s->buf_pos=s->buf_len=0;
 
@@ -271,7 +270,7 @@
     break;
   }
 
-if(verbose>=3){
+if( mp_msg_test(MSGT_STREAM,MSGL_DBG3) ){
   printf("s->pos=%"PRIX64"  newpos=%"PRIX64"  new_bufpos=%"PRIX64"  buflen=%X  \n",
     (int64_t)s->pos,(int64_t)newpos,(int64_t)pos,s->buf_len);
 }
--- a/libmpdemux/video.c	Fri Mar 24 02:31:29 2006 +0000
+++ b/libmpdemux/video.c	Fri Mar 24 08:12:03 2006 +0000
@@ -285,7 +285,7 @@
       int i=sync_video_packet(d_video);
       if(i==0x1B3) break; // found it!
       if(!i || !skip_video_packet(d_video)){
-        if(verbose>0)  mp_msg(MSGT_DECVIDEO,MSGL_V,"NONE :(\n");
+        if( mp_msg_test(MSGT_DECVIDEO,MSGL_V) )  mp_msg(MSGT_DECVIDEO,MSGL_V,"NONE :(\n");
         mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MpegNoSequHdr);
 	return 0;
       }
--- a/libvo/vesa_lvo.c	Fri Mar 24 02:31:29 2006 +0000
+++ b/libvo/vesa_lvo.c	Fri Mar 24 08:12:03 2006 +0000
@@ -20,6 +20,7 @@
 #include <string.h>
 
 #include "config.h"
+#include "mp_msg.h"
 
 #include "vesa_lvo.h"
 #include "img_format.h"
@@ -40,7 +41,6 @@
 static uint8_t next_frame;
 static mga_vid_config_t mga_vid_config;
 static unsigned image_bpp,image_height,image_width,src_format;
-extern int verbose;
 uint32_t vlvo_control(uint32_t request, void *data, ...);
 
 #define PIXEL_SIZE() ((video_mode_info.BitsPerPixel+7)/8)
@@ -54,7 +54,8 @@
   printf("vesa_lvo: This branch is no longer supported.\n"
 	 "vesa_lvo: Please use -vo vesa:vidix instead\n");
   return -1;
-  if(verbose > 1) printf("vesa_lvo: vlvo_preinit(%s) was called\n",drvname);
+  if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
+    printf("vesa_lvo: vlvo_preinit(%s) was called\n",drvname); }
 	lvo_handler = open(drvname,O_RDWR);
 	if(lvo_handler == -1)
 	{
@@ -78,7 +79,8 @@
   printf("vesa_lvo: This branch is no longer supported.\n"
 	 "vesa_lvo: Please use -vo vesa:vidix instead\n");
   return -1;
-  if(verbose > 1) printf("vesa_lvo: vlvo_init() was called\n");
+  if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
+    printf("vesa_lvo: vlvo_init() was called\n"); }
 	image_width = src_width;
 	image_height = src_height;
 	mga_vid_config.version=MGA_VID_VERSION;
@@ -146,7 +148,8 @@
 
 void vlvo_term( void )
 {
-  if(verbose > 1) printf("vesa_lvo: vlvo_term() was called\n");
+  if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
+    printf("vesa_lvo: vlvo_term() was called\n"); }
 	ioctl( lvo_handler,MGA_VID_OFF,0 );
 	munmap(frames[0],mga_vid_config.frame_size*mga_vid_config.num_frames);
 	if(lvo_handler != -1) close(lvo_handler);
@@ -194,7 +197,8 @@
 
 uint32_t vlvo_draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y)
 {
- if(verbose > 1) printf("vesa_lvo: vlvo_draw_slice() was called\n");
+ if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
+   printf("vesa_lvo: vlvo_draw_slice() was called\n"); }
     if(src_format == IMGFMT_YV12 || src_format == IMGFMT_I420 || src_format == IMGFMT_IYUV)
 	vlvo_draw_slice_420(image,stride,w,h,x,y);
     else
@@ -213,13 +217,15 @@
 {
 /* Note it's very strange but sometime for YUY2 draw_frame is called */
   memcpy(lvo_mem,image[0],mga_vid_config.frame_size);
-  if(verbose > 1) printf("vesa_lvo: vlvo_draw_frame() was called\n");
+  if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
+    printf("vesa_lvo: vlvo_draw_frame() was called\n"); }
   return 0;
 }
 
 void     vlvo_flip_page(void)
 {
-  if(verbose > 1) printf("vesa_lvo: vlvo_flip_page() was called\n");
+  if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
+    printf("vesa_lvo: vlvo_flip_page() was called\n"); }
   if(vo_doublebuffering)
   {
 	ioctl(lvo_handler,MGA_VID_FSEL,&next_frame);
@@ -277,7 +283,8 @@
 
 void     vlvo_draw_osd(void)
 {
-  if(verbose > 1) printf("vesa_lvo: vlvo_draw_osd() was called\n");
+  if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
+    printf("vesa_lvo: vlvo_draw_osd() was called\n"); }
   /* TODO: hw support */
 #if 0
 /* disable this stuff until new fbvid.h interface will be implemented
@@ -289,7 +296,8 @@
 
 uint32_t vlvo_query_info(uint32_t format)
 {
-  if(verbose > 1) printf("vesa_lvo: query_format was called: %x (%s)\n",format,vo_format_name(format));
+  if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
+    printf("vesa_lvo: query_format was called: %x (%s)\n",format,vo_format_name(format)); }
   return VFCAP_CSP_SUPPORTED;
 }
 
--- a/libvo/vo_png.c	Fri Mar 24 02:31:29 2006 +0000
+++ b/libvo/vo_png.c	Fri Mar 24 08:12:03 2006 +0000
@@ -14,6 +14,7 @@
 
 #include <png.h>
 
+#include "mp_msg.h"
 #include "config.h"
 #include "video_out.h"
 #include "video_out_internal.h"
@@ -29,7 +30,6 @@
 
 LIBVO_EXTERN (png)
 
-extern int verbose;
 int z_compression = Z_NO_COMPRESSION;
 static int framenum = 0;
 
@@ -50,7 +50,8 @@
 		    printf("PNG Info: (0 = no compression, 1 = fastest, lowest - 9 best, slowest compression)\n");
 	    }	    
     
-    if(verbose)	printf("PNG Compression level %i\n", z_compression);   
+    if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
+        printf("PNG Compression level %i\n", z_compression); }
 	  	
     return 0;
 }
@@ -70,13 +71,15 @@
     png.info_ptr = png_create_info_struct(png.png_ptr);
    
     if (!png.png_ptr) {
-       if(verbose > 1) printf("PNG Failed to init png pointer\n");
+       if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
+           printf("PNG Failed to init png pointer\n"); }
        png.status = ERROR;
        return png;
     }   
     
     if (!png.info_ptr) {
-       if(verbose > 1) printf("PNG Failed to init png infopointer\n");
+       if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
+           printf("PNG Failed to init png infopointer\n"); }
        png_destroy_write_struct(&png.png_ptr,
          (png_infopp)NULL);
        png.status = ERROR;
@@ -84,7 +87,8 @@
     }
     
     if (setjmp(png.png_ptr->jmpbuf)) {
-	if(verbose > 1) printf("PNG Internal error!\n");    
+	if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
+            printf("PNG Internal error!\n");}
         png_destroy_write_struct(&png.png_ptr, &png.info_ptr);
         fclose(png.fp);
         png.status = ERROR;
@@ -98,7 +102,8 @@
        	return png;
     }	    
     
-    if(verbose > 1) printf("PNG Init IO\n");
+    if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
+        printf("PNG Init IO\n"); }
     png_init_io(png.png_ptr, png.fp);
 
     /* set the zlib compression level */
@@ -112,11 +117,13 @@
        8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE,
        PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
     
-    if(verbose > 1) printf("PNG Write Info\n");
+    if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
+        printf("PNG Write Info\n"); }
     png_write_info(png.png_ptr, png.info_ptr);
     
     if(swapped) {
-    	if(verbose > 1) printf("PNG Set BGR Conversion\n");
+    	if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
+            printf("PNG Set BGR Conversion\n"); }
     	png_set_bgr(png.png_ptr);
     }	
 
@@ -126,10 +133,12 @@
        
 static uint8_t destroy_png(struct pngdata png) {
 	    
-    if(verbose > 1) printf("PNG Write End\n");
+    if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
+        printf("PNG Write End\n"); }
     png_write_end(png.png_ptr, png.info_ptr);
 
-    if(verbose > 1) printf("PNG Destroy Write Struct\n");
+    if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
+        printf("PNG Destroy Write Struct\n"); }
     png_destroy_write_struct(&png.png_ptr, &png.info_ptr);
     
     fclose (png.fp);
@@ -155,14 +164,16 @@
 	    return 1;
     }	     
 
-    if(verbose > 1) printf("PNG Creating Row Pointers\n");
+    if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
+        printf("PNG Creating Row Pointers\n"); }
     for ( k = 0; k < mpi->h; k++ )
 	row_pointers[k] = mpi->planes[0]+mpi->stride[0]*k;
 
     //png_write_flush(png.png_ptr);
     //png_set_flush(png.png_ptr, nrows);
 
-    if(verbose > 1) printf("PNG Writing Image Data\n");
+    if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
+        printf("PNG Writing Image Data\n"); }
     png_write_image(png.png_ptr, row_pointers);
 
     destroy_png(png);
--- a/libvo/vo_sdl.c	Fri Mar 24 02:31:29 2006 +0000
+++ b/libvo/vo_sdl.c	Fri Mar 24 08:12:03 2006 +0000
@@ -105,6 +105,7 @@
 #include <string.h>
 #include <inttypes.h>
 
+#include "mp_msg.h"
 #include "config.h"
 #include "video_out.h"
 #include "video_out_internal.h"
@@ -123,8 +124,6 @@
 #include "input/mouse.h"
 #include "subopt-helper.h"
 
-extern int verbose;
-
 static vo_info_t info = 
 {
 	"SDL YUV/RGB/BGR renderer (SDL v1.1.7+ only!)",
@@ -141,14 +140,16 @@
 
 #ifdef SDL_ENABLE_LOCKS
 #define	SDL_OVR_LOCK(x)        if (SDL_LockYUVOverlay (priv->overlay)) { \
-				if(verbose) printf("SDL: Couldn't lock YUV overlay\n"); \
+				if( mp_msg_test(MSGT_VO,MSGL_V) ) { \
+				  printf("SDL: Couldn't lock YUV overlay\n");} \
 				return x; \
 	    		    }
 #define SDL_OVR_UNLOCK      SDL_UnlockYUVOverlay (priv->overlay);
 
 #define SDL_SRF_LOCK(srf, x)   if(SDL_MUSTLOCK(srf)) { \
 				if(SDL_LockSurface (srf)) { \
-					if(verbose) printf("SDL: Couldn't lock RGB surface\n"); \
+					if( mp_msg_test(MSGT_VO,MSGL_V) ) { \
+					  printf("SDL: Couldn't lock RGB surface\n"); } \
 					return x; \
 				} \
 			    }
@@ -422,18 +423,21 @@
 
 	/* other default values */
 	#ifdef SDL_NOHWSURFACE
-		if(verbose) printf("SDL: using software-surface\n");
+		if( mp_msg_test(MSGT_VO,MSGL_V) ) {
+			printf("SDL: using software-surface\n"); }
 		priv->sdlflags = SDL_SWSURFACE|SDL_RESIZABLE|SDL_ANYFORMAT;
 		priv->sdlfullflags = SDL_SWSURFACE|SDL_FULLSCREEN|SDL_ANYFORMAT;
 		// XXX:FIXME: ASYNCBLIT should be enabled for SMP systems
 	#else	
 		/*if((strcmp(priv->driver, "dga") == 0) && (priv->mode)) {
-			if(verbose) printf("SDL: using software-surface\n");
+			if( mp_msg_test(MSGT_VO,MSGL_V) ) {
+				printf("SDL: using software-surface\n"); }
 			priv->sdlflags = SDL_SWSURFACE|SDL_FULLSCREEN|SDL_ASYNCBLIT|SDL_HWACCEL|SDL_ANYFORMAT;
 			priv->sdlfullflags = SDL_SWSURFACE|SDL_FULLSCREEN|SDL_ASYNCBLIT|SDL_HWACCEL|SDL_ANYFORMAT;
 		}	
 		else {	*/
-			if(verbose) printf("SDL: using hardware-surface\n");
+			if( mp_msg_test(MSGT_VO,MSGL_V) ) {
+				printf("SDL: using hardware-surface\n"); }
 			priv->sdlflags = SDL_HWSURFACE|SDL_RESIZABLE/*|SDL_ANYFORMAT*/;
 			priv->sdlfullflags = SDL_HWSURFACE|SDL_FULLSCREEN/*|SDL_ANYFORMAT*/;
 			// XXX:FIXME: ASYNCBLIT should be enabled for SMP systems
@@ -483,7 +487,8 @@
 	priv->bpp = vidInfo->vfmt->BitsPerPixel;
 	if (priv->mode == YUV && priv->bpp < 16) {
 
-		if(verbose) printf("SDL: Your SDL display target wants to be at a color "
+		if( mp_msg_test(MSGT_VO,MSGL_V) )
+                    printf("SDL: Your SDL display target wants to be at a color "
                            "depth of (%d), but we need it to be at least 16 "
                            "bits, so we need to emulate 16-bit color. This is "
                            "going to slow things down; you might want to "
@@ -561,7 +566,8 @@
 #if 0
 static SDL_Rect aspect(int srcw, int srch, int dstw, int dsth) {
 	SDL_Rect newres;
-	if(verbose > 1) printf("SDL Aspect: src: %ix%i dst: %ix%i\n", srcw, srch, dstw, dsth);
+	if( mp_msg_test(MSGT_VO,MSGL_V) ) {
+		printf("SDL Aspect: src: %ix%i dst: %ix%i\n", srcw, srch, dstw, dsth); }
 	newres.h = ((float)dstw / (float)srcw * (float)srch) * ((float)dsth/((float)dstw/(MONITOR_ASPECT)));
 	if(newres.h > dsth) {
 		newres.w = ((float)dsth / (float)newres.h) * dstw;
@@ -575,7 +581,8 @@
 		newres.y = (dsth - newres.h) / 2;
 	}
 	
-	if(verbose) printf("SDL Aspect-Destinationres: %ix%i (x: %i, y: %i)\n", newres.w, newres.h, newres.x, newres.y);
+	if( mp_msg_test(MSGT_VO,MSGL_V) ) {
+		printf("SDL Aspect-Destinationres: %ix%i (x: %i, y: %i)\n", newres.w, newres.h, newres.x, newres.y); }
 
 	return newres;
 }
@@ -676,7 +683,7 @@
 	else if (mode < 0) {
         int i,j,imax;
 		mode = 0; // Default to the biggest mode avaible
-		if (verbose) for(i=0;priv->fullmodes[i];++i) 
+		if ( mp_msg_test(MSGT_VO,MSGL_V) ) for(i=0;priv->fullmodes[i];++i)
 	           printf("SDL Mode: %d:  %d x %d\n", i, priv->fullmodes[i]->w, priv->fullmodes[i]->h);
 		for(i = findArrayEnd(priv->fullmodes) - 1; i >=0; i--) {
 		  if( (priv->fullmodes[i]->w >= priv->dstwidth) && 
@@ -691,7 +698,8 @@
 		      break;
 		    }
 		  }
-		if (verbose) printf("SET SDL Mode: %d:  %d x %d\n", mode, priv->fullmodes[mode]->w, priv->fullmodes[mode]->h);
+		if ( mp_msg_test(MSGT_VO,MSGL_V) ) {
+			printf("SET SDL Mode: %d:  %d x %d\n", mode, priv->fullmodes[mode]->w, priv->fullmodes[mode]->h); }
 		priv->fullmode = mode;
         screen_surface_h = priv->fullmodes[mode]->h;
         screen_surface_w = priv->fullmodes[mode]->w;
@@ -800,8 +808,8 @@
 
     if ( vo_config_count ) sdl_close();
 
-    if(verbose) printf("SDL: Using 0x%X (%s) image format\n", format,
-                       vo_format_name(format));
+    if( mp_msg_test(MSGT_VO,MSGL_V) ) {
+      printf("SDL: Using 0x%X (%s) image format\n", format, vo_format_name(format)); }
     
     if(priv->mode != YUV) {
 		priv->sdlflags |= SDL_ANYFORMAT;
@@ -848,11 +856,13 @@
 //      printf("SDL: flags are set to: %i\n", flags);
 //	printf("SDL: Width: %i Height: %i D_Width %i D_Height: %i\n", width, height, d_width, d_height);
 	if(flags&VOFLAG_FLIPPING) {
-		if(verbose) printf("SDL: using flipped video (only with RGB/BGR/packed YUV)\n");
+		if( mp_msg_test(MSGT_VO,MSGL_V) ) {
+			printf("SDL: using flipped video (only with RGB/BGR/packed YUV)\n"); }
 		priv->flip = 1; 
 	}
 	if(flags&VOFLAG_FULLSCREEN) {
-	  	if(verbose) printf("SDL: setting zoomed fullscreen without modeswitching\n");
+	  	if( mp_msg_test(MSGT_VO,MSGL_V) ) {
+			printf("SDL: setting zoomed fullscreen without modeswitching\n"); }
 		printf("SDL: Info - please use -vm or -zoom to switch to best resolution.\n");
 		priv->fulltype = VOFLAG_FULLSCREEN;
 		set_fullmode(priv->fullmode);
@@ -860,14 +870,16 @@
 			SDL_ShowCursor(0);*/
 	} else	
 	if(flags&VOFLAG_MODESWITCHING) {
-	 	if(verbose) printf("SDL: setting zoomed fullscreen with modeswitching\n");
+	 	if( mp_msg_test(MSGT_VO,MSGL_V) ) {
+			printf("SDL: setting zoomed fullscreen with modeswitching\n"); }
 		priv->fulltype = VOFLAG_MODESWITCHING;
 		set_fullmode(priv->fullmode);
           	/*if((priv->surface = SDL_SetVideoMode (d_width ? d_width : width, d_height ? d_height : height, priv->bpp, priv->sdlfullflags)))
 			SDL_ShowCursor(0);*/
 	} else
 	if(flags&VOFLAG_SWSCALE) {
-	 	if(verbose) printf("SDL: setting zoomed fullscreen with modeswitching\n");
+	 	if( mp_msg_test(MSGT_VO,MSGL_V) ) {
+			printf("SDL: setting zoomed fullscreen with modeswitching\n"); }
 		priv->fulltype = VOFLAG_SWSCALE;
 		set_fullmode(priv->fullmode);
 	} 
@@ -878,11 +890,13 @@
 		||(strcmp(priv->driver, "Quartz") == 0)
 		||(strcmp(priv->driver, "cgx") == 0)
 		||((strcmp(priv->driver, "aalib") == 0) && priv->X)){
-			if(verbose) printf("SDL: setting windowed mode\n");
+			if( mp_msg_test(MSGT_VO,MSGL_V) ) {
+				printf("SDL: setting windowed mode\n"); }
             set_video_mode(priv->dstwidth, priv->dstheight, priv->bpp, priv->sdlflags);
 		}
 		else {
-			if(verbose) printf("SDL: setting zoomed fullscreen with modeswitching\n");
+			if( mp_msg_test(MSGT_VO,MSGL_V) ) {
+				printf("SDL: setting zoomed fullscreen with modeswitching\n"); }
 			priv->fulltype = VOFLAG_SWSCALE;
 			set_fullmode(priv->fullmode);
 		}	
@@ -1167,7 +1181,8 @@
 				    priv->windowsize.w = priv->surface->w;
 				    priv->windowsize.h = priv->surface->h;
 				//}
-				if(verbose > 2) printf("SDL: Window resize\n");
+				if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) {
+					printf("SDL: Window resize\n"); }
 			break;
 			
 			case SDL_MOUSEBUTTONDOWN:
@@ -1207,7 +1222,8 @@
 			case SDL_KEYDOWN:
 #endif			
 				keypressed = event.key.keysym.sym;
-				if(verbose > 1) printf("SDL: Key pressed: '%i'\n", keypressed);
+				if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
+					printf("SDL: Key pressed: '%i'\n", keypressed); }
 
 				/* c key pressed. c cycles through available fullscreenmodes, if we have some */
 				if ( ((keypressed == SDLK_c)) && (priv->fullmodes) ) {
@@ -1216,7 +1232,8 @@
 					if (priv->fullmode > (findArrayEnd(priv->fullmodes) - 1)) priv->fullmode = 0;
 					set_fullmode(priv->fullmode);
 	
-					if(verbose > 1) printf("SDL: Set next available fullscreen mode.\n");
+					if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
+						printf("SDL: Set next available fullscreen mode.\n"); }
 				}
 
 				else if ( keypressed == SDLK_n ) {
@@ -1227,13 +1244,15 @@
                         set_video_mode(priv->dstwidth, priv->dstheight, priv->bpp, priv->sdlflags);
 					    	priv->windowsize.w = priv->surface->w;
 						priv->windowsize.h = priv->surface->h;
-						if(verbose > 1) printf("SDL: Normal size\n");
+						if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
+							printf("SDL: Normal size\n"); }
 					} else
 					if (priv->surface->w != priv->dstwidth * 2 || priv->surface->h != priv->dstheight * 2) {
                         set_video_mode(priv->dstwidth * 2, priv->dstheight * 2, priv->bpp, priv->sdlflags);
 					    	priv->windowsize.w = priv->surface->w;
 						priv->windowsize.h = priv->surface->h;
-						if(verbose > 1) printf("SDL: Double size\n");
+						if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
+							printf("SDL: Double size\n"); }
 					}
 				}	
 
@@ -1555,7 +1574,8 @@
 #ifdef HAVE_X11
     struct sdl_priv_s *priv = &sdl_priv;
     if(priv->X) {
-		if(verbose) printf("SDL: activating XScreensaver/DPMS\n");
+		if( mp_msg_test(MSGT_VO,MSGL_V) ) {
+			printf("SDL: activating XScreensaver/DPMS\n"); }
 		vo_x11_uninit();
 	}
 #endif
@@ -1565,7 +1585,8 @@
     if(SDL_WasInit(SDL_INIT_VIDEO))
         SDL_QuitSubSystem(SDL_INIT_VIDEO);
 
-	if(verbose > 2) printf("SDL: Closed Plugin\n");
+	if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) {
+		printf("SDL: Closed Plugin\n"); }
 
 }
 
@@ -1591,7 +1612,8 @@
     priv->overlay = NULL;
     priv->surface = NULL;
 
-    if(verbose > 2) printf("SDL: Opening Plugin\n");
+    if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) {
+        printf("SDL: Opening Plugin\n"); }
 
     if(sdl_driver) {
         setenv("SDL_VIDEODRIVER", sdl_driver, 1);
@@ -1626,11 +1648,13 @@
     priv->X = 0;
 #ifdef HAVE_X11
     if(vo_init()) {
-		if(verbose) printf("SDL: deactivating XScreensaver/DPMS\n");
+		if( mp_msg_test(MSGT_VO,MSGL_V) ) {
+			printf("SDL: deactivating XScreensaver/DPMS\n"); }
 		priv->XWidth = vo_screenwidth;
 		priv->XHeight = vo_screenheight;
 		priv->X = 1;
-		if(verbose) printf("SDL: X11 Resolution %ix%i\n", priv->XWidth, priv->XHeight);
+		if( mp_msg_test(MSGT_VO,MSGL_V) ) {
+			printf("SDL: X11 Resolution %ix%i\n", priv->XWidth, priv->XHeight); }
 	}
 #endif
 
@@ -1695,10 +1719,12 @@
     if (priv->surface->flags & SDL_FULLSCREEN) {
       set_video_mode(priv->windowsize.w, priv->windowsize.h, priv->bpp, priv->sdlflags);
       SDL_ShowCursor(1);
-      if(verbose > 1) printf("SDL: Windowed mode\n");
+      if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
+        printf("SDL: Windowed mode\n"); }
     } else if (priv->fullmodes) {
       set_fullmode(priv->fullmode);
-      if(verbose > 1) printf("SDL: Set fullscreen mode\n");
+      if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
+        printf("SDL: Set fullscreen mode\n"); }
     }
     return VO_TRUE;
   }
--- a/libvo/vo_svga.c	Fri Mar 24 02:31:29 2006 +0000
+++ b/libvo/vo_svga.c	Fri Mar 24 08:12:03 2006 +0000
@@ -52,7 +52,6 @@
 //silence warnings, probably it have to go in some global header
 #define UNUSED(x) ((void)(x)) 
 
-extern int verbose;
 
 static int query_format(uint32_t format);
 static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src,
@@ -172,7 +171,7 @@
 
         force_vm=vga_getmodenumber(s);
         if(force_vm>0) {
-          if(verbose) printf("vo_svga: Forcing mode %i\n",force_vm);
+          if( mp_msg_test(MSGT_VO,MSGL_V) ) printf("vo_svga: Forcing mode %i\n",force_vm);
         }else{ 
           force_vm = 0;
         }
@@ -191,7 +190,7 @@
 int i;
 
   if (mode_capabilities&CAP_ACCEL_CLEAR){
-    if(verbose > 2)
+    if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
       printf("vo_svga: clearing box %d,%d - %d,%d with HW acceleration\n",
              x,y,w,h);
     if(mode_capabilities&CAP_ACCEL_BACKGR)  
@@ -201,7 +200,7 @@
     return;
   }
   if (mode_capabilities & CAP_LINEAR){
-    if(verbose > 2)
+    if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
       printf("vo_svga: clearing box %d,%d - %d,%d with memset\n",x,y,w,h);
     rgbplane=PageStore[0].vbase + (y*mode_stride) + (x*modeinfo->bytesperpixel);
     for(i=0;i<h;i++){
@@ -213,7 +212,7 @@
     return;
   }
   //native
-  if(verbose > 2)
+  if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
     printf("vo_svga: clearing box %d,%d - %d,%d with native draw \n",x,y,w,h);
   if(modeinfo->bytesperpixel!=0) w*=modeinfo->bytesperpixel;
   for(i=0;i<h;i++){
@@ -229,7 +228,7 @@
 int page;
 
   if(mpi->flags & MP_IMGFLAG_DIRECT){
-    if(verbose > 2)
+    if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
       printf("vo_svga: drawing direct rendered surface\n");
     cpage=(uint32_t)mpi->priv;
     assert((cpage>=0)&&(cpage<max_pages));
@@ -259,7 +258,7 @@
         (stride == mode_stride) ){ //only monolite image can be accelerated
       w=(stride*8)/mpi->bpp;//we transfer pixels in the stride so the source
 //ACCELERATE
-      if(verbose>2) 
+      if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
         printf("vo_svga: using HW PutImage (x=%d,y=%d,w=%d,h=%d)\n",x,y,w,h);
       if(mode_capabilities & CAP_ACCEL_BACKGR)
         vga_accel(ACCEL_SYNC);
@@ -270,7 +269,7 @@
   
     if( mode_capabilities&CAP_LINEAR){
 //DIRECT  
-      if(verbose>2) 
+      if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
         printf("vo_svga: using Direct memcpy (x=%d,y=%d,w=%d,h=%d)\n",x,y,w,h);
       bytesperline=(w*mpi->bpp)/8;
       base=PageStore[cpage].vbase + (y*mode_stride) + (x*mpi->bpp)/8;     
@@ -292,7 +291,7 @@
   //one byte per pixel! svgalib innovation
     if(mpi->imgfmt==IMGFMT_RG4B || mpi->imgfmt==IMGFMT_BG4B) length=w;
   
-    if(verbose>2) 
+    if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
       printf("vo_svga: using Native vga_draw(x=%d,y=%d,w=%d,h=%d)\n",x,y,w,h);
     y+=PageStore[cpage].yoffset;//y position of the page beggining
     for(i=0;i<h;i++){
@@ -328,7 +327,7 @@
   for(i=1;i<=lastmode;i++){
     vminfo = vga_getmodeinfo(i);
     if( vminfo == NULL ) continue;
-    if(verbose>3)
+    if( mp_msg_test(MSGT_VO,MSGL_DBG4) )
       printf("vo_svga: testing mode %d (%s)\n",i,vga_getmodename(i));
     if( vga_hasmode(i) == 0 ) continue;
     if( req_bpp != bpp_from_vminfo(vminfo) )continue;
@@ -341,7 +340,7 @@
     if( bestmode==0 || prev_badness >= badness ){//modeX etc...
       prev_badness=badness;
       bestmode=i;
-      if(verbose>3)
+      if( mp_msg_test(MSGT_VO,MSGL_DBG4) )
         printf("vo_svga: found good mode %d with badness %d\n",i,badness);
     }
   }
@@ -404,7 +403,7 @@
   int32_t req_bpp;
   
   uint32_t accflags;
-  if(verbose)
+  if( mp_msg_test(MSGT_VO,MSGL_V) )
     printf("vo_svga: config(%i, %i, %i, %i, %08x, %s, %08x)\n", width, height,
            d_width, d_height, flags, title, format);
 //Only RGB modes supported
@@ -414,7 +413,7 @@
   if( vo_dbpp!=0 && vo_dbpp!=req_bpp) {assert(0);return-1;}
     
   if(!force_vm) {
-    if (verbose) {
+    if ( mp_msg_test(MSGT_VO,MSGL_V) ) {
       printf("vo_svga: Looking for the best resolution...\n");
       printf("vo_svga: req_w: %d, req_h: %d, bpp: %d\n",req_w,req_h,req_bpp);
     }
@@ -593,7 +592,7 @@
 
 static void draw_osd(void)
 {
-  if(verbose > 3)
+  if( mp_msg_test(MSGT_VO,MSGL_DBG4) )
      printf("vo_svga: draw_osd()\n");
   //only modes with bytesperpixel>0 can draw OSD
   if(modeinfo->bytesperpixel==0) return;
@@ -622,10 +621,10 @@
   PageStore[old_page].locks=PAGE_EMPTY;
   PageStore[cpage].locks=PAGE_BUSY;
 
-  if(verbose > 2)
+  if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
     printf("vo_svga: viewing page %d\n",cpage);
   if(sync_flip && old_page!=cpage){
-    if(verbose > 2) printf("vo_svga:vga_waitretrace\n");
+    if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) printf("vo_svga:vga_waitretrace\n");
     vga_waitretrace();
   }
   vga_setdisplaystart(PageStore[cpage].doffset);
@@ -650,7 +649,7 @@
 int i,lastmode;
 vga_modeinfo * vminfo;
 
-  if (verbose >3)
+  if ( mp_msg_test(MSGT_VO,MSGL_DBG4) )
     printf("vo_svga: query_format=%X \n",format);
 //only RGB modes supported
   if( (!IMGFMT_IS_RGB(format)) && (!IMGFMT_IS_BGR(format)) ) return 0; 
@@ -688,7 +687,7 @@
                        unsigned char *srca, int stride) {
   char* base;
 
-  if(verbose>2)
+  if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
     printf("vo_svga: draw_alpha(x0=%d,y0=%d,w=%d,h=%d,src=%p,srca=%p,stride=%d\n",
            x0,y0,w,h,src,srca,stride);
   if(!blackbar_osd) {
@@ -697,7 +696,7 @@
     y0+=y_pos;
   }
   
-  if(verbose>3)
+  if( mp_msg_test(MSGT_VO,MSGL_DBG4) )
     printf("vo_svga: OSD draw in page %d\n",cpage);
   base=PageStore[cpage].vbase + y0*mode_stride + x0*modeinfo->bytesperpixel;
   switch (mode_bpp) {
@@ -745,7 +744,7 @@
       mpi->planes[0] = PageStore[page].vbase + 
              y_pos*mode_stride + (x_pos*mpi->bpp)/8;
       mpi->priv=(void *)page;
-      if(verbose>2)
+      if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
         printf("vo_svga: direct render allocated! page=%d\n",page);
       return(VO_TRUE);
     }
--- a/libvo/vo_vesa.c	Fri Mar 24 02:31:29 2006 +0000
+++ b/libvo/vo_vesa.c	Fri Mar 24 08:12:03 2006 +0000
@@ -43,6 +43,7 @@
 #ifdef CONFIG_VIDIX
 #include "vosub_vidix.h"
 #endif
+#include "mp_msg.h"
 
 #include "postproc/swscale.h"
 #include "libmpcodecs/vf_scale.h"
@@ -52,8 +53,6 @@
 extern vo_functions_t video_out_png;
 #endif
 
-extern int verbose;
-
 extern char *monitor_hfreq_str;
 extern char *monitor_vfreq_str;
 extern char *monitor_dotclock_str;
@@ -280,7 +279,7 @@
     int dstride=HAS_DGA()?video_mode_info.XResolution:dstW;
     uint8_t *dst[3]= {dga_buffer, NULL, NULL};
     int dstStride[3];
-    if(verbose > 2)
+    if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
 	printf("vo_vesa: draw_slice was called: w=%u h=%u x=%u y=%u\n",w,h,x,y);
     dstStride[0]=dstride*((dstBpp+7)/8);
     dstStride[1]=
@@ -361,7 +360,7 @@
 static void draw_osd(void)
 {
  uint32_t w,h;
- if(verbose > 2)
+ if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
 	printf("vo_vesa: draw_osd was called\n");
  {
 #ifdef OSD_OUTSIDE_MOVIE
@@ -377,7 +376,7 @@
 
 static void flip_page(void)
 {
-  if(verbose > 2)
+  if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
 	printf("vo_vesa: flip_page was called\n");
   if(flip_trigger) 
   {
@@ -412,7 +411,7 @@
 /* is called for rgb only */
 static int draw_frame(uint8_t *src[])
 {
-    if(verbose > 2)
+    if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
         printf("vo_vesa: draw_frame was called\n");
     if(sws)
     {
@@ -463,7 +462,7 @@
 
 static int query_format(uint32_t format)
 {
-    if(verbose > 2)
+    if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
         printf("vo_vesa: query_format was called: %x (%s)\n",format,vo_format_name(format));
 #ifdef CONFIG_VIDIX
     if(vidix_name)return(vidix_query_fourcc(format));
@@ -538,7 +537,8 @@
   screen_size = video_mode_info.XResolution*video_mode_info.YResolution*((dstBpp+7)/8);
   if(screen_size%64) screen_size=((screen_size/64)*64)+64;
   total = vsize / screen_size;
-  if(verbose) printf("vo_vesa: Can use up to %u video buffers\n",total);
+  if( mp_msg_test(MSGT_VO,MSGL_V) )
+    printf("vo_vesa: Can use up to %u video buffers\n",total);
   i = 0;
   offset = 0;
   total = min(total,nbuffs);
@@ -715,7 +715,7 @@
 		   dstFourcc = IMGFMT_BGR16;
 		   break;
 	}
-	if(verbose)
+	if( mp_msg_test(MSGT_VO,MSGL_V) )
 	{
 	  printf("vo_vesa: Requested mode: %ux%u@%u (%s)\n",width,height,bpp,vo_format_name(format));
 	  printf("vo_vesa: Total modes found: %u\n",num_modes);
@@ -758,7 +758,7 @@
 				best_mode_idx = i;
 			   }
 		   }
-		if(verbose)
+		if( mp_msg_test(MSGT_VO,MSGL_V) )
 		{
 		  printf("vo_vesa: Mode (%03u): mode=%04X %ux%u@%u attr=%04X\n"
 			 "vo_vesa:             #planes=%u model=%u(%s) #pages=%u\n"
@@ -783,7 +783,8 @@
 			PRINT_VBE_ERR("vbeGetMode",err);
 			return -1;
 		}
-		if(verbose) printf("vo_vesa: Initial video mode: %x\n",init_mode);
+		if( mp_msg_test(MSGT_VO,MSGL_V) ) {
+			printf("vo_vesa: Initial video mode: %x\n",init_mode); }
 		if((err=vbeGetModeInfo(video_mode,&video_mode_info)) != VBE_OK)
 		{
 			PRINT_VBE_ERR("vbeGetModeInfo",err);
@@ -828,7 +829,8 @@
 			printf("vo_vesa: Can't initialize SwScaler\n");
 			return -1;
 		    }
-		    else if(verbose) printf("vo_vesa: Using SW BES emulator\n");
+		    else if( mp_msg_test(MSGT_VO,MSGL_V) ) {
+			printf("vo_vesa: Using SW BES emulator\n"); }
 		}
 		if((video_mode_info.WinAAttributes & FRAME_MODE) == FRAME_MODE)
 		   win.idx = 0; /* frame A */
@@ -855,7 +857,8 @@
 		      printf("vo_vesa: Using DGA (physical resources: %08lXh, %08lXh)"
 			     ,video_mode_info.PhysBasePtr
 			     ,vsize);
-		      if(verbose) printf(" at %08lXh",(unsigned long)lfb);
+		      if( mp_msg_test(MSGT_VO,MSGL_V) ) {
+			printf(" at %08lXh",(unsigned long)lfb); }
 		      printf("\n");
 		      if(!(multi_size = fillMultiBuffer(vsize,2))) return -1;
 		      if(vo_doublebuffering && multi_size < 2)
@@ -891,7 +894,7 @@
 		if(video_mode_info.YResolution > dstH)
 		    y_offset = (video_mode_info.YResolution - dstH) / 2;
 		else y_offset = 0;
-		if(verbose)
+		if( mp_msg_test(MSGT_VO,MSGL_V) )
 		  printf("vo_vesa: image: %ux%u screen = %ux%u x_offset = %u y_offset = %u\n"
 			,dstW,dstH
 			,video_mode_info.XResolution,video_mode_info.YResolution
@@ -915,7 +918,8 @@
 		      printf("vo_vesa: Can't allocate temporary buffer\n");
 		      return -1;
 		    }
-		    if(verbose) printf("vo_vesa: dga emulator was allocated = %p\n",dga_buffer);
+		    if( mp_msg_test(MSGT_VO,MSGL_V) ) {
+			printf("vo_vesa: dga emulator was allocated = %p\n",dga_buffer); }
 		  }
 		}
 		if((err=vbeSaveState(&init_state)) != VBE_OK)
@@ -956,7 +960,7 @@
 		}
 		/* Now we are in video mode!!!*/
 		/* Below 'return -1' is impossible */
-		if(verbose)
+		if( mp_msg_test(MSGT_VO,MSGL_V) )
 		{
 		  printf("vo_vesa: Graphics mode was activated\n");
 		  fflush(stdout);
@@ -1013,7 +1017,7 @@
 	  printf("vo_vesa: Can't find mode for: %ux%u@%u\n",width,height,bpp);
 	  return -1;
 	}
-	if(verbose)
+	if( mp_msg_test(MSGT_VO,MSGL_V) )
 	{
 	  printf("vo_vesa: VESA initialization complete\n");
 	  fflush(stdout);
@@ -1024,13 +1028,13 @@
 	    {
 		win.ptr = dga_buffer = video_base + multi_buff[i];
                 clear_screen();	/* Clear screen for stupid BIOSes */
-		if(verbose>1) paintBkGnd();
+		if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) paintBkGnd();
 	    }
 	}
 	else
 	{
             clear_screen();	/* Clear screen for stupid BIOSes */
-	    if(verbose>1)
+	    if( mp_msg_test(MSGT_VO,MSGL_DBG2) )
 	    {
 	        int x;
 	        x = (video_mode_info.XResolution/video_mode_info.XCharSize)/2-strlen(title)/2;
@@ -1047,14 +1051,14 @@
 {
     // not inited
     vesa_term();
-    if(verbose > 2)
+    if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
         printf("vo_vesa: uninit was called\n");
 }
 
 
 static void check_events(void)
 {
-    if(verbose > 2)
+    if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
         printf("vo_vesa: check_events was called\n");
 /* Nothing to do */
 }
@@ -1063,8 +1067,9 @@
 {
   int pre_init_err = 0;
   int fd;
-  if(verbose>1) printf("vo_vesa: preinit(%s) was called\n",arg);
-  if(verbose > 2)
+  if( mp_msg_test(MSGT_VO,MSGL_DBG2) )
+        printf("vo_vesa: preinit(%s) was called\n",arg);
+  if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
         printf("vo_vesa: subdevice %s is being initialized\n",arg);
   subdev_flags = 0;
   lvo_name = NULL;
@@ -1083,7 +1088,7 @@
   	return -1;
   else
   	close(fd);
-  if(verbose > 2)
+  if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
         printf("vo_subdevice: initialization returns: %i\n",pre_init_err);
   return pre_init_err;
 }
--- a/libvo/vo_xvmc.c	Fri Mar 24 02:31:29 2006 +0000
+++ b/libvo/vo_xvmc.c	Fri Mar 24 08:12:03 2006 +0000
@@ -46,8 +46,6 @@
 #define UNUSED(x) ((void)(x))
 
 
-extern int vo_verbose;
-
 static int benchmark;
 static int use_sleep;
 static int first_frame;//draw colorkey on first frame
@@ -270,21 +268,26 @@
 
    rez = XvQueryAdaptors(mDisplay,DefaultRootWindow(mDisplay),&num_adaptors,&ai);
    if( rez != Success ) return -1;
-   if( verbose > 2 ) printf("vo_xvmc: Querying %d adaptors\n",num_adaptors);
+   if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) {
+      printf("vo_xvmc: Querying %d adaptors\n",num_adaptors); }
    for(i=0; i<num_adaptors; i++)
    {
-      if( verbose > 2) printf("vo_xvmc: Quering adaptor #%d\n",i);
+      if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) {
+         printf("vo_xvmc: Quering adaptor #%d\n",i); }
       if( ai[i].type == 0 ) continue;// we need at least dummy type!
 //probing ports
       for(p=ai[i].base_id; p<ai[i].base_id+ai[i].num_ports; p++)
       {
-         if( verbose > 2) printf("vo_xvmc: probing port #%ld\n",p);
+         if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) {
+            printf("vo_xvmc: probing port #%ld\n",p); }
 	 mc_surf_list = XvMCListSurfaceTypes(mDisplay,p,&mc_surf_num);
 	 if( mc_surf_list == NULL || mc_surf_num == 0){
-	    if( verbose > 2) printf("vo_xvmc: No XvMC supported. \n");
+	    if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) {
+               printf("vo_xvmc: No XvMC supported. \n"); }
 	    continue;
 	 }
-	 if( verbose > 2) printf("vo_xvmc: XvMC list have %d surfaces\n",mc_surf_num);
+	 if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) {
+            printf("vo_xvmc: XvMC list have %d surfaces\n",mc_surf_num); }
 //we have XvMC list!
          for(s=0; s<mc_surf_num; s++)
          {
@@ -301,7 +304,8 @@
             if(!query){
                rez = XvGrabPort(mDisplay,p,CurrentTime);
 	       if(rez != Success){
-	          if (verbose > 2) printf("vo_xvmc: Fail to grab port %ld\n",p);
+	          if ( mp_msg_test(MSGT_VO,MSGL_DBG3) ) {
+                     printf("vo_xvmc: Fail to grab port %ld\n",p); }
 	          continue;
 	       }
 	       printf("vo_xvmc: Port %ld grabed\n",p);
@@ -320,7 +324,7 @@
 surface_found:
 
    memcpy(surf_info,&mc_surf_list[s],sizeof(XvMCSurfaceInfo));
-   if( verbose > 2 || !query) 
+   if( mp_msg_test(MSGT_VO,MSGL_DBG3) || !query)
       printf("vo_xvmc: Found matching surface with id=%X on %ld port at %d adapter\n",
              mc_surf_list[s].surface_type_id,p,i);
    return mc_surf_list[s].surface_type_id;
@@ -336,7 +340,7 @@
    rndr = (xvmc_render_state_t*)mpi->priv;//there is copy in plane[2]
    assert( rndr != NULL );
    assert( rndr->magic == MP_XVMC_RENDER_MAGIC );
-   if( verbose > 3 ) 
+   if( mp_msg_test(MSGT_VO,MSGL_DBG4) )
        printf("vo_xvmc: draw_image(show rndr=%p)\n",rndr);
 // the surface have passed vf system without been skiped, it will be displayed
    rndr->state |= MP_XVMC_STATE_DISPLAY_PENDING;
@@ -500,7 +504,7 @@
       surface_render[i].chroma_format = surface_info.chroma_format;
       surface_render[i].unsigned_intra = (surface_info.flags & XVMC_INTRA_UNSIGNED) == XVMC_INTRA_UNSIGNED;
       surface_render[i].p_surface = &surface_array[i];
-      if( verbose > 3 )
+      if( mp_msg_test(MSGT_VO,MSGL_DBG4) )
           printf("vo_xvmc: surface[%d] = %p .rndr=%p\n",i,&surface_array[i], &surface_render[i]);
    }
    number_of_surfaces = i;
@@ -532,7 +536,7 @@
                       surface_info.surface_type_id, &num_subpic);
 
       if(num_subpic != 0 && xvfmv != NULL){
-         if(verbose > 3){//Print All subpicture types for debug
+         if( mp_msg_test(MSGT_VO,MSGL_DBG4) ){//Print all subpicture types for debug
             for(s=0;s<num_subpic;s++)
                print_xvimage_format_values(&xvfmv[s]);
          }
@@ -813,7 +817,7 @@
 int rez;
 
    if(subpicture_alloc){
-      if(verbose>3)
+      if( mp_msg_test(MSGT_VO,MSGL_DBG4) )
          printf("vo_xvmc: destroying subpicture\n");
       XvMCDestroySubpicture(mDisplay,&subpicture);
       deallocate_xvimage();
@@ -836,7 +840,7 @@
    if(osd_width == 0 || osd_height == 0) 
       return;//if called before window size is known
 
-   if(verbose > 3)
+   if( mp_msg_test(MSGT_VO,MSGL_DBG4) )
       printf("vo_xvmc: creating subpicture (%d,%d) format %X\n",
               osd_width,osd_height,subpicture_info.id);
 
@@ -847,7 +851,7 @@
       printf("vo_xvmc: Create Subpicture failed, OSD disabled\n");
       return;
    }
-   if(verbose > 3){
+   if( mp_msg_test(MSGT_VO,MSGL_DBG4) ){
    int i;
       printf("vo_xvmc: Created Subpicture:\n");
       printf("         xvimage_id=0x%X\n",subpicture.xvimage_id);
@@ -865,7 +869,7 @@
    
    //call init for the surface type
    init_osd_fnc();//init palete,clear color etc ...
-   if(verbose > 3)
+   if( mp_msg_test(MSGT_VO,MSGL_DBG4) )
       printf("vo_xvmc: clearing subpicture\n");
    clear_osd_fnc(0, 0, subpicture.width, subpicture.height);
 
@@ -877,7 +881,7 @@
 int ox,oy;
 int rez;
 
-   if(verbose > 3)
+   if( mp_msg_test(MSGT_VO,MSGL_DBG4) )
       printf("vo_xvmc:composite AI44 subpicture (%d,%d - %d,%d)\n",x0,y0,w,h);
 
    for(ox=0; ox<w; ox++){
@@ -896,7 +900,7 @@
 static void draw_osd_AI44(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
 int ox,oy;
 int rez;
-   if( verbose > 3)
+   if(  mp_msg_test(MSGT_VO,MSGL_DBG4) )
       printf("vo_xvmc:composite AI44 subpicture (%d,%d - %d,%d)\n",x0,y0,w,h);
 
    for(ox=0; ox<w; ox++){
@@ -918,7 +922,7 @@
 int have_osd_to_draw;
 int rez;
 
-   if(verbose > 3)
+   if( mp_msg_test(MSGT_VO,MSGL_DBG4) )
       printf("vo_xvmc: draw_osd ,OSD_mode=%d, surface_to_show=%p\n",
              subpicture_mode,p_render_surface_to_show);
 
@@ -973,7 +977,7 @@
          p_render_surface_to_show = osd_rndr;
          p_render_surface_to_show->state = MP_XVMC_STATE_DISPLAY_PENDING;
 
-         if(verbose > 3)
+         if( mp_msg_test(MSGT_VO,MSGL_DBG4) )
             printf("vo_xvmc:draw_osd: surface_to_show changed to %p\n",osd_rndr);
       }//endof if(BLEND)
       if(subpicture_mode == BACKEND_SUBPICTURE){
@@ -1042,7 +1046,7 @@
 int i,cfs;
 
 
-   if( verbose > 3 ) 
+   if( mp_msg_test(MSGT_VO,MSGL_DBG4) )
       printf("vo_xvmc: flip_page  show(rndr=%p)\n\n",p_render_surface_to_show);
 
    if(p_render_surface_to_show == NULL) return;
@@ -1060,7 +1064,7 @@
          return; 
       }
       p_render_surface_to_show=show_queue[0];
-      if(verbose > 4)
+      if( mp_msg_test(MSGT_VO,MSGL_DBG5) )
          printf("vo_xvmc: flip_queue free_element=%d\n",free_element);
       free_element--;
       for(i=0; i<free_element; i++){
@@ -1128,7 +1132,7 @@
 
       subpicture_alloc = 0;
 
-      if(verbose > 3)
+      if( mp_msg_test(MSGT_VO,MSGL_DBG4) )
          printf("vo_xvmc: subpicture destroyed\n");
    }
 
@@ -1154,19 +1158,22 @@
       XvMCDestroyContext(mDisplay,&ctx);
       number_of_surfaces = 0;
 
-      if(verbose > 3) printf("vo_xvmc: Context sucessfuly freed\n");
+      if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) {
+         printf("vo_xvmc: Context sucessfuly freed\n"); }
    }
 
 
    if( xv_port !=0 ){
       XvUngrabPort(mDisplay,xv_port,CurrentTime);
       xv_port = 0;
-      if(verbose > 3) printf("vo_xvmc: xv_port sucessfuly ungrabed\n");
+      if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) {
+         printf("vo_xvmc: xv_port sucessfuly ungrabed\n"); }
    }
 }
 
 static void uninit(void){
-   if( verbose > 3 ) printf("vo_xvmc: uninit called\n");
+   if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) {
+      printf("vo_xvmc: uninit called\n"); }
    xvmc_free();
  //from vo_xv
 #ifdef HAVE_XF86VM
@@ -1180,7 +1187,7 @@
 XvMCSurfaceInfo qsurface_info;
 int mode_id;
 
-   if(verbose > 3)
+   if( mp_msg_test(MSGT_VO,MSGL_DBG4) )
       printf("vo_xvmc: query_format=%X\n",format);
 
    if(!IMGFMT_IS_XVMC(format)) return 0;// no caps supported
@@ -1204,7 +1211,7 @@
 xvmc_render_state_t * rndr;
 int rez;
 
-   if(verbose > 3)
+   if( mp_msg_test(MSGT_VO,MSGL_DBG4) )
       printf("vo_xvmc: draw_slice y=%d\n",y);
 
    rndr = (xvmc_render_state_t*)image[2];//this is copy of priv-ate
@@ -1246,7 +1253,7 @@
    }
 #endif
    assert(rez==Success);
-   if(verbose > 3 ) printf("vo_xvmc: flush surface\n");
+   if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) printf("vo_xvmc: flush surface\n");
    rez = XvMCFlushSurface(mDisplay, rndr->p_surface);
    assert(rez==Success);
 
@@ -1266,7 +1273,7 @@
 int stat;
       //If this is source surface, check does the OSD rendering is compleate
       if(src_rndr->state & MP_XVMC_STATE_OSD_SOURCE){
-         if(verbose > 3)
+         if( mp_msg_test(MSGT_VO,MSGL_DBG4) )
             printf("vo_xvmc: OSD surface=%p quering\n",src_rndr);
          osd_rndr = src_rndr->p_osd_target_surface_render;
          XvMCGetSurfaceStatus(mDisplay, osd_rndr->p_surface, &stat);
@@ -1354,7 +1361,7 @@
    rndr->filled_mv_blocks_num = 0;
    rndr->next_free_data_block_num = 0;
 
-   if( verbose > 3 ) 
+   if( mp_msg_test(MSGT_VO,MSGL_DBG4) )
       printf("vo_xvmc: get_image: rndr=%p (surface=%p) \n",
              rndr,rndr->p_surface);
 return VO_TRUE;   
--- a/libvo/vosub_vidix.c	Fri Mar 24 02:31:29 2006 +0000
+++ b/libvo/vosub_vidix.c	Fri Mar 24 08:12:03 2006 +0000
@@ -24,6 +24,7 @@
 #include <errno.h>
 
 #include "config.h"
+#include "mp_msg.h"
 
 #include "vosub_vidix.h"
 #include "vidix/vidixlib.h"
@@ -41,7 +42,6 @@
 static uint8_t *vidix_mem = NULL;
 static uint8_t next_frame;
 static unsigned image_Bpp,image_height,image_width,src_format,forced_fourcc=0;
-extern int verbose;
 static int video_on=0;
 
 static vidix_capability_t vidix_cap;
@@ -84,7 +84,8 @@
 
 void vidix_term( void )
 {
-  if(verbose > 1) printf("vosub_vidix: vidix_term() was called\n");
+  if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
+    printf("vosub_vidix: vidix_term() was called\n"); }
 	vidix_stop();
 	vdlClose(vidix_handler);
 //  ((vo_functions_t *)vo_server)->control=server_control;
@@ -253,7 +254,8 @@
 }
 
 static uint32_t  vidix_draw_image(mp_image_t *mpi){
-    if(verbose > 1) printf("vosub_vidix: vidix_draw_image() was called\n");
+    if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
+      printf("vosub_vidix: vidix_draw_image() was called\n"); }
 
     // if -dr or -slices then do nothing:
     if(mpi->flags&(MP_IMGFLAG_DIRECT|MP_IMGFLAG_DRAW_CALLBACK)) return VO_TRUE;
@@ -271,7 +273,8 @@
 
 void     vidix_flip_page(void)
 {
-  if(verbose > 1) printf("vosub_vidix: vidix_flip_page() was called\n");
+  if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
+    printf("vosub_vidix: vidix_flip_page() was called\n"); }
   if(vo_doublebuffering)
   {
 	vdlPlaybackFrameSelect(vidix_handler,next_frame);
@@ -331,14 +334,16 @@
 
 void     vidix_draw_osd(void)
 {
-  if(verbose > 1) printf("vosub_vidix: vidix_draw_osd() was called\n");
+  if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
+    printf("vosub_vidix: vidix_draw_osd() was called\n"); }
   /* TODO: hw support */
   vo_draw_text(vidix_play.src.w,vidix_play.src.h,draw_alpha);
 }
 
 uint32_t vidix_query_fourcc(uint32_t format)
 {
-  if(verbose > 1) printf("vosub_vidix: query_format was called: %x (%s)\n",format,vo_format_name(format));
+  if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
+    printf("vosub_vidix: query_format was called: %x (%s)\n",format,vo_format_name(format)); }
   vidix_fourcc.fourcc = format;
   vdlQueryFourcc(vidix_handler,&vidix_fourcc);
   if (vidix_fourcc.depth == VID_DEPTH_NONE)
@@ -408,7 +413,7 @@
   size_t i;
   int err;
   uint32_t sstride,apitch;
-  if(verbose > 1)
+  if( mp_msg_test(MSGT_VO,MSGL_DBG2) )
      printf("vosub_vidix: vidix_init() was called\n"
     	    "src_w=%u src_h=%u dest_x_y_w_h = %u %u %u %u\n"
 	    "format=%s dest_bpp=%u vid_w=%u vid_h=%u\n"
@@ -492,7 +497,8 @@
 		printf("vosub_vidix: Can't configure playback: %s\n",strerror(err));
 		return -1;
 	}
-	if (verbose) printf("vosub_vidix: using %d buffer(s)\n", vidix_play.num_frames);
+	if ( mp_msg_test(MSGT_VO,MSGL_V) ) {
+		printf("vosub_vidix: using %d buffer(s)\n", vidix_play.num_frames); }
 
 	vidix_mem = vidix_play.dga_addr;
 
@@ -702,7 +708,8 @@
 int vidix_preinit(const char *drvname,void *server)
 {
   int err;
-  if(verbose > 1) printf("vosub_vidix: vidix_preinit(%s) was called\n",drvname);
+  if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
+    printf("vosub_vidix: vidix_preinit(%s) was called\n",drvname); }
 	if(vdlGetVersion() != VIDIX_VERSION)
 	{
 	  printf("vosub_vidix: You have wrong version of VIDIX library\n");
--- a/loader/win32.c	Fri Mar 24 02:31:29 2006 +0000
+++ b/loader/win32.c	Fri Mar 24 08:12:03 2006 +0000
@@ -214,7 +214,7 @@
     }
 #endif
 #ifdef MPLAYER
-    if (verbose > 2)
+    if ( mp_msg_test(MSGT_WIN32,MSGL_DBG3) )
     {
 	va_list va;
 	
--- a/mencoder.c	Fri Mar 24 02:31:29 2006 +0000
+++ b/mencoder.c	Fri Mar 24 08:12:03 2006 +0000
@@ -964,7 +964,7 @@
     break;
 }
 
-if (verbose>1) print_wave_header(mux_a->wf);
+if ( mp_msg_test(MSGT_MENCODER,MSGL_DBG2) ) print_wave_header(mux_a->wf);
 
 if (! ignore_start)
     muxer->audio_delay_fix += sh_audio->stream_delay;
@@ -1447,7 +1447,7 @@
 	    (int)demuxer->movi_end);
 #else
       if(!quiet) {
-	if(verbose>0) {
+	if( mp_msg_test(MSGT_AVSYNC,MSGL_V) ) {
 		mp_msg(MSGT_AVSYNC,MSGL_STATUS,"Pos:%6.1fs %6df (%2d%%) %3dfps Trem:%4dmin %3dmb  A-V:%5.3f [%d:%d] A/Vms %d/%d D/B/S %d/%d/%d \r",
 	    	mux_v->timer, decoded_frameno, (int)(p*100),
 	    	(t>1) ? (int)(decoded_frameno/t+0.5) : 0,
--- a/mplayer.c	Fri Mar 24 02:31:29 2006 +0000
+++ b/mplayer.c	Fri Mar 24 08:12:03 2006 +0000
@@ -2110,7 +2110,7 @@
     }
 
     // Many users forget to include command line in bugreports...
-    if(verbose>0){
+    if( mp_msg_test(MSGT_CPLAYER,MSGL_V) ){
       mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_CommandLine);
       for(i=1;i<argc;i++)mp_msg(MSGT_CPLAYER, MSGL_INFO," '%s'",argv[i]);
       mp_msg(MSGT_CPLAYER, MSGL_INFO, "\n");
@@ -3358,7 +3358,7 @@
 	  
       }
 
-//      if(verbose>1)printf("sleep: %5.3f  a:%6.3f  v:%6.3f  \n",time_frame,sh_audio->timer,sh_video->timer);
+//      if(mp_msg_test(MSGT_CPLAYER,MSGL_DBG2)printf("sleep: %5.3f  a:%6.3f  v:%6.3f  \n",time_frame,sh_audio->timer,sh_video->timer);
 
       aq_sleep_time+=time_frame;
 
@@ -4592,7 +4592,7 @@
       if(sh_audio){
 	if(d_audio->packs == 0)
 	  ds_fill_buffer(d_audio);
-	if(verbose>0){
+	if( mp_msg_test(MSGT_AVSYNC,MSGL_V) ){
 	    float a_pts=d_audio->pts;
             a_pts+=(ds_tell_pts(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps;
 	    mp_msg(MSGT_AVSYNC,MSGL_V,"SEEK: A: %5.3f  V: %5.3f  A-V: %5.3f   \n",a_pts,d_video->pts,a_pts-d_video->pts);