[Mplayer-cvslog] CVS: main asfheader.c,1.20,1.21 aviheader.c,1.24,1.25 dec_audio.c,1.31,1.32 dec_video.c,1.26,1.27 demux_asf.c,1.14,1.15 demux_avi.c,1.22,1.23 demux_mov.c,1.1,1.2 demux_mpg.c,1.27,1.28 demuxer.c,1.21,1.22 dll_init.c,1.24,1.25 mplayer.c,1.222,1.223 open.c,1.3,1.4

Arpi of Ize arpi at mplayer.dev.hu
Fri Aug 17 02:40:28 CEST 2001


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

Modified Files:
	asfheader.c aviheader.c dec_audio.c dec_video.c demux_asf.c 
	demux_avi.c demux_mov.c demux_mpg.c demuxer.c dll_init.c 
	mplayer.c open.c 
Log Message:
printf->mp_msg/mp_dbg

Index: asfheader.c
===================================================================
RCS file: /cvsroot/mplayer/main/asfheader.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- asfheader.c	11 Aug 2001 20:37:33 -0000	1.20
+++ asfheader.c	17 Aug 2001 00:40:25 -0000	1.21
@@ -7,6 +7,9 @@
 
 extern int verbose; // defined in mplayer.c
 
+#include "config.h"
+#include "mp_msg.h"
+
 #include "stream.h"
 #include "demuxer.h"
 
@@ -66,7 +69,7 @@
 // the variable string is modify in this function
 void print_asf_string(const char* name, char* string, int length) {
   pack_asf_string(string, length);
-  printf("%s%s\n", name, string);
+  mp_msg(MSGT_HEADER,MSGL_V,"%s%s\n", name, string);
 }
 
 static char* asf_chunk_type(unsigned char* guid) {
@@ -116,11 +119,11 @@
 //  for(i=0;i<16;i++) printf(" %02X",temp[i]);printf("\n");
 //  for(i=0;i<16;i++) printf(" %02X",asfhdrguid[i]);printf("\n");
   if(memcmp(asfhdrguid,asfh.objh.guid,16)){
-    if(verbose) printf("ASF_check: not ASF guid!\n");
+    mp_msg(MSGT_HEADER,MSGL_V,"ASF_check: not ASF guid!\n");
     return 0; // not ASF guid
   }
   if(asfh.cno>256){
-    if(verbose) printf("ASF_check: invalid subchunks_no %d\n",(int) asfh.cno);
+    mp_msg(MSGT_HEADER,MSGL_V,"ASF_check: invalid subchunks_no %d\n",(int) asfh.cno);
     return 0; // invalid header???
   }
   return 1;
@@ -148,15 +151,15 @@
       stream_read(demuxer->stream,(char*) &streamh,sizeof(streamh));
       le2me_ASF_stream_header_t(&streamh);
       if(verbose){
-        printf("stream type: %s\n",asf_chunk_type(streamh.type));
-	printf("stream concealment: %s\n",asf_chunk_type(streamh.concealment));
-	printf("type: %d bytes,  stream: %d bytes  ID: %d\n",(int)streamh.type_size,(int)streamh.stream_size,(int)streamh.stream_no);
-	printf("unk1: %lX  unk2: %X\n",(unsigned long)streamh.unk1,(unsigned int)streamh.unk2);
-	printf("FILEPOS=0x%X\n",stream_tell(demuxer->stream));
+        mp_msg(MSGT_HEADER,MSGL_V,"stream type: %s\n",asf_chunk_type(streamh.type));
+	mp_msg(MSGT_HEADER,MSGL_V,"stream concealment: %s\n",asf_chunk_type(streamh.concealment));
+	mp_msg(MSGT_HEADER,MSGL_V,"type: %d bytes,  stream: %d bytes  ID: %d\n",(int)streamh.type_size,(int)streamh.stream_size,(int)streamh.stream_no);
+	mp_msg(MSGT_HEADER,MSGL_V,"unk1: %lX  unk2: %X\n",(unsigned long)streamh.unk1,(unsigned int)streamh.unk2);
+	mp_msg(MSGT_HEADER,MSGL_V,"FILEPOS=0x%X\n",stream_tell(demuxer->stream));
       }
       if(streamh.type_size>1024 || streamh.stream_size>1024){
-          printf("FATAL: header size bigger than 1024 bytes!\n");
-          printf("Please contact mplayer authors, and upload/send this file.\n");
+          mp_msg(MSGT_HEADER,MSGL_FATAL,"FATAL: header size bigger than 1024 bytes!\n"
+              "Please contact mplayer authors, and upload/send this file.\n");
           exit(1);
       }
       // type-specific data:
@@ -177,7 +180,7 @@
 	} else {
 	  asf_scrambling_b=asf_scrambling_h=asf_scrambling_w=1;
 	}
-	printf("ASF: audio scrambling: %d x %d x %d\n",asf_scrambling_h,asf_scrambling_w,asf_scrambling_b);
+	mp_msg(MSGT_HEADER,MSGL_V,"ASF: audio scrambling: %d x %d x %d\n",asf_scrambling_h,asf_scrambling_w,asf_scrambling_b);
 	//if(demuxer->audio->id==-1) demuxer->audio->id=streamh.stream_no & 0x7F;
         break;
         }
@@ -203,14 +206,14 @@
     case ASF_GUID_PREFIX_file_header: // guid_file_header
       stream_read(demuxer->stream,(char*) &fileh,sizeof(fileh));
       le2me_ASF_file_header_t(&fileh);
-      if(verbose) printf("ASF: packets: %d  flags: %d  pack_size: %d  frame_size: %d\n",(int)fileh.packets,(int)fileh.flags,(int)fileh.packetsize,(int)fileh.frame_size);
+      mp_msg(MSGT_HEADER,MSGL_V,"ASF: packets: %d  flags: %d  pack_size: %d  frame_size: %d\n",(int)fileh.packets,(int)fileh.flags,(int)fileh.packetsize,(int)fileh.frame_size);
       asf_packetsize=fileh.packetsize;
       asf_packet=malloc(asf_packetsize); // !!!
       break;
     case ASF_GUID_PREFIX_data_chunk: // guid_data_chunk
       demuxer->movi_start=stream_tell(demuxer->stream)+26;
       demuxer->movi_end=endpos;
-      if(verbose>=1) printf("Found movie at 0x%X - 0x%X\n",demuxer->movi_start,demuxer->movi_end);
+      mp_msg(MSGT_HEADER,MSGL_V,"Found movie at 0x%X - 0x%X\n",demuxer->movi_start,demuxer->movi_end);
       break;
 
 //  case ASF_GUID_PREFIX_index_chunk: return "guid_index_chunk";
@@ -220,11 +223,12 @@
         char *string=NULL;
         stream_read(demuxer->stream,(char*) &contenth,sizeof(contenth));
 	le2me_ASF_content_description_t(&contenth);
+	mp_msg(MSGT_HEADER,MSGL_V,"\n");
         // extract the title
         if( contenth.title_size!=0 ) {
           string=(char*)malloc(contenth.title_size);
           stream_read(demuxer->stream, string, contenth.title_size);
-          print_asf_string("\n Title: ", string, contenth.title_size);
+          print_asf_string(" Title: ", string, contenth.title_size);
         }
         // extract the author 
         if( contenth.author_size!=0 ) {
@@ -250,7 +254,7 @@
           stream_read(demuxer->stream, string, contenth.rating_size);
           print_asf_string(" Rating: ", string, contenth.rating_size);
         }
-	printf("\n");
+	mp_msg(MSGT_HEADER,MSGL_V,"\n");
         free(string);
       }
       break;

Index: aviheader.c
===================================================================
RCS file: /cvsroot/mplayer/main/aviheader.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- aviheader.c	12 Aug 2001 22:36:05 -0000	1.24
+++ aviheader.c	17 Aug 2001 00:40:25 -0000	1.25
@@ -4,8 +4,7 @@
 #include <unistd.h>
 
 #include "config.h"
-
-extern int verbose; // defined in mplayer.c
+#include "mp_msg.h"
 
 #include "stream.h"
 #include "demuxer.h"
@@ -51,12 +50,12 @@
   if(id==mmioFOURCC('L','I','S','T')){
     int len=stream_read_dword_le(demuxer->stream)-4; // list size
     id=stream_read_dword_le(demuxer->stream);        // list type
-    if(verbose>=2) printf("LIST %.4s  len=%d\n",(char *) &id,len);
+    mp_dbg(MSGT_HEADER,MSGL_DBG2,"LIST %.4s  len=%d\n",(char *) &id,len);
     if(id==listtypeAVIMOVIE){
       // found MOVI header
       demuxer->movi_start=stream_tell(demuxer->stream);
       demuxer->movi_end=demuxer->movi_start+len;
-      if(verbose>=1) printf("Found movie at 0x%X - 0x%X\n",demuxer->movi_start,demuxer->movi_end);
+      mp_msg(MSGT_HEADER,MSGL_V,"Found movie at 0x%X - 0x%X\n",demuxer->movi_start,demuxer->movi_end);
       if(index_mode==-2) break; // reading from non-seekable source (stdin)
       len=(len+1)&(~1);
       stream_skip(demuxer->stream,len);
@@ -64,7 +63,7 @@
     continue;
   }
   size2=stream_read_dword_le(demuxer->stream);
-  if(verbose>=2) printf("CHUNK %.4s  len=%d\n",(char *) &id,size2);
+  mp_dbg(MSGT_HEADER,MSGL_DBG2,"CHUNK %.4s  len=%d\n",(char *) &id,size2);
   chunksize=(size2+1)&(~1);
   switch(id){
     case ckidAVIMAINHDR:          // read 'avih'
@@ -94,7 +93,7 @@
       if(last_fccType==streamtypeVIDEO){
         sh_video->bih=calloc((chunksize<sizeof(BITMAPINFOHEADER))?sizeof(BITMAPINFOHEADER):chunksize,1);
 //        sh_video->bih=malloc(chunksize); memset(sh_video->bih,0,chunksize);
-        if(verbose>=1) printf("found 'bih', %d bytes of %d\n",chunksize,sizeof(BITMAPINFOHEADER));
+        mp_msg(MSGT_HEADER,MSGL_V,"found 'bih', %d bytes of %d\n",chunksize,sizeof(BITMAPINFOHEADER));
         stream_read(demuxer->stream,(char*) sh_video->bih,chunksize);
 	le2me_BITMAPINFOHEADER(sh_video->bih);  // swap to machine endian
         if(verbose>=1) print_video_header(sh_video->bih);
@@ -126,7 +125,7 @@
 	int wf_size = chunksize<sizeof(WAVEFORMATEX)?sizeof(WAVEFORMATEX):chunksize;
         sh_audio->wf=calloc(wf_size,1);
 //        sh_audio->wf=malloc(chunksize); memset(sh_audio->wf,0,chunksize);
-        if(verbose>=1) printf("found 'wf', %d bytes of %d\n",chunksize,sizeof(WAVEFORMATEX));
+        mp_msg(MSGT_HEADER,MSGL_V,"found 'wf', %d bytes of %d\n",chunksize,sizeof(WAVEFORMATEX));
         stream_read(demuxer->stream,(char*) sh_audio->wf,chunksize);
 	le2me_WAVEFORMATEX(sh_audio->wf);
 	if (sh_audio->wf->cbSize != 0 &&
@@ -142,7 +141,7 @@
     case ckidAVINEWINDEX: if(index_mode){
       int i;
       priv->idx_size=size2>>4;
-      if(verbose>=1) printf("Reading INDEX block, %d chunks for %ld frames\n",
+      mp_msg(MSGT_HEADER,MSGL_V,"Reading INDEX block, %d chunks for %ld frames\n",
         priv->idx_size,avih.dwTotalFrames);
       priv->idx=malloc(priv->idx_size<<4);
       stream_read(demuxer->stream,(char*)priv->idx,priv->idx_size<<4);
@@ -154,7 +153,7 @@
     }
   }
   if(chunksize>0) stream_skip(demuxer->stream,chunksize); else
-  if(chunksize<0) printf("WARNING!!! chunksize=%d  (id=%.4s)\n",chunksize,(char *) &id);
+  if(chunksize<0) mp_msg(MSGT_HEADER,MSGL_WARN,"chunksize=%d  (id=%.4s)\n",chunksize,(char *) &id);
   
 }
 
@@ -202,7 +201,7 @@
         if(c&0x40) idx->dwFlags=0;
       }
     
-    if(verbose>=2) printf("%08X %08X %.4s %02X %X\n",demuxer->filepos,id,(char *) &id,c,(unsigned int) idx->dwFlags);
+    mp_dbg(MSGT_HEADER,MSGL_DBG2,"%08X %08X %.4s %02X %X\n",demuxer->filepos,id,(char *) &id,c,(unsigned int) idx->dwFlags);
 #if 0
     { unsigned char tmp[64];
       int i;
@@ -217,7 +216,7 @@
     stream_seek(demuxer->stream,8+demuxer->filepos+skip);
   }
   priv->idx_size=priv->idx_pos;
-  printf("AVI: Generated index table for %d chunks!\n",priv->idx_size);
+  mp_msg(MSGT_HEADER,MSGL_INFO,"AVI: Generated index table for %d chunks!\n",priv->idx_size);
 }
 
 }

Index: dec_audio.c
===================================================================
RCS file: /cvsroot/mplayer/main/dec_audio.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- dec_audio.c	15 Aug 2001 12:09:00 -0000	1.31
+++ dec_audio.c	17 Aug 2001 00:40:25 -0000	1.32
@@ -4,6 +4,8 @@
 #include <unistd.h>
 
 #include "config.h"
+#include "mp_msg.h"
+
 #include "libao2/afmt.h"
 
 extern int verbose; // defined in mplayer.c
@@ -82,7 +84,7 @@
 switch(driver){
 case AFM_ACM:
 #ifndef	USE_WIN32DLL
-  printf("Win32/ACM audio codec disabled, or unavailable on non-x86 CPU -> force nosound :(\n");
+  mp_msg(MSGT_DECAUDIO,MSGL_ERR,"Win32/ACM audio codec disabled, or unavailable on non-x86 CPU -> force nosound :(\n");
   driver=0;
 #else
   // Win32 ACM audio codec:
@@ -95,20 +97,20 @@
 //    if(sh_audio->a_buffer_size<sh_audio->audio_out_minsize+MAX_OUTBURST)
 //        sh_audio->a_buffer_size=sh_audio->audio_out_minsize+MAX_OUTBURST;
   } else {
-    printf("Could not load/initialize Win32/ACM AUDIO codec (missing DLL file?)\n");
+    mp_msg(MSGT_DECAUDIO,MSGL_ERR,"Could not load/initialize Win32/ACM AUDIO codec (missing DLL file?)\n");
     driver=0;
   }
 #endif
   break;
 case AFM_DSHOW:
 #ifndef USE_DIRECTSHOW
-  printf("Compiled without DirectShow support -> force nosound :(\n");
+  mp_msg(MSGT_DECAUDIO,MSGL_ERR,"Compiled without DirectShow support -> force nosound :(\n");
   driver=0;
 #else
   // Win32 DShow audio codec:
 //  printf("DShow_audio: channs=%d  rate=%d\n",sh_audio->channels,sh_audio->samplerate);
   if(DS_AudioDecoder_Open(sh_audio->codec->dll,&sh_audio->codec->guid,sh_audio->wf)){
-    printf("ERROR: Could not load/initialize Win32/DirctShow AUDIO codec: %s\n",sh_audio->codec->dll);
+    mp_msg(MSGT_DECAUDIO,MSGL_ERR,"ERROR: Could not load/initialize Win32/DirctShow AUDIO codec: %s\n",sh_audio->codec->dll);
     driver=0;
   } else {
     sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec;
@@ -153,12 +155,12 @@
 // allocate audio out buffer:
 sh_audio->a_buffer_size=sh_audio->audio_out_minsize+MAX_OUTBURST; // worst case calc.
 
-if(verbose) printf("dec_audio: Allocating %d + %d = %d bytes for output buffer\n",
+mp_msg(MSGT_DECAUDIO,MSGL_V,"dec_audio: Allocating %d + %d = %d bytes for output buffer\n",
     sh_audio->audio_out_minsize,MAX_OUTBURST,sh_audio->a_buffer_size);
 
 sh_audio->a_buffer=malloc(sh_audio->a_buffer_size);
 if(!sh_audio->a_buffer){
-    fprintf(stderr,"Cannot allocate audio out buffer\n");
+    mp_msg(MSGT_DECAUDIO,MSGL_ERR,"Cannot allocate audio out buffer\n");
     return 0;
 }
 memset(sh_audio->a_buffer,0,sh_audio->a_buffer_size);
@@ -169,7 +171,7 @@
 case AFM_ACM: {
     int ret=acm_decode_audio(sh_audio,sh_audio->a_buffer,4096,sh_audio->a_buffer_size);
     if(ret<0){
-        printf("ACM decoding error: %d\n",ret);
+        mp_msg(MSGT_DECAUDIO,MSGL_WARN,"ACM decoding error: %d\n",ret);
         driver=0;
     }
     sh_audio->a_buffer_len=ret;
@@ -234,12 +236,12 @@
   len = ds_get_packet(sh_audio->ds, &buffer); // maybe 1 packet is not enough,
     // at least for mpeg, PS packets contain about max. 2000 bytes of data.
   if(ac3_iec958_parse_syncinfo(buffer, len, &ai, &skipped) < 0) {
-      fprintf(stderr, "AC3 stream not valid.\n");
+      mp_msg(MSGT_DECAUDIO,MSGL_ERR, "AC3 stream not valid.\n");
       driver = 0;
       break;
   }
   if(ai.samplerate != 48000) {
-      fprintf(stderr, "Only 48000 Hz streams supported.\n");
+      mp_msg(MSGT_DECAUDIO,MSGL_ERR,"Only 48000 Hz streams supported.\n");
       driver = 0;
       break;
   }
@@ -289,7 +291,7 @@
 }
 
 if(!sh_audio->channels || !sh_audio->samplerate){
-  printf("Unknown/missing audio format, using nosound\n");
+  mp_msg(MSGT_DECAUDIO,MSGL_WARN,"Unknown/missing audio format, using nosound\n");
   driver=0;
 }
 
@@ -385,7 +387,7 @@
       { int size_in=0;
         int size_out=0;
         int srcsize=DS_AudioDecoder_GetSrcSize(maxlen);
-        if(verbose>2)printf("DShow says: srcsize=%d  (buffsize=%d)  out_size=%d\n",srcsize,sh_audio->a_in_buffer_size,maxlen);
+        mp_msg(MSGT_DECAUDIO,MSGL_DBG3,"DShow says: srcsize=%d  (buffsize=%d)  out_size=%d\n",srcsize,sh_audio->a_in_buffer_size,maxlen);
         if(srcsize>sh_audio->a_in_buffer_size) srcsize=sh_audio->a_in_buffer_size; // !!!!!!
         if(sh_audio->a_in_buffer_len<srcsize){
           sh_audio->a_in_buffer_len+=
@@ -394,8 +396,7 @@
         }
         DS_AudioDecoder_Convert(sh_audio->a_in_buffer,sh_audio->a_in_buffer_len,
             buf,maxlen, &size_in,&size_out);
-        if(verbose)
-          printf("DShow: audio %d -> %d converted  (in_buf_len=%d of %d)  %d\n",size_in,size_out,sh_audio->a_in_buffer_len,sh_audio->a_in_buffer_size,ds_tell_pts(sh_audio->ds));
+        mp_dbg(MSGT_DECAUDIO,MSGL_DBG2,"DShow: audio %d -> %d converted  (in_buf_len=%d of %d)  %d\n",size_in,size_out,sh_audio->a_in_buffer_len,sh_audio->a_in_buffer_size,ds_tell_pts(sh_audio->ds));
         if(size_in>=sh_audio->a_in_buffer_len){
           sh_audio->a_in_buffer_len=0;
         } else {

Index: dec_video.c
===================================================================
RCS file: /cvsroot/mplayer/main/dec_video.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- dec_video.c	16 Aug 2001 01:04:28 -0000	1.26
+++ dec_video.c	17 Aug 2001 00:40:25 -0000	1.27
@@ -4,6 +4,7 @@
 #include <unistd.h>
 
 #include "config.h"
+#include "mp_msg.h"
 
 extern int verbose; // defined in mplayer.c
 extern int divx_quality;
@@ -152,7 +153,7 @@
 //     exit(1);
       return 0;
    }  
-   if(verbose) printf("INFO: Win32 video codec init OK!\n");
+   mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32 video codec init OK!\n");
    break;
  }
  case VFM_VFWEX: {
@@ -161,12 +162,12 @@
 //     exit(1);
       return 0;
    }  
-   if(verbose) printf("INFO: Win32Ex video codec init OK!\n");
+   mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32Ex video codec init OK!\n");
    break;
  }
  case VFM_DSHOW: { // Win32/DirectShow
 #ifndef USE_DIRECTSHOW
-   fprintf(stderr,"MPlayer was compiled WITHOUT directshow support!\n");
+   mp_msg(MSGT_DECVIDEO,MSGL_ERR,"MPlayer was compiled WITHOUT directshow support!\n");
    return 0;
 //   GUI_MSG( mplCompileWithoutDSSupport )
 //   exit(1);
@@ -174,10 +175,10 @@
    int bpp;
    if(DS_VideoDecoder_Open(sh_video->codec->dll,&sh_video->codec->guid, sh_video->bih, 0, &sh_video->our_out_buffer)){
 //   if(DS_VideoDecoder_Open(sh_video->codec->dll,&sh_video->codec->guid, sh_video->bih, 0, NULL)){
-        printf("ERROR: Couldn't open required DirectShow codec: %s\n",sh_video->codec->dll);
-        printf("Maybe you forget to upgrade your win32 codecs?? It's time to download the new\n");
-        printf("package from:  ftp://thot.banki.hu/esp-team/linux/MPlayer/w32codec.zip  !\n");
-        printf("Or you should disable DShow support: make distclean;make -f Makefile.No-DS\n");
+        mp_msg(MSGT_DECVIDEO,MSGL_ERR,"ERROR: Couldn't open required DirectShow codec: %s\n",sh_video->codec->dll);
+        mp_msg(MSGT_DECVIDEO,MSGL_HINT,"Maybe you forget to upgrade your win32 codecs?? It's time to download the new\n");
+        mp_msg(MSGT_DECVIDEO,MSGL_HINT,"package from:  ftp://mplayerhq.hu/MPlayer/releases/w32codec.zip  !\n");
+//        mp_msg(MSGT_DECVIDEO,MSGL_HINT,"Or you should disable DShow support: make distclean;make -f Makefile.No-DS\n");
       return 0;
 //        #ifdef HAVE_GUI
 //         if ( !nogui )
@@ -213,7 +214,7 @@
 //   printf("DivX setting result = %d\n", DS_SetAttr_DivX("Quality",divx_quality) );
 //   printf("DivX setting result = %d\n", DS_SetValue_DivX("Brightness",60) );
    
-   if(verbose) printf("INFO: Win32/DShow video codec init OK!\n");
+   mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32/DShow video codec init OK!\n");
    break;
 #endif
  }
@@ -221,11 +222,11 @@
  case VFM_VFW:
  case VFM_DSHOW:
  case VFM_VFWEX:
-   fprintf(stderr,"Support for win32 codecs disabled, or unavailable on non-x86 platforms!\n");
+   mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Support for win32 codecs disabled, or unavailable on non-x86 platforms!\n");
    return 0;
 #endif	/* !USE_WIN32DLL */
  case VFM_ODIVX: {  // OpenDivX
-   if(verbose) printf("OpenDivX video codec\n");
+   mp_msg(MSGT_DECVIDEO,MSGL_V,"OpenDivX video codec\n");
    { DEC_PARAM dec_param;
      DEC_SET dec_set;
         memset(&dec_param,0,sizeof(dec_param));
@@ -240,15 +241,15 @@
 	dec_set.postproc_level = divx_quality;
 	decore(0x123, DEC_OPT_SETPP, &dec_set, NULL);
    }
-   if(verbose) printf("INFO: OpenDivX video codec init OK!\n");
+   mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: OpenDivX video codec init OK!\n");
    break;
  }
  case VFM_DIVX4: {  // DivX4Linux
 #ifndef NEW_DECORE
-   fprintf(stderr,"MPlayer was compiled WITHOUT DivX4Linux (libdivxdecore.so) support!\n");
+   mp_msg(MSGT_DECVIDEO,MSGL_ERR,"MPlayer was compiled WITHOUT DivX4Linux (libdivxdecore.so) support!\n");
    return 0; //exit(1);
 #else
-   if(verbose) printf("DivX4Linux video codec\n");
+   mp_msg(MSGT_DECVIDEO,MSGL_V,"DivX4Linux video codec\n");
    { DEC_PARAM dec_param;
      DEC_SET dec_set;
      int bits=16;
@@ -263,7 +264,7 @@
 	case IMGFMT_BGR24: dec_param.output_format=DEC_RGB24_INV;bits=24;break;
 	case IMGFMT_BGR32: dec_param.output_format=DEC_RGB32_INV;bits=32;break;
 	default:
-	  fprintf(stderr,"Unsupported out_fmt: 0x%X\n",out_fmt);
+	  mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Unsupported out_fmt: 0x%X\n",out_fmt);
 	  return 0;
 	}
 	dec_param.x_dim = sh_video->bih->biWidth;
@@ -274,35 +275,35 @@
 	sh_video->our_out_buffer = shmem_alloc(((bits*dec_param.x_dim+7)/8)*dec_param.y_dim);
 //	sh_video->our_out_buffer = shmem_alloc(dec_param.x_dim*dec_param.y_dim*5);
    }
-   if(verbose) printf("INFO: OpenDivX video codec init OK!\n");
+   mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: OpenDivX video codec init OK!\n");
    break;
 #endif
  }
  case VFM_FFMPEG: {  // FFmpeg's libavcodec
 #ifndef USE_LIBAVCODEC
-   fprintf(stderr,"MPlayer was compiled WITHOUT libavcodec support!\n");
+   mp_msg(MSGT_DECVIDEO,MSGL_ERR,"MPlayer was compiled WITHOUT libavcodec support!\n");
    return 0; //exit(1);
 #else
-   if(verbose) printf("FFmpeg's libavcodec video codec\n");
+   mp_msg(MSGT_DECVIDEO,MSGL_V,"FFmpeg's libavcodec video codec\n");
     avcodec_init();
     avcodec_register_all();
     lavc_codec = (AVCodec *)avcodec_find_decoder_by_name(sh_video->codec->dll);
     if(!lavc_codec){
-	fprintf(stderr,"Can't find codec '%s' in libavcodec...\n",sh_video->codec->dll);
+	mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Can't find codec '%s' in libavcodec...\n",sh_video->codec->dll);
 	return 0; //exit(1);
     }
     memset(&lavc_context, 0, sizeof(lavc_context));
 //    sh_video->disp_h/=2; // !!
     lavc_context.width=sh_video->disp_w;
     lavc_context.height=sh_video->disp_h;
-    printf("libavcodec.size: %d x %d\n",lavc_context.width,lavc_context.height);
+    mp_dbg(MSGT_DECVIDEO,MSGL_DBG2,"libavcodec.size: %d x %d\n",lavc_context.width,lavc_context.height);
     /* open it */
     if (avcodec_open(&lavc_context, lavc_codec) < 0) {
-        fprintf(stderr, "could not open codec\n");
+        mp_msg(MSGT_DECVIDEO,MSGL_ERR, "could not open codec\n");
         return 0; //exit(1);
     }
    
-   if(verbose) printf("INFO: libavcodec init OK!\n");
+   mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: libavcodec init OK!\n");
    break;
 #endif
  }
@@ -313,9 +314,9 @@
    picture->pp_options=divx_quality;
 #else
    if(divx_quality){
-       printf("WARNING! You requested image postprocessing for an MPEG 1/2 video,\n");
-       printf("         but compiled MPlayer without MPEG 1/2 postprocessing support!\n");
-       printf("         #define MPEG12_POSTPROC in config.h, and recompile libmpeg2!\n");
+       mp_msg(MSGT_DECVIDEO,MSGL_HINT,"WARNING! You requested image postprocessing for an MPEG 1/2 video,\n");
+       mp_msg(MSGT_DECVIDEO,MSGL_HINT,"         but compiled MPlayer without MPEG 1/2 postprocessing support!\n");
+       mp_msg(MSGT_DECVIDEO,MSGL_HINT,"         #define MPEG12_POSTPROC in config.h, and recompile libmpeg2!\n");
    }
 #endif
    mpeg2_allocate_image_buffers (picture);
@@ -415,7 +416,7 @@
 #ifdef USE_LIBAVCODEC
   case VFM_FFMPEG: {        // libavcodec
     int got_picture=0;
-if(verbose>1) printf("Calling ffmpeg...\n");
+    mp_dbg(MSGT_DECVIDEO,MSGL_DBG2,"Calling ffmpeg...\n");
     if(drop_frame<2 && in_size>0){
         int ret = avcodec_decode_video(&lavc_context, &lavc_picture,
 	     &got_picture, start, in_size);
@@ -431,10 +432,10 @@
      case PIX_FMT_YUV444P: x="YUV444P";break;
 #endif
      }
-     printf("DONE -> got_picture=%d  format=0x%X (%s) \n",got_picture,
+     mp_dbg(MSGT_DECVIDEO,MSGL_DBG2,"DONE -> got_picture=%d  format=0x%X (%s) \n",got_picture,
 	lavc_context.pix_fmt,x);
 }
-	if(ret<0) fprintf(stderr, "Error while decoding frame!\n");
+	if(ret<0) mp_msg(MSGT_DECVIDEO,MSGL_WARN, "Error while decoding frame!\n");
 	if(!drop_frame && got_picture){
 //	if(!drop_frame){
 	  if(planar){
@@ -498,7 +499,7 @@
                         &sh_video->o_bih,
                         drop_frame ? 0 : sh_video->our_out_buffer);
 
-      if(ret){ printf("Error decompressing frame, err=%d\n",(int)ret);break; }
+      if(ret){ mp_msg(MSGT_DECVIDEO,MSGL_WARN,"Error decompressing frame, err=%d\n",(int)ret);break; }
 
     if(!drop_frame) blit_frame=3;
     break;
@@ -570,38 +571,38 @@
  case DEMUXER_TYPE_MPEG_ES:
  case DEMUXER_TYPE_MPEG_PS: {
    // Find sequence_header first:
-   if(verbose) printf("Searching for sequence header... ");fflush(stdout);
+   mp_msg(MSGT_DECVIDEO,MSGL_V,"Searching for sequence header... ");fflush(stdout);
    while(1){
       int i=sync_video_packet(d_video);
       if(i==0x1B3) break; // found it!
       if(!i || !skip_video_packet(d_video)){
-        if(verbose)  printf("NONE :(\n");
-        fprintf(stderr,"MPEG: FATAL: EOF while searching for sequence header\n");
+        if(verbose)  mp_msg(MSGT_DECVIDEO,MSGL_V,"NONE :(\n");
+        mp_msg(MSGT_DECVIDEO,MSGL_ERR,"MPEG: FATAL: EOF while searching for sequence header\n");
 	return 0;
 //        GUI_MSG( mplMPEGErrorSeqHeaderSearch )
 //        exit(1);
       }
    }
-   if(verbose) printf("OK!\n");
+   mp_msg(MSGT_DECVIDEO,MSGL_V,"OK!\n");
 //   sh_video=d_video->sh;sh_video->ds=d_video;
    mpeg2_init();
    // ========= Read & process sequence header & extension ============
    videobuffer=shmem_alloc(VIDEOBUFFER_SIZE);
    if(!videobuffer){ 
-     fprintf(stderr,"Cannot allocate shared memory\n");
+     mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Cannot allocate shared memory\n");
      return 0;
 //     GUI_MSG( mplErrorShMemAlloc )
 //     exit(0);
    }
    videobuf_len=0;
    if(!read_video_packet(d_video)){ 
-     fprintf(stderr,"FATAL: Cannot read sequence header!\n");
+     mp_msg(MSGT_DECVIDEO,MSGL_ERR,"FATAL: Cannot read sequence header!\n");
      return 0;
 //     GUI_MSG( mplMPEGErrorCannotReadSeqHeader )
 //     exit(1);
    }
    if(header_process_sequence_header (picture, &videobuffer[4])) {
-     printf ("bad sequence header!\n"); 
+     mp_msg(MSGT_DECVIDEO,MSGL_ERR,"bad sequence header!\n"); 
      return 0;
 //     GUI_MSG( mplMPEGErrorBadSeqHeader )
 //     exit(1);
@@ -610,13 +611,13 @@
 //    videobuf_len=0;
     int pos=videobuf_len;
     if(!read_video_packet(d_video)){ 
-      fprintf(stderr,"FATAL: Cannot read sequence header extension!\n");
+      mp_msg(MSGT_DECVIDEO,MSGL_ERR,"FATAL: Cannot read sequence header extension!\n");
       return 0;
 //      GUI_MSG( mplMPEGErrorCannotReadSeqHeaderExt )
 //      exit(1);
     }
     if(header_process_extension (picture, &videobuffer[pos+4])) {
-      printf ("bad sequence header extension!\n");  
+      mp_msg(MSGT_DECVIDEO,MSGL_ERR,"bad sequence header extension!\n");  
       return 0;
 //      GUI_MSG( mplMPEGErrorBadSeqHeaderExt )
 //      exit(1);
@@ -640,8 +641,8 @@
    if(picture->bitrate!=0x3FFFF) // unspecified/VBR ?
        sh_video->i_bps=1000*picture->bitrate/16;
    // info:
-   if(verbose) printf("mpeg bitrate: %d (%X)\n",picture->bitrate,picture->bitrate);
-   printf("VIDEO:  %s  %dx%d  (aspect %d)  %4.2f fps  %5.1f kbps (%4.1f kbyte/s)\n",
+   mp_dbg(MSGT_DECVIDEO,MSGL_DBG2,"mpeg bitrate: %d (%X)\n",picture->bitrate,picture->bitrate);
+   mp_msg(MSGT_DECVIDEO,MSGL_INFO,"VIDEO:  %s  %dx%d  (aspect %d)  %4.2f fps  %5.1f kbps (%4.1f kbyte/s)\n",
     picture->mpeg1?"MPEG1":"MPEG2",
     sh_video->disp_w,sh_video->disp_h,
     picture->aspect_ratio_information,

Index: demux_asf.c
===================================================================
RCS file: /cvsroot/mplayer/main/demux_asf.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- demux_asf.c	11 Aug 2001 20:37:33 -0000	1.14
+++ demux_asf.c	17 Aug 2001 00:40:25 -0000	1.15
@@ -4,7 +4,8 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-extern int verbose; // defined in mplayer.c
+#include "config.h"
+#include "mp_msg.h"
 
 #include "stream.h"
 #include "asf.h"
@@ -42,7 +43,7 @@
   unsigned char *s2=src;
   int i=0,x,y;
   while(len-i>=asf_scrambling_h*asf_scrambling_w*asf_scrambling_b){
-//    printf("descrambling! (w=%d  b=%d)\n",w,asf_scrambling_b);
+//    mp_msg(MSGT_DEMUX,MSGL_DBG4,"descrambling! (w=%d  b=%d)\n",w,asf_scrambling_b);
 	//i+=asf_scrambling_h*asf_scrambling_w;
 	for(x=0;x<asf_scrambling_w;x++)
 	  for(y=0;y<asf_scrambling_h;y++){
@@ -60,7 +61,7 @@
 static int demux_asf_read_packet(demuxer_t *demux,unsigned char *data,int len,int id,int seq,unsigned long time,unsigned short dur,int offs,int keyframe){
   demux_stream_t *ds=NULL;
   
-  if(verbose>=4) printf("demux_asf.read_packet: id=%d seq=%d len=%d\n",id,seq,len);
+  mp_dbg(MSGT_DEMUX,MSGL_DBG4,"demux_asf.read_packet: id=%d seq=%d len=%d\n",id,seq,len);
   
   if(demux->video->id==-1)
     if(demux->v_streams[id])
@@ -75,7 +76,7 @@
       ds=demux->audio;
       if(!ds->sh){
         ds->sh=demux->a_streams[id];
-        if(verbose) printf("Auto-selected ASF audio ID = %d\n",ds->id);
+        mp_msg(MSGT_DEMUX,MSGL_V,"Auto-selected ASF audio ID = %d\n",ds->id);
       }
   } else 
   if(id==demux->video->id){
@@ -83,7 +84,7 @@
       ds=demux->video;
       if(!ds->sh){
         ds->sh=demux->v_streams[id];
-        if(verbose) printf("Auto-selected ASF video ID = %d\n",ds->id);
+        mp_msg(MSGT_DEMUX,MSGL_V,"Auto-selected ASF video ID = %d\n",ds->id);
       }
   }
   
@@ -99,10 +100,10 @@
       } else {
         // append data to it!
         demux_packet_t* dp=ds->asf_packet;
-        if(dp->len!=offs && offs!=-1) printf("warning! fragment.len=%d BUT next fragment offset=%d  \n",dp->len,offs);
+        if(dp->len!=offs && offs!=-1) mp_msg(MSGT_DEMUX,MSGL_V,"warning! fragment.len=%d BUT next fragment offset=%d  \n",dp->len,offs);
         dp->buffer=realloc(dp->buffer,dp->len+len);
         memcpy(dp->buffer+dp->len,data,len);
-        if(verbose>=4) printf("data appended! %d+%d\n",dp->len,len);
+        mp_dbg(MSGT_DEMUX,MSGL_DBG4,"data appended! %d+%d\n",dp->len,len);
         dp->len+=len;
         // we are ready now.
         return 1;
@@ -111,7 +112,7 @@
     // create new packet:
     { demux_packet_t* dp;
       if(offs>0){
-        if(verbose) printf("warning!  broken fragment, %d bytes missing  \n",offs);
+        mp_msg(MSGT_DEMUX,MSGL_V,"warning!  broken fragment, %d bytes missing  \n",offs);
         return 0;
       }
       dp=new_demux_packet(len);
@@ -172,12 +173,12 @@
             if(flags&0x40){
               // Explicit (absoulte) packet size
               plen=LOAD_LE16(p); p+=2;
-              if(verbose>1)printf("Explicit packet size specified: %d  \n",plen);
-              if(plen>asf_packetsize) printf("Warning! plen>packetsize! (%d>%d)  \n",plen,asf_packetsize);
+              mp_dbg(MSGT_DEMUX,MSGL_DBG2,"Explicit packet size specified: %d  \n",plen);
+              if(plen>asf_packetsize) mp_msg(MSGT_DEMUX,MSGL_V,"Warning! plen>packetsize! (%d>%d)  \n",plen,asf_packetsize);
               if(flags&(8|16)){
                 padding=p[0];p++;
                 if(flags&16){ padding|=p[0]<<8; p++;}
-                if(verbose)printf("Warning! explicit=%d  padding=%d  \n",plen,asf_packetsize-padding);
+                mp_msg(MSGT_DEMUX,MSGL_V,"Warning! explicit=%d  padding=%d  \n",plen,asf_packetsize-padding);
               }
             } else {
               // Padding (relative) size
@@ -197,7 +198,7 @@
               segs=p[0] & 0x3F;
               ++p;
             }
-            if(verbose>=4) printf("%08X:  flag=%02X  segs=%d  pad=%d  time=%ld  dur=%d\n",
+            mp_dbg(MSGT_DEMUX,MSGL_DBG4,"%08X:  flag=%02X  segs=%d  pad=%d  time=%ld  dur=%d\n",
               demux->filepos,flags,segs,padding,time,duration);
             for(seg=0;seg<segs;seg++){
               //ASF_segmhdr_t* sh;
@@ -209,7 +210,7 @@
               unsigned long time2;
 	      int keyframe=0;
 
-              if(p>=p_end) printf("Warning! invalid packet 1, sig11 coming soon...\n");
+              if(p>=p_end) mp_msg(MSGT_DEMUX,MSGL_V,"Warning! invalid packet 1, sig11 coming soon...\n");
 
               if(verbose>1){
                 int i;
@@ -237,7 +238,7 @@
                  p+=4;
                  break;
               default:
-                 printf("Warning! unknown segtype == 0x%2X  \n",segtype);
+                 mp_msg(MSGT_DEMUX,MSGL_V,"Warning! unknown segtype == 0x%2X  \n",segtype);
 		 x=0;
               }
 
@@ -254,7 +255,7 @@
                 time2=LOAD_LE32(p);p+=4;
                 break;
               default:
-                printf("unknown segment type: 0x%02X  \n",type);
+                mp_msg(MSGT_DEMUX,MSGL_V,"unknown segment type: 0x%02X  \n",type);
               }
 
               if(flags&1){
@@ -269,9 +270,9 @@
                 len=plen-(p-asf_packet);
               }
               if(len<0 || (p+len)>=p_end){
-                printf("ASF_parser: warning! segment len=%d\n",len);
+                mp_msg(MSGT_DEMUX,MSGL_V,"ASF_parser: warning! segment len=%d\n",len);
               }
-              if(verbose>=4) printf("  seg #%d: streamno=%d  seq=%d  type=%02X  len=%d\n",seg,streamno,seq,type,len);
+              mp_dbg(MSGT_DEMUX,MSGL_DBG4,"  seg #%d: streamno=%d  seq=%d  type=%02X  len=%d\n",seg,streamno,seq,type,len);
 
               switch(type){
               case 0x01:
@@ -287,7 +288,7 @@
 		  len-=len2+1;
 		}
                 if(len!=0){
-                  printf("ASF_parser: warning! groups total != len\n");
+                  mp_msg(MSGT_DEMUX,MSGL_V,"ASF_parser: warning! groups total != len\n");
                 }
                 break;
               case 0x08:
@@ -302,7 +303,7 @@
             return 1; // success
     }
     
-    printf("%08X:  UNKNOWN TYPE  %02X %02X %02X %02X %02X...\n",demux->filepos,asf_packet[0],asf_packet[1],asf_packet[2],asf_packet[3],asf_packet[4]);
+    mp_msg(MSGT_DEMUX,MSGL_V,"%08X:  UNKNOWN TYPE  %02X %02X %02X %02X %02X...\n",demux->filepos,asf_packet[0],asf_packet[1],asf_packet[2],asf_packet[3],asf_packet[4]);
     return 0;
 }
 

Index: demux_avi.c
===================================================================
RCS file: /cvsroot/mplayer/main/demux_avi.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- demux_avi.c	16 Aug 2001 01:03:51 -0000	1.22
+++ demux_avi.c	17 Aug 2001 00:40:25 -0000	1.23
@@ -4,7 +4,8 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-extern int verbose; // defined in mplayer.c
+#include "config.h"
+#include "mp_msg.h"
 
 #include "stream.h"
 #include "demuxer.h"
@@ -36,20 +37,20 @@
   if(stream_id==demux->audio->id){
       if(!demux->audio->sh){
         demux->audio->sh=demux->a_streams[stream_id];
-        if(verbose) printf("Auto-selected AVI audio ID = %d\n",demux->audio->id);
+        mp_msg(MSGT_DEMUX,MSGL_V,"Auto-selected AVI audio ID = %d\n",demux->audio->id);
       }
       return demux->audio;
   }
   if(stream_id==demux->video->id){
       if(!demux->video->sh){
         demux->video->sh=demux->v_streams[stream_id];
-        if(verbose) printf("Auto-selected AVI video ID = %d\n",demux->video->id);
+        mp_msg(MSGT_DEMUX,MSGL_V,"Auto-selected AVI video ID = %d\n",demux->video->id);
       }
       return demux->video;
   }
   if(id!=mmioFOURCC('J','U','N','K')){
      // unknown
-     if(verbose>=2) printf("Unknown chunk: %.4s (%X)\n",(char *) &id,id);
+     mp_dbg(MSGT_DEMUX,MSGL_DBG2,"Unknown chunk: %.4s (%X)\n",(char *) &id,id);
   }
   return NULL;
 }
@@ -60,7 +61,7 @@
   float pts=0;
   demux_stream_t *ds=demux_avi_select_stream(demux,id);
   
-  if(verbose>=3) printf("demux_avi.read_packet: %X\n",id);
+  mp_dbg(MSGT_DEMUX,MSGL_DBG3,"demux_avi.read_packet: %X\n",id);
 
   if(ds==demux->audio){
 
@@ -69,7 +70,7 @@
           if(priv->pts_has_video){
 	      // we have video pts now
 	      float delay=(float)priv->pts_corr_bytes/((sh_audio_t*)(ds->sh))->wf->nAvgBytesPerSec;
-	      printf("XXX initial  v_pts=%5.3f  a_pos=%d (%5.3f) \n",priv->avi_audio_pts,priv->pts_corr_bytes,delay);
+	      mp_msg(MSGT_DEMUX,MSGL_V,"XXX initial  v_pts=%5.3f  a_pos=%d (%5.3f) \n",priv->avi_audio_pts,priv->pts_corr_bytes,delay);
 	      //priv->pts_correction=-priv->avi_audio_pts+delay;
 	      priv->pts_correction=delay-priv->avi_audio_pts;
 	      priv->avi_audio_pts+=priv->pts_correction;
@@ -119,12 +120,12 @@
   skip=(len+1)&(~1); // total bytes in this chunk
   
   if(ds){
-    if(verbose>=2) printf("DEMUX_AVI: Read %d data bytes from packet %04X\n",len,id);
+    mp_dbg(MSGT_DEMUX,MSGL_DBG2,"DEMUX_AVI: Read %d data bytes from packet %04X\n",len,id);
     ds_read_packet(ds,demux->stream,len,pts,idxpos,flags);
     skip-=len;
   }
   if(skip){
-    if(verbose>=2) printf("DEMUX_AVI: Skipping %d bytes from packet %04X\n",skip,id);
+    mp_dbg(MSGT_DEMUX,MSGL_DBG2,"DEMUX_AVI: Skipping %d bytes from packet %04X\n",skip,id);
     stream_skip(demux->stream,skip);
   }
   return ds?1:0;
@@ -168,18 +169,18 @@
       continue;
     }
     if(!demux_avi_select_stream(demux,idx->ckid)){
-      if(verbose>2) printf("Skip chunk %.4s (0x%X)  \n",(char *)&idx->ckid,(unsigned int)idx->ckid);
+      mp_dbg(MSGT_DEMUX,MSGL_DBG3,"Skip chunk %.4s (0x%X)  \n",(char *)&idx->ckid,(unsigned int)idx->ckid);
       continue; // skip this chunk
     }
 
     pos=idx->dwChunkOffset+priv->idx_offset;
     if(pos<demux->movi_start || pos>=demux->movi_end){
-      printf("ChunkOffset out of range!   idx=0x%X  \n",pos);
+      mp_msg(MSGT_DEMUX,MSGL_V,"ChunkOffset out of range!   idx=0x%X  \n",pos);
       continue;
     }
 #if 0
     if(pos!=demux->filepos){
-      printf("Warning! pos=0x%X  idx.pos=0x%X  diff=%d   \n",demux->filepos,pos,pos-demux->filepos);
+      mp_msg(MSGT_DEMUX,MSGL_V,"Warning! pos=0x%X  idx.pos=0x%X  diff=%d   \n",demux->filepos,pos,pos-demux->filepos);
     }
 #endif
     stream_seek(demux->stream,pos);
@@ -188,7 +189,7 @@
     if(stream_eof(demux->stream)) return 0; // EOF!
     
     if(id!=idx->ckid){
-      if(verbose) printf("ChunkID mismatch! raw=%.4s idx=%.4s  \n",(char *)&id,(char *)&idx->ckid);
+      mp_msg(MSGT_DEMUX,MSGL_V,"ChunkID mismatch! raw=%.4s idx=%.4s  \n",(char *)&id,(char *)&idx->ckid);
       id=idx->ckid;
 //      continue;
     }
@@ -196,7 +197,7 @@
 //    if((len&(~1))!=(idx->dwChunkLength&(~1))){
 //    if((len)!=(idx->dwChunkLength)){
     if((len!=idx->dwChunkLength)&&((len+1)!=idx->dwChunkLength)){
-      if(verbose) printf("ChunkSize mismatch! raw=%d idx=%ld  \n",len,idx->dwChunkLength);
+      mp_msg(MSGT_DEMUX,MSGL_V,"ChunkSize mismatch! raw=%d idx=%ld  \n",len,idx->dwChunkLength);
       len=idx->dwChunkLength;
 //      continue;
     }
@@ -220,7 +221,7 @@
       if(!ret && priv->skip_video_frames<=0)
         if(--max_packs==0){
           demux->stream->eof=1;
-          printf("demux: file doesn't contain the selected audio or video stream\n");
+          mp_msg(MSGT_DEMUX,MSGL_ERR,"demux: file doesn't contain the selected audio or video stream\n");
           return 0;
         }
 } while(ret!=1);
@@ -258,18 +259,18 @@
       continue;
     }
     if(ds && demux_avi_select_stream(demux,idx->ckid)!=ds){
-      if(verbose>2) printf("Skip chunk %.4s (0x%X)  \n",(char *)&idx->ckid,(unsigned int)idx->ckid);
+      mp_dbg(MSGT_DEMUX,MSGL_DBG3,"Skip chunk %.4s (0x%X)  \n",(char *)&idx->ckid,(unsigned int)idx->ckid);
       continue; // skip this chunk
     }
 
     pos=idx->dwChunkOffset+priv->idx_offset;
     if(pos<demux->movi_start || pos>=demux->movi_end){
-      printf("ChunkOffset out of range!  current=0x%X  idx=0x%X  \n",demux->filepos,pos);
+      mp_msg(MSGT_DEMUX,MSGL_V,"ChunkOffset out of range!  current=0x%X  idx=0x%X  \n",demux->filepos,pos);
       continue;
     }
 #if 0
     if(pos!=demux->filepos){
-      printf("Warning! pos=0x%X  idx.pos=0x%X  diff=%d   \n",demux->filepos,pos,pos-demux->filepos);
+      mp_msg(MSGT_DEMUX,MSGL_V,"Warning! pos=0x%X  idx.pos=0x%X  diff=%d   \n",demux->filepos,pos,pos-demux->filepos);
     }
 #endif
     stream_seek(demux->stream,pos);
@@ -279,7 +280,7 @@
     if(stream_eof(demux->stream)) return 0;
 
     if(id!=idx->ckid){
-      if(verbose) printf("ChunkID mismatch! raw=%.4s idx=%.4s  \n",(char *)&id,(char *)&idx->ckid);
+      mp_msg(MSGT_DEMUX,MSGL_V,"ChunkID mismatch! raw=%.4s idx=%.4s  \n",(char *)&id,(char *)&idx->ckid);
       id=idx->ckid;
 //      continue;
     }
@@ -287,7 +288,7 @@
 //    if((len&(~1))!=(idx->dwChunkLength&(~1))){
 //    if((len)!=(idx->dwChunkLength)){
     if((len!=idx->dwChunkLength)&&((len+1)!=idx->dwChunkLength)){
-      if(verbose) printf("ChunkSize mismatch! raw=%d idx=%ld  \n",len,idx->dwChunkLength);
+      mp_msg(MSGT_DEMUX,MSGL_V,"ChunkSize mismatch! raw=%d idx=%ld  \n",len,idx->dwChunkLength);
       len=idx->dwChunkLength;
 //      continue;
     }
@@ -297,7 +298,7 @@
       if(!ret && priv->skip_video_frames<=0)
         if(--max_packs==0){
           demux->stream->eof=1;
-          printf("demux: file doesn't contain the selected audio or video stream\n");
+          mp_msg(MSGT_DEMUX,MSGL_ERR,"demux: file doesn't contain the selected audio or video stream\n");
           return 0;
         }
 } while(ret!=1);
@@ -385,7 +386,7 @@
       priv->idx_offset=demuxer->movi_start-4;
     else
       priv->idx_offset=0;
-    if(verbose) printf("AVI index offset: %d\n",priv->idx_offset);
+    mp_msg(MSGT_DEMUX,MSGL_V,"AVI index offset: %d\n",priv->idx_offset);
   }
 //  demuxer->endpos=avi_header.movi_end;
   
@@ -408,17 +409,17 @@
         }
       }
       if(v_pos==-1){
-        fprintf(stderr,"AVI_NI: missing video stream!? contact the author, it may be a bug :(\n");
+        mp_msg(MSGT_DEMUX,MSGL_ERR,"AVI_NI: missing video stream!? contact the author, it may be a bug :(\n");
 	return NULL;
 //        GUI_MSG( mplErrorAVINI )
 //        exit(1);
       }
       if(a_pos==-1){
-        printf("AVI_NI: No audio stream found -> nosound\n");
+        mp_msg(MSGT_DEMUX,MSGL_INFO,"AVI_NI: No audio stream found -> nosound\n");
         sh_audio=NULL;
       } else {
         if(force_ni || abs(a_pos-v_pos)>0x100000){  // distance > 1MB
-          printf("%s NON-INTERLEAVED AVI file-format!\n",force_ni?"Forced":"Detected");
+          mp_msg(MSGT_DEMUX,MSGL_INFO,"%s NON-INTERLEAVED AVI file-format!\n",force_ni?"Forced":"Detected");
           demuxer->type=DEMUXER_TYPE_AVI_NI; // HACK!!!!
 	  pts_from_bps=1; // force BPS sync!
         }
@@ -426,7 +427,7 @@
   } else {
       // no index
       if(force_ni){
-          printf("Using NON-INTERLEAVED Broken AVI file-format!\n");
+          mp_msg(MSGT_DEMUX,MSGL_INFO,"Using NON-INTERLEAVED Broken AVI file-format!\n");
           demuxer->type=DEMUXER_TYPE_AVI_NINI; // HACK!!!!
 	  priv->idx_pos_a=
 	  priv->idx_pos_v=demuxer->movi_start;
@@ -434,16 +435,16 @@
       }
   }
   if(!ds_fill_buffer(d_video)){
-    fprintf(stderr,"AVI: missing video stream!? contact the author, it may be a bug :(\n");
+    mp_msg(MSGT_DEMUX,MSGL_ERR,"AVI: missing video stream!? contact the author, it may be a bug :(\n");
     return NULL;
 //    GUI_MSG( mplAVIErrorMissingVideoStream )
 //    exit(1);
   }
   sh_video=d_video->sh;sh_video->ds=d_video;
   if(d_audio->id!=-2){
-    if(verbose) printf("AVI: Searching for audio stream (id:%d)\n",d_audio->id);
+    mp_msg(MSGT_DEMUX,MSGL_V,"AVI: Searching for audio stream (id:%d)\n",d_audio->id);
     if(!ds_fill_buffer(d_audio)){
-      printf("AVI: No Audio stream found...  ->nosound\n");
+      mp_msg(MSGT_DEMUX,MSGL_INFO,"AVI: No Audio stream found...  ->nosound\n");
       sh_audio=NULL;
     } else {
       sh_audio=d_audio->sh;sh_audio->ds=d_audio;
@@ -456,9 +457,9 @@
   // calculating video bitrate:
   sh_video->i_bps=demuxer->movi_end-demuxer->movi_start-priv->idx_size*8;
   if(sh_audio) sh_video->i_bps-=sh_audio->audio.dwLength;
-  if(verbose) printf("AVI video length=%d\n",sh_video->i_bps);
+  mp_msg(MSGT_DEMUX,MSGL_V,"AVI video length=%d\n",sh_video->i_bps);
   sh_video->i_bps=((float)sh_video->i_bps/(float)sh_video->video.dwLength)*sh_video->fps;
-  printf("VIDEO:  [%.4s]  %ldx%ld  %dbpp  %4.2f fps  %5.1f kbps (%4.1f kbyte/s)\n",
+  mp_msg(MSGT_DEMUX,MSGL_INFO,"VIDEO:  [%.4s]  %ldx%ld  %dbpp  %4.2f fps  %5.1f kbps (%4.1f kbyte/s)\n",
     (char *)&sh_video->bih->biCompression,
     sh_video->bih->biWidth,
     sh_video->bih->biHeight,
@@ -523,7 +524,7 @@
       priv->avi_video_pts=d_video->pack_no*(float)sh_video->video.dwScale/(float)sh_video->video.dwRate;
       d_video->pos=video_chunk_pos;
       
-      printf("V_SEEK:  pack=%d  pts=%5.3f  chunk=%d  \n",d_video->pack_no,priv->avi_video_pts,video_chunk_pos);
+      mp_msg(MSGT_SEEK,MSGL_DBG2,"V_SEEK:  pack=%d  pts=%5.3f  chunk=%d  \n",d_video->pack_no,priv->avi_video_pts,video_chunk_pos);
 
 // ------------ STEP 2: seek audio, find the right chunk & pos ------------
 
@@ -630,7 +631,7 @@
 	
 
 
-          if(verbose) printf("SEEK: idx=%d  (a:%d v:%d)  v.skip=%d  a.skip=%d/%4.3f  \n",
+          mp_msg(MSGT_SEEK,MSGL_V,"SEEK: idx=%d  (a:%d v:%d)  v.skip=%d  a.skip=%d/%4.3f  \n",
             priv->idx_pos,audio_chunk_pos,video_chunk_pos,
             priv->skip_video_frames,skip_audio_bytes,skip_audio_secs);
 

Index: demux_mov.c
===================================================================
RCS file: /cvsroot/mplayer/main/demux_mov.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- demux_mov.c	12 Aug 2001 01:57:01 -0000	1.1
+++ demux_mov.c	17 Aug 2001 00:40:25 -0000	1.2
@@ -5,7 +5,8 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-extern int verbose; // defined in mplayer.c
+#include "config.h"
+#include "mp_msg.h"
 
 #include "stream.h"
 #include "demuxer.h"
@@ -48,7 +49,7 @@
     int flags=0;
     mov_priv_t* priv=malloc(sizeof(mov_priv_t));
     
-    printf("Checking for MOV\n");
+    mp_msg(MSGT_DEMUX,MSGL_V,"Checking for MOV\n");
     
     memset(priv,0,sizeof(mov_priv_t));
     demuxer->priv=priv;
@@ -60,19 +61,19 @@
 	if(len<8) break; // invalid chunk
 	switch(id){
 	case MOV_FOURCC('m','o','o','v'):
-	  if(verbose)printf("MOV: Movie header found!\n");
+	  mp_msg(MSGT_DEMUX,MSGL_V,"MOV: Movie header found!\n");
 	  priv->moov_start=stream_tell(demuxer->stream);
 	  priv->moov_end=priv->moov_start+len-8;
 	  flags|=1;
 	  break;
 	case MOV_FOURCC('m','d','a','t'):
-	  if(verbose)printf("MOV: Movie DATA found!\n");
+	  mp_msg(MSGT_DEMUX,MSGL_V,"MOV: Movie DATA found!\n");
 	  priv->mdat_start=stream_tell(demuxer->stream);
 	  priv->mdat_end=priv->mdat_start+len-8;
 	  flags|=2;
 	  break;
 	default:
-	  if(verbose) printf("MOV: unknown chunk: %.4s %d\n",&id,(int)len);
+	  mp_msg(MSGT_DEMUX,MSGL_V,"MOV: unknown chunk: %.4s %d\n",&id,(int)len);
 	}
 	if(!stream_skip(demuxer->stream,len-8)) break;
     }
@@ -94,28 +95,28 @@
 	len-=8;
 	id=stream_read_dword(demuxer->stream);
 	//
-	if(verbose>1)printf("lschunks %.4s  %d\n",&id,(int)len);
+	mp_msg(MSGT_DEMUX,MSGL_DBG2,"lschunks %.4s  %d\n",&id,(int)len);
 	//
 	if(trak){
 	  switch(id){
 	    case MOV_FOURCC('t','k','h','d'): {
-		if(verbose)printf("MOV: %*sTrack header!\n",level,"");
+		mp_msg(MSGT_DEMUX,MSGL_V,"MOV: %*sTrack header!\n",level,"");
 		// read width x height
 		break;
 	    }
 	    case MOV_FOURCC('m','d','h','d'): {
-		if(verbose)printf("MOV: %*sMedia header!\n",level,"");
+		mp_msg(MSGT_DEMUX,MSGL_V,"MOV: %*sMedia header!\n",level,"");
 		// read timescale
 		break;
 	    }
 	    case MOV_FOURCC('v','m','h','d'): {
-		if(verbose)printf("MOV: %*sVideo header!\n",level,"");
+		mp_msg(MSGT_DEMUX,MSGL_V,"MOV: %*sVideo header!\n",level,"");
 		trak->type=MOV_TRAK_VIDEO;
 		// read video data
 		break;
 	    }
 	    case MOV_FOURCC('s','m','h','d'): {
-		if(verbose)printf("MOV: %*sSound header!\n",level,"");
+		mp_msg(MSGT_DEMUX,MSGL_V,"MOV: %*sSound header!\n",level,"");
 		trak->type=MOV_TRAK_AUDIO;
 		// read audio data
 		break;
@@ -123,13 +124,13 @@
 	    case MOV_FOURCC('s','t','s','d'): {
 		int i=stream_read_dword(demuxer->stream); // temp!
 		int count=stream_read_dword(demuxer->stream);
-		if(verbose)printf("MOV: %*sDescription list! (cnt:%d)\n",level,"",count);
+		mp_msg(MSGT_DEMUX,MSGL_V,"MOV: %*sDescription list! (cnt:%d)\n",level,"",count);
 		for(i=0;i<count;i++){
 		    off_t pos=stream_tell(demuxer->stream);
 		    off_t len=stream_read_dword(demuxer->stream);
 		    unsigned int fourcc=stream_read_dword_le(demuxer->stream);
 		    if(len<8) break; // error
-		    if(verbose)printf("MOV: %*s desc #%d: %.4s",level,"",i,&fourcc);
+		    mp_msg(MSGT_DEMUX,MSGL_V,"MOV: %*s desc #%d: %.4s",level,"",i,&fourcc);
 		    if(!i){
 			trak->fourcc=fourcc;
 			// read codec data
@@ -137,28 +138,28 @@
 			trak->data=malloc(trak->data_len);
 			stream_read(demuxer->stream,trak->data,trak->data_len);
 			if(trak->type==MOV_TRAK_VIDEO && trak->data_len>43){
-			    printf(" '%.*s'",trak->data_len-43,trak->data+43);
+			    mp_msg(MSGT_DEMUX,MSGL_V," '%.*s'",trak->data_len-43,trak->data+43);
 			}
 		    }
-		    if(verbose) printf("\n");
+		    mp_msg(MSGT_DEMUX,MSGL_V,"\n");
 		    if(fourcc!=trak->fourcc && i)
-			printf("MOV: Warning! variable FOURCC detected!?\n");
+			mp_msg(MSGT_DEMUX,MSGL_WARN,"MOV: Warning! variable FOURCC detected!?\n");
 		    if(!stream_seek(demuxer->stream,pos+len)) break;
 		}
 		break;
 	    }
 	    case MOV_FOURCC('m','d','i','a'): {
-		if(verbose)printf("MOV: %*sMedia stream!\n",level,"");
+		mp_msg(MSGT_DEMUX,MSGL_V,"MOV: %*sMedia stream!\n",level,"");
 		lschunks(demuxer,level+1,pos+len,trak);
 		break;
 	    }
 	    case MOV_FOURCC('m','i','n','f'): {
-		if(verbose)printf("MOV: %*sMedia info!\n",level,"");
+		mp_msg(MSGT_DEMUX,MSGL_V,"MOV: %*sMedia info!\n",level,"");
 		lschunks(demuxer,level+1,pos+len,trak);
 		break;
 	    }
 	    case MOV_FOURCC('s','t','b','l'): {
-		if(verbose)printf("MOV: %*sSample info!\n",level,"");
+		mp_msg(MSGT_DEMUX,MSGL_V,"MOV: %*sSample info!\n",level,"");
 		lschunks(demuxer,level+1,pos+len,trak);
 		break;
 	    }
@@ -167,19 +168,19 @@
 	if(id==MOV_FOURCC('t','r','a','k')){
 //	    if(trak) printf("MOV: Warning! trak in trak?\n");
 	    if(priv->track_db>=MOV_MAX_TRACKS){
-		printf("MOV: Warning! too many tracks!");
+		mp_msg(MSGT_DEMUX,MSGL_WARN,"MOV: Warning! too many tracks!");
 		return;
 	    }
 	    trak=malloc(sizeof(mov_track_t));
 	    memset(trak,0,sizeof(mov_track_t));
-	    if(verbose)printf("MOV: Track #%d:\n",priv->track_db);
+	    mp_msg(MSGT_DEMUX,MSGL_V,"MOV: Track #%d:\n",priv->track_db);
 	    trak->id=priv->track_db;
 	    priv->tracks[priv->track_db++]=trak;
 	    lschunks(demuxer,level+1,pos+len,trak);
 	    trak=NULL;
 	} else
 	if(id==MOV_FOURCC('c','m','o','v')){
-	    printf("MOV: Compressed headers not (yet) supported!\n");
+	    mp_msg(MSGT_DEMUX,MSGL_ERR,"MOV: Compressed headers not (yet) supported!\n");
 	    return;
 	}
 	
@@ -201,7 +202,7 @@
     // Build tables:
     // ...
     
-    printf("\n****** Quicktime MOV format not yet supported!!!!!!! *******\n");
+    mp_msg(MSGT_DEMUX,MSGL_ERR,"\n****** Quicktime MOV format not yet supported!!!!!!! *******\n");
 
     return 1;
 }

Index: demux_mpg.c
===================================================================
RCS file: /cvsroot/mplayer/main/demux_mpg.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- demux_mpg.c	12 Aug 2001 17:27:23 -0000	1.27
+++ demux_mpg.c	17 Aug 2001 00:40:25 -0000	1.28
@@ -4,7 +4,8 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-extern int verbose; // defined in mplayer.c
+#include "config.h"
+#include "mp_msg.h"
 
 #include "config.h"
 #include "dvdauth.h"
@@ -27,7 +28,7 @@
     return 0; // invalid pts
   }
   pts=(((c>>1)&7)<<30)|((d>>1)<<15)|(e>>1);
-  if(verbose>=3) printf("{%d}",pts);
+  mp_dbg(MSGT_DEMUX,MSGL_DBG3,"{%d}",pts);
   return pts;
 }
 
@@ -53,7 +54,7 @@
   unsigned int dts=0;
   demux_stream_t *ds=NULL;
   
-  if(verbose>=3) printf("demux_read_packet: %X\n",id);
+  mp_dbg(MSGT_DEMUX,MSGL_DBG3,"demux_read_packet: %X\n",id);
 
 //  if(id==0x1F0){
 //    demux->synced=0; // force resync after 0x1F0
@@ -66,10 +67,10 @@
   if(id==0x1BF) return -1; // private2
 
   len=stream_read_word(demux->stream);
-  if(verbose>=3)  printf("PACKET len=%d",len);
+  mp_dbg(MSGT_DEMUX,MSGL_DBG3,"PACKET len=%d",len);
 //  if(len==62480){ demux->synced=0;return -1;} /* :) */
   if(len==0 || len>MAX_PS_PACKETSIZE){
-    if(verbose>=2) printf("Invalid PS packet len: %d\n",len);
+    mp_dbg(MSGT_DEMUX,MSGL_DBG2,"Invalid PS packet len: %d\n",len);
     return -2;  // invalid packet !!!!!!
   }
 
@@ -106,14 +107,14 @@
 #ifdef HAVE_LIBCSS
         css=1;
 #else
-        printf("Encrypted VOB file (not compiled with libcss support)! Read file DOCS/DVD\n");
+        mp_msg(MSGT_DEMUX,MSGL_WARN,"Encrypted VOB file (not compiled with libcss support)! Read file DOCS/DVD\n");
 #endif
     }
     c=stream_read_char(demux->stream); pts_flags=c>>6;
     c=stream_read_char(demux->stream); hdrlen=c;
     len-=2;
-    if(verbose>=3) printf("  hdrlen=%d  (len=%d)",hdrlen,len);
-    if(hdrlen>len){ printf("demux_mpg: invalid header length  \n"); return -1;}
+    mp_dbg(MSGT_DEMUX,MSGL_DBG3,"  hdrlen=%d  (len=%d)",hdrlen,len);
+    if(hdrlen>len){ mp_msg(MSGT_DEMUX,MSGL_V,"demux_mpg: invalid header length  \n"); return -1;}
     if(pts_flags==2){
       c=stream_read_char(demux->stream);
       pts=read_mpeg_timestamp(demux->stream,c);
@@ -144,7 +145,7 @@
         aid&=0x1F;
 
         if(!demux->s_streams[aid]){
-            printf("==> Found subtitle: %d\n",aid);
+            mp_msg(MSGT_DEMUX,MSGL_V,"==> Found subtitle: %d\n",aid);
             demux->s_streams[aid]=1;
         }
 
@@ -180,26 +181,26 @@
             c=stream_read_char(demux->stream);
             head|=c;--len;
           }
-          if(!len) printf("End of packet while searching for PCM header\n");
+          if(!len) mp_msg(MSGT_DEMUX,MSGL_V,"End of packet while searching for PCM header\n");
         }
       } //  if(demux->audio->id==aid)
 
-      } else printf("Unknown 0x1BD substream: 0x%02X  \n",aid);
+      } else mp_msg(MSGT_DEMUX,MSGL_V,"Unknown 0x1BD substream: 0x%02X  \n",aid);
 
     } //if(id==0x1BD)
 
   } else {
     if(c!=0x0f){
-      if (verbose>=1) printf("  {ERROR5,c=%d}  \n",c);
+      mp_msg(MSGT_DEMUX,MSGL_V,"  {ERROR5,c=%d}  \n",c);
       return -1;  // invalid packet !!!!!!
     }
   }
-  if(mpeg_pts_error) printf("  {PTS_err:%d}  \n",mpeg_pts_error);
-  if(verbose>=3) printf(" => len=%d\n",len);
+  if(mpeg_pts_error) mp_msg(MSGT_DEMUX,MSGL_V,"  {PTS_err:%d}  \n",mpeg_pts_error);
+  mp_dbg(MSGT_DEMUX,MSGL_DBG3," => len=%d\n",len);
 
 //  if(len<=0 || len>MAX_PS_PACKETSIZE) return -1;  // Invalid packet size
   if(len<=0 || len>MAX_PS_PACKETSIZE){
-    if(verbose>=2) printf("Invalid PS data len: %d\n",len);
+    mp_dbg(MSGT_DEMUX,MSGL_DBG2,"Invalid PS data len: %d\n",len);
     return -1;  // invalid packet !!!!!!
   }
   
@@ -225,19 +226,19 @@
   }
 
   if(ds){
-    if(verbose>=2) printf("DEMUX_MPG: Read %d data bytes from packet %04X\n",len,id);
+    mp_dbg(MSGT_DEMUX,MSGL_DBG2,"DEMUX_MPG: Read %d data bytes from packet %04X\n",len,id);
 //    printf("packet start = 0x%X  \n",stream_tell(demux->stream)-packet_start_pos);
 #ifdef HAVE_LIBCSS
     if (css) {
 	    if (descrambling) CSSDescramble(demux->stream->buffer,key_title); else
-		    printf("Encrypted stream but authentication was not requested by you!!\n");
+		    mp_msg(MSGT_DEMUX,MSGL_WARN,"Encrypted stream but authentication was not requested by you!!\n");
     }
 #endif
     ds_read_packet(ds,demux->stream,len,pts/90000.0f,0,0);
 //    if(ds==demux->sub) parse_dvdsub(ds->last->buffer,ds->last->len);
     return 1;
   }
-  if(verbose>=2) printf("DEMUX_MPG: Skipping %d data bytes from packet %04X\n",len,id);
+  mp_dbg(MSGT_DEMUX,MSGL_DBG2,"DEMUX_MPG: Skipping %d data bytes from packet %04X\n",len,id);
   if(len<=2356) stream_skip(demux->stream,len);
   return 0;
 }
@@ -284,13 +285,13 @@
   }
   if(stream_eof(demux->stream)) break;
   // sure: head=0x000001XX
-  if(verbose>=4) printf("*** head=0x%X\n",head);
+  mp_dbg(MSGT_DEMUX,MSGL_DBG4,"*** head=0x%X\n",head);
   if(demux->synced==0){
     if(head==0x1BA) demux->synced=1;
 #if 0
     else if(head>=0x1C0 && head<=0x1EF){
       demux->synced=2;
-      if(verbose) printf("Mpeg PES stream synced at 0x%X (%d)!\n",demux->filepos,demux->filepos);
+      mp_msg(MSGT_DEMUX,MSGL_V,"Mpeg PES stream synced at 0x%X (%d)!\n",demux->filepos,demux->filepos);
       num_elementary_packets100=0; // requires for re-sync!
       num_elementary_packets101=0; // requires for re-sync!
     }
@@ -299,7 +300,7 @@
   if(demux->synced==1){
     if(head==0x1BB || head==0x1BD || (head>=0x1C0 && head<=0x1EF)){
       demux->synced=2;
-      if(verbose) printf("system stream synced at 0x%X (%d)!\n",demux->filepos,demux->filepos);
+      mp_msg(MSGT_DEMUX,MSGL_V,"system stream synced at 0x%X (%d)!\n",demux->filepos,demux->filepos);
       num_elementary_packets100=0; // requires for re-sync!
       num_elementary_packets101=0; // requires for re-sync!
     } else demux->synced=0;
@@ -309,33 +310,33 @@
       if(!ret)
         if(--max_packs==0){
           demux->stream->eof=1;
-          printf("demux: file doesn't contain the selected audio or video stream\n");
+          mp_msg(MSGT_DEMUX,MSGL_ERR,"demux: file doesn't contain the selected audio or video stream\n");
           return 0;
         }
   } else {
     if(head>=0x100 && head<0x1B0){
       if(head==0x100) ++num_elementary_packets100; else
       if(head==0x101) ++num_elementary_packets101;
-      if(verbose>=3) printf("Opps... elementary video packet found: %03X\n",head);
+      mp_msg(MSGT_DEMUX,MSGL_DBG3,"Opps... elementary video packet found: %03X\n",head);
     } else
     if(head>=0x1C0 && head<0x1F0){
       ++num_elementary_packetsPES;
-      if(verbose>=3) printf("Opps... PES packet found: %03X\n",head);
+      mp_msg(MSGT_DEMUX,MSGL_DBG3,"Opps... PES packet found: %03X\n",head);
     } else
       if(head==0x1B6) ++num_elementary_packets1B6;
 #if 1
     if( ( (num_elementary_packets100>50 && num_elementary_packets101>50) ||
           (num_elementary_packetsPES>50) ) && skipped>4000000){
-        if(verbose) printf("sync_mpeg_ps: seems to be ES/PES stream...\n");
+        mp_msg(MSGT_DEMUX,MSGL_V,"sync_mpeg_ps: seems to be ES/PES stream...\n");
         demux->stream->eof=1;
         break;
     }
 #endif
   }
 } while(ret!=1);
-  if(verbose>=2) printf("demux: %d bad bytes skipped\n",skipped);
+  mp_dbg(MSGT_DEMUX,MSGL_DBG2,"demux: %d bad bytes skipped\n",skipped);
   if(demux->stream->eof){
-    if(verbose>=2) printf("MPEG Stream reached EOF\n");
+    mp_msg(MSGT_DEMUX,MSGL_V,"MPEG Stream reached EOF\n");
     return 0;
   }
   return 1;

Index: demuxer.c
===================================================================
RCS file: /cvsroot/mplayer/main/demuxer.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- demuxer.c	12 Aug 2001 17:27:23 -0000	1.21
+++ demuxer.c	17 Aug 2001 00:40:25 -0000	1.22
@@ -7,9 +7,8 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
-extern int verbose; // defined in mplayer.c
-
 #include "config.h"
+#include "mp_msg.h"
 
 #include "stream.h"
 #include "demuxer.h"
@@ -64,9 +63,9 @@
 
 sh_audio_t* new_sh_audio(demuxer_t *demuxer,int id){
     if(demuxer->a_streams[id]){
-        printf("Warning! Audio stream header %d redefined!\n",id);
+        mp_msg(MSGT_DEMUXER,MSGL_WARN,"Warning! Audio stream header %d redefined!\n",id);
     } else {
-        if(verbose) printf("==> Found audio stream: %d\n",id);
+        mp_msg(MSGT_DEMUXER,MSGL_V,"==> Found audio stream: %d\n",id);
         demuxer->a_streams[id]=malloc(sizeof(sh_audio_t));
         memset(demuxer->a_streams[id],0,sizeof(sh_audio_t));
     }
@@ -75,9 +74,9 @@
 
 sh_video_t* new_sh_video(demuxer_t *demuxer,int id){
     if(demuxer->v_streams[id]){
-        printf("Warning! video stream header %d redefined!\n",id);
+        mp_msg(MSGT_DEMUXER,MSGL_WARN,"Warning! video stream header %d redefined!\n",id);
     } else {
-        if(verbose) printf("==> Found video stream: %d\n",id);
+        mp_msg(MSGT_DEMUXER,MSGL_V,"==> Found video stream: %d\n",id);
         demuxer->v_streams[id]=malloc(sizeof(sh_video_t));
         memset(demuxer->v_streams[id],0,sizeof(sh_video_t));
     }
@@ -101,8 +100,7 @@
       // first packet in stream
       ds->first=ds->last=dp;
     }
-    if(verbose>=2)
-      printf("DEMUX: Append packet to %s, len=%d  pts=%5.3f  pos=%u  [packs: A=%d V=%d]\n",
+    mp_dbg(MSGT_DEMUXER,MSGL_DBG2,"DEMUX: Append packet to %s, len=%d  pts=%5.3f  pos=%u  [packs: A=%d V=%d]\n",
         (ds==ds->demuxer->audio)?"d_audio":"d_video",
         dp->len,dp->pts,(unsigned int)dp->pos,ds->demuxer->audio->packs,ds->demuxer->video->packs);
 }
@@ -148,9 +146,9 @@
   demuxer_t *demux=ds->demuxer;
   if(ds->buffer) free(ds->buffer);
   if(verbose>2){
-    if(ds==demux->audio) printf("ds_fill_buffer(d_audio) called\n");else
-    if(ds==demux->video) printf("ds_fill_buffer(d_video) called\n");else
-                         printf("ds_fill_buffer(unknown 0x%X) called\n",(unsigned int)ds);
+    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
+                         mp_dbg(MSGT_DEMUXER,MSGL_DBG3,"ds_fill_buffer(unknown 0x%X) called\n",(unsigned int)ds);
   }
   while(1){
     if(ds->packs){
@@ -177,23 +175,23 @@
       return 1; //ds->buffer_size;
     }
     if(demux->audio->packs>=MAX_PACKS || demux->audio->bytes>=MAX_PACK_BYTES){
-      printf("\nDEMUXER: Too many (%d in %d bytes) audio packets in the buffer!\n",demux->audio->packs,demux->audio->bytes);
-      printf("(maybe you play a non-interleaved stream/file or audio codec failed)\n");
+      mp_msg(MSGT_DEMUXER,MSGL_ERR,"\nDEMUXER: Too many (%d in %d bytes) audio packets in the buffer!\n",demux->audio->packs,demux->audio->bytes);
+      mp_msg(MSGT_DEMUXER,MSGL_HINT,"(maybe you play a non-interleaved stream/file or audio codec failed)\n");
       break;
     }
     if(demux->video->packs>=MAX_PACKS || demux->video->bytes>=MAX_PACK_BYTES){
-      printf("\nDEMUXER: Too many (%d in %d bytes) video packets in the buffer!\n",demux->video->packs,demux->video->bytes);
-      printf("(maybe you play a non-interleaved stream/file or video codec failed)\n");
+      mp_msg(MSGT_DEMUXER,MSGL_ERR,"\nDEMUXER: Too many (%d in %d bytes) video packets in the buffer!\n",demux->video->packs,demux->video->bytes);
+      mp_msg(MSGT_DEMUXER,MSGL_HINT,"(maybe you play a non-interleaved stream/file or video codec failed)\n");
       break;
     }
     if(!demux_fill_buffer(demux,ds)){
-       if(verbose) printf("ds_fill_buffer()->demux_fill_buffer() failed\n");
+       mp_dbg(MSGT_DEMUXER,MSGL_DBG2,"ds_fill_buffer()->demux_fill_buffer() failed\n");
        break; // EOF
     }
   }
   ds->buffer_pos=ds->buffer_size=0;
   ds->buffer=NULL;
-  if(verbose) printf("ds_fill_buffer: EOF reached (stream: %s)  \n",ds==demux->audio?"audio":"video");
+  mp_msg(MSGT_DEMUXER,MSGL_V,"ds_fill_buffer: EOF reached (stream: %s)  \n",ds==demux->audio?"audio":"video");
   ds->eof=1;
   return 0;
 }
@@ -330,7 +328,7 @@
       stream_read_dword_le(demuxer->stream); //filesize
       id=stream_read_dword_le(demuxer->stream); // "AVI "
       if(id==formtypeAVI){ 
-        printf("Detected AVI file format!\n");
+        mp_msg(MSGT_DEMUXER,MSGL_INFO,"Detected AVI file format!\n");
         file_format=DEMUXER_TYPE_AVI;
       }
     }
@@ -340,7 +338,7 @@
 if(file_format==DEMUXER_TYPE_UNKNOWN || file_format==DEMUXER_TYPE_ASF){
   demuxer=new_demuxer(stream,DEMUXER_TYPE_ASF,audio_id,video_id,dvdsub_id);
   if(asf_check_header(demuxer)){
-      printf("Detected ASF file format!\n");
+      mp_msg(MSGT_DEMUXER,MSGL_INFO,"Detected ASF file format!\n");
       file_format=DEMUXER_TYPE_ASF;
   }
 }
@@ -352,9 +350,9 @@
   if(!pes) demuxer->synced=1; // hack!
   if(ds_fill_buffer(demuxer->video)){
     if(!pes)
-      printf("Detected MPEG-PES file format!\n");
+      mp_msg(MSGT_DEMUXER,MSGL_INFO,"Detected MPEG-PES file format!\n");
     else
-      printf("Detected MPEG-PS file format!\n");
+      mp_msg(MSGT_DEMUXER,MSGL_INFO,"Detected MPEG-PS file format!\n");
     file_format=DEMUXER_TYPE_MPEG_PS;
   } else {
     // some hack to get meaningfull error messages to our unhappy users:
@@ -366,9 +364,9 @@
       file_format=DEMUXER_TYPE_MPEG_ES; //  <-- hack is here :)
     } else {
       if(demuxer->synced==2)
-        printf("Missing MPEG video stream!? contact the author, it may be a bug :(\n");
+        mp_msg(MSGT_DEMUXER,MSGL_ERR,"Missing MPEG video stream!? contact the author, it may be a bug :(\n");
       else
-        printf("Not MPEG System Stream format... (maybe Transport Stream?)\n");
+        mp_msg(MSGT_DEMUXER,MSGL_V,"Not MPEG System Stream format... (maybe Transport Stream?)\n");
     }
   }
   break;
@@ -378,10 +376,10 @@
 if(file_format==DEMUXER_TYPE_MPEG_ES){ // little hack, see above!
   demuxer=new_demuxer(stream,DEMUXER_TYPE_MPEG_ES,audio_id,video_id,dvdsub_id);
   if(!ds_fill_buffer(demuxer->video)){
-    printf("Invalid MPEG-ES stream??? contact the author, it may be a bug :(\n");
+    mp_msg(MSGT_DEMUXER,MSGL_ERR,"Invalid MPEG-ES stream??? contact the author, it may be a bug :(\n");
     file_format=DEMUXER_TYPE_UNKNOWN;
   } else {
-    printf("Detected MPEG-ES file format!\n");
+    mp_msg(MSGT_DEMUXER,MSGL_INFO,"Detected MPEG-ES file format!\n");
   }
 }
 //=============== Try to open as MOV file: =================
@@ -389,15 +387,15 @@
 if(file_format==DEMUXER_TYPE_UNKNOWN || file_format==DEMUXER_TYPE_MOV){
   demuxer=new_demuxer(stream,DEMUXER_TYPE_MOV,audio_id,video_id,dvdsub_id);
   if(mov_check_file(demuxer)){
-      printf("Detected QuickTime/MOV file format!\n");
+      mp_msg(MSGT_DEMUXER,MSGL_INFO,"Detected QuickTime/MOV file format!\n");
       file_format=DEMUXER_TYPE_MOV;
   }
 }
 #endif
 //=============== Unknown, exiting... ===========================
 if(file_format==DEMUXER_TYPE_UNKNOWN){
-  fprintf(stderr,"============= Sorry, this file format not recognized/supported ===============\n");
-  fprintf(stderr,"=== If this file is an AVI, ASF or MPEG stream, please contact the author! ===\n");
+  mp_msg(MSGT_DEMUXER,MSGL_ERR,"============= Sorry, this file format not recognized/supported ===============\n");
+  mp_msg(MSGT_DEMUXER,MSGL_ERR,"=== If this file is an AVI, ASF or MPEG stream, please contact the author! ===\n");
   return NULL;
 //  GUI_MSG( mplUnknowFileType )
 //  exit(1);
@@ -426,7 +424,7 @@
 //  demuxer->idx_pos=0;
 //  demuxer->endpos=avi_header.movi_end;
   if(!ds_fill_buffer(d_video)){
-    printf("ASF: no video stream found!\n");
+    mp_msg(MSGT_DEMUXER,MSGL_WARN,"ASF: no video stream found!\n");
     sh_video=NULL;
     //printf("ASF: missing video stream!? contact the author, it may be a bug :(\n");
     //GUI_MSG( mplASFErrorMissingVideoStream )
@@ -434,7 +432,7 @@
   } else {
     sh_video=d_video->sh;sh_video->ds=d_video;
     sh_video->fps=1000.0f; sh_video->frametime=0.001f; // 1ms
-    printf("VIDEO:  [%.4s]  %ldx%ld  %dbpp\n",
+    mp_msg(MSGT_DEMUXER,MSGL_INFO,"VIDEO:  [%.4s]  %ldx%ld  %dbpp\n",
       (char *)&sh_video->bih->biCompression,
       sh_video->bih->biWidth,
       sh_video->bih->biHeight,
@@ -442,9 +440,9 @@
 //      sh_video->i_bps=10*asf_packetsize; // FIXME!
   }
   if(audio_id!=-2){
-    if(verbose) printf("ASF: Searching for audio stream (id:%d)\n",d_audio->id);
+    mp_msg(MSGT_DEMUXER,MSGL_V,"ASF: Searching for audio stream (id:%d)\n",d_audio->id);
     if(!ds_fill_buffer(d_audio)){
-      printf("ASF: No Audio stream found...  ->nosound\n");
+      mp_msg(MSGT_DEMUXER,MSGL_INFO,"ASF: No Audio stream found...  ->nosound\n");
       sh_audio=NULL;
     } else {
       sh_audio=d_audio->sh;sh_audio->ds=d_audio;
@@ -463,7 +461,7 @@
   sh_video=d_video->sh;sh_video->ds=d_video;
   if(audio_id!=-2) {
    if(!ds_fill_buffer(d_audio)){
-    printf("MPEG: No Audio stream found...  ->nosound\n");
+    mp_msg(MSGT_DEMUXER,MSGL_INFO,"MPEG: No Audio stream found...  ->nosound\n");
     sh_audio=NULL;
    } else {
     sh_audio=d_audio->sh;sh_audio->ds=d_audio;

Index: dll_init.c
===================================================================
RCS file: /cvsroot/mplayer/main/dll_init.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- dll_init.c	1 Aug 2001 09:14:02 -0000	1.24
+++ dll_init.c	17 Aug 2001 00:40:25 -0000	1.25
@@ -4,8 +4,7 @@
 #include <unistd.h>
 
 #include "config.h"
-
-extern int verbose; // defined in mplayer.c
+#include "mp_msg.h"
 
 #include "stream.h"
 #include "demuxer.h"
@@ -31,7 +30,7 @@
     WAVEFORMATEX *in_fmt=sh_audio->wf;
     unsigned long srcsize=0;
 
-  if(verbose) printf("======= Win32 (ACM) AUDIO Codec init =======\n");
+    mp_msg(MSGT_WIN32,MSGL_V,"======= Win32 (ACM) AUDIO Codec init =======\n");
 
     sh_audio->srcstream=NULL;
 
@@ -52,31 +51,31 @@
 		    NULL,0,0,0);
     if(ret){
         if(ret==ACMERR_NOTPOSSIBLE)
-            printf("ACM_Decoder: Unappropriate audio format\n");
+            mp_msg(MSGT_WIN32,MSGL_ERR,"ACM_Decoder: Unappropriate audio format\n");
         else
-            printf("ACM_Decoder: acmStreamOpen error %d", (int)ret);
+            mp_msg(MSGT_WIN32,MSGL_ERR,"ACM_Decoder: acmStreamOpen error %d", (int)ret);
         sh_audio->srcstream=NULL;
         return 0;
     }
-    if(verbose) printf("Audio codec opened OK! ;-)\n");
+    mp_msg(MSGT_WIN32,MSGL_V,"Audio codec opened OK! ;-)\n");
 
     acmStreamSize(sh_audio->srcstream, in_fmt->nBlockAlign, &srcsize, ACM_STREAMSIZEF_SOURCE);
     //if(verbose) printf("Audio ACM output buffer min. size: %ld (reported by codec)\n",srcsize);
     srcsize*=2;
     //if(srcsize<MAX_OUTBURST) srcsize=MAX_OUTBURST;
     if(!srcsize){
-        printf("Warning! ACM codec reports srcsize=0\n");
+        mp_msg(MSGT_WIN32,MSGL_WARN,"Warning! ACM codec reports srcsize=0\n");
         srcsize=16384;
     }
     // limit srcsize to 4-16kb
     //while(srcsize && srcsize<4096) srcsize*=2;
     //while(srcsize>16384) srcsize/=2;
     sh_audio->audio_out_minsize=srcsize; // audio output min. size
-    if(verbose) printf("Audio ACM output buffer min. size: %ld\n",srcsize);
+    mp_msg(MSGT_WIN32,MSGL_V,"Audio ACM output buffer min. size: %ld\n",srcsize);
 
     acmStreamSize(sh_audio->srcstream, srcsize, &srcsize, ACM_STREAMSIZEF_DESTINATION);
     sh_audio->audio_in_minsize=srcsize; // audio input min. size
-    if(verbose) printf("Audio ACM input buffer min. size: %ld\n",srcsize);
+    mp_msg(MSGT_WIN32,MSGL_V,"Audio ACM input buffer min. size: %ld\n",srcsize);
     
     if(srcsize<in_fmt->nBlockAlign) srcsize=in_fmt->nBlockAlign;
 
@@ -93,7 +92,7 @@
         DWORD srcsize=0;
         DWORD len=minlen;
         acmStreamSize(sh_audio->srcstream,len , &srcsize, ACM_STREAMSIZEF_DESTINATION);
-        if(verbose>=3)printf("acm says: srcsize=%ld  (buffsize=%d)  out_size=%d\n",srcsize,sh_audio->a_in_buffer_size,len);
+        mp_msg(MSGT_WIN32,MSGL_DBG3,"acm says: srcsize=%ld  (buffsize=%d)  out_size=%d\n",srcsize,sh_audio->a_in_buffer_size,len);
 
         if(srcsize<sh_audio->wf->nBlockAlign){
            srcsize=sh_audio->wf->nBlockAlign;
@@ -108,7 +107,7 @@
             demux_read_data(sh_audio->ds,&sh_audio->a_in_buffer[sh_audio->a_in_buffer_len],
             srcsize-sh_audio->a_in_buffer_len);
         }
-        if(verbose>=3)printf("acm convert %d -> %d bytes\n",sh_audio->a_in_buffer_len,len);
+        mp_msg(MSGT_WIN32,MSGL_DBG3,"acm convert %d -> %d bytes\n",sh_audio->a_in_buffer_len,len);
         memset(&ash, 0, sizeof(ash));
         ash.cbStruct=sizeof(ash);
         ash.fdwStatus=0;
@@ -119,17 +118,17 @@
         ash.cbDstLength=len;
         hr=acmStreamPrepareHeader(sh_audio->srcstream,&ash,0);
         if(hr){
-          printf("ACM_Decoder: acmStreamPrepareHeader error %d\n",(int)hr);
+          mp_msg(MSGT_WIN32,MSGL_V,"ACM_Decoder: acmStreamPrepareHeader error %d\n",(int)hr);
 					return -1;
         }
         hr=acmStreamConvert(sh_audio->srcstream,&ash,0);
         if(hr){
-          if(verbose>=2) printf("ACM_Decoder: acmStreamConvert error %d\n",(int)hr);
+          mp_msg(MSGT_WIN32,MSGL_DBG2,"ACM_Decoder: acmStreamConvert error %d\n",(int)hr);
           
 //					return -1;
         }
         if(verbose>1)
-          printf("acm converted %d -> %d\n",ash.cbSrcLengthUsed,ash.cbDstLengthUsed);
+          mp_msg(MSGT_WIN32,MSGL_DBG2,"acm converted %d -> %d\n",ash.cbSrcLengthUsed,ash.cbDstLengthUsed);
         if(ash.cbSrcLengthUsed>=sh_audio->a_in_buffer_len){
           sh_audio->a_in_buffer_len=0;
         } else {
@@ -139,7 +138,7 @@
         len=ash.cbDstLengthUsed;
         hr=acmStreamUnprepareHeader(sh_audio->srcstream,&ash,0);
         if(hr){
-          printf("ACM_Decoder: acmStreamUnprepareHeader error %d\n",(int)hr);
+          mp_msg(MSGT_WIN32,MSGL_V,"ACM_Decoder: acmStreamUnprepareHeader error %d\n",(int)hr);
         }
         return len;
 }
@@ -151,7 +150,7 @@
   int yuv=0;
   unsigned int outfmt=sh_video->codec->outfmt[sh_video->outfmtidx];
 
-  if(verbose) printf("======= Win32 (VFW) VIDEO Codec init =======\n");
+  mp_msg(MSGT_WIN32,MSGL_V,"======= Win32 (VFW) VIDEO Codec init =======\n");
 
   memset(&sh_video->o_bih, 0, sizeof(BITMAPINFOHEADER));
   sh_video->o_bih.biSize = sizeof(BITMAPINFOHEADER);
@@ -160,7 +159,7 @@
 //  sh_video->hic = ICOpen( 0x63646976, sh_video->bih->biCompression, ICMODE_FASTDECOMPRESS);
   sh_video->hic = ICOpen( 0x63646976, sh_video->bih->biCompression, ICMODE_DECOMPRESS);
   if(!sh_video->hic){
-    printf("ICOpen failed! unknown codec / wrong parameters?\n");
+    mp_msg(MSGT_WIN32,MSGL_ERR,"ICOpen failed! unknown codec / wrong parameters?\n");
     return 0;
   }
 
@@ -168,10 +167,10 @@
 
   ret = ICDecompressGetFormat(sh_video->hic, sh_video->bih, &sh_video->o_bih);
   if(ret){
-    printf("ICDecompressGetFormat failed: Error %d\n", (int)ret);
+    mp_msg(MSGT_WIN32,MSGL_ERR,"ICDecompressGetFormat failed: Error %d\n", (int)ret);
     return 0;
   }
-  if(verbose) printf("ICDecompressGetFormat OK\n");
+  mp_msg(MSGT_WIN32,MSGL_V,"ICDecompressGetFormat OK\n");
   
 //  printf("ICM_DECOMPRESS_QUERY=0x%X",ICM_DECOMPRESS_QUERY);
 
@@ -234,7 +233,7 @@
       break;
 
   default:
-      printf("unsupported image format: 0x%x\n", outfmt);
+      mp_msg(MSGT_WIN32,MSGL_ERR,"unsupported image format: 0x%x\n", outfmt);
       return 0;
   }
 
@@ -272,22 +271,22 @@
       ICDecompressQueryEx(sh_video->hic, sh_video->bih, &sh_video->o_bih) :
       ICDecompressQuery(sh_video->hic, sh_video->bih, &sh_video->o_bih);
   if(ret){
-    printf("ICDecompressQuery failed: Error %d\n", (int)ret);
+    mp_msg(MSGT_WIN32,MSGL_ERR,"ICDecompressQuery failed: Error %d\n", (int)ret);
     return 0;
   }
-  if(verbose) printf("ICDecompressQuery OK\n");
+  mp_msg(MSGT_WIN32,MSGL_V,"ICDecompressQuery OK\n");
 
   ret = ex ?
       ICDecompressBeginEx(sh_video->hic, sh_video->bih, &sh_video->o_bih) :
       ICDecompressBegin(sh_video->hic, sh_video->bih, &sh_video->o_bih);
   if(ret){
-    printf("ICDecompressBegin failed: Error %d\n", (int)ret);
+    mp_msg(MSGT_WIN32,MSGL_ERR,"ICDecompressBegin failed: Error %d\n", (int)ret);
     return 0;
   }
 
   sh_video->our_out_buffer = shmem_alloc(sh_video->o_bih.biSizeImage);
   if(!sh_video->our_out_buffer){
-    printf("not enough memory for decoded picture buffer (%ld bytes)\n", sh_video->o_bih.biSizeImage);
+    mp_msg(MSGT_WIN32,MSGL_ERR,"not enough memory for decoded picture buffer (%ld bytes)\n", sh_video->o_bih.biSizeImage);
     return 0;
   }
 
@@ -296,6 +295,6 @@
 
 //  avi_header.our_in_buffer=malloc(avi_header.video.dwSuggestedBufferSize); // FIXME!!!!
   
-  if(verbose) printf("VIDEO CODEC Init OK!!! ;-)\n");
+  mp_msg(MSGT_WIN32,MSGL_V,"VIDEO CODEC Init OK!!! ;-)\n");
   return 1;
 }

Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.222
retrieving revision 1.223
diff -u -r1.222 -r1.223
--- mplayer.c	16 Aug 2001 22:40:06 -0000	1.222
+++ mplayer.c	17 Aug 2001 00:40:25 -0000	1.223
@@ -290,16 +290,16 @@
   }
 #endif
 
-  if(how) printf("\nExiting... (%s)\n",how);
-  if(verbose) printf("max framesize was %d bytes\n",max_framesize);
+  if(how) mp_msg(MSGT_CPLAYER,MSGL_INFO,"\nExiting... (%s)\n",how);
+  mp_msg(MSGT_CPLAYER,MSGL_V,"max framesize was %d bytes\n",max_framesize);
   if(benchmark){
       double tot=video_time_usage+vout_time_usage+audio_time_usage;
       double total_time_usage=(float)total_time_usage_start*0.000001;
-      printf("BENCHMARKs: V:%8.3fs VO:%8.3fs A:%8.3fs Sys:%8.3fs = %8.3fs\n",
+      mp_msg(MSGT_CPLAYER,MSGL_INFO,"BENCHMARKs: V:%8.3fs VO:%8.3fs A:%8.3fs Sys:%8.3fs = %8.3fs\n",
           video_time_usage,vout_time_usage,audio_time_usage,
 	  total_time_usage-tot,total_time_usage);
       if(total_time_usage>0.0)
-      printf("BENCHMARK%%: V:%8.4f%% VO:%8.4f%% A:%8.4f%% Sys:%8.4f%% = %8.4f%%\n",
+      mp_msg(MSGT_CPLAYER,MSGL_INFO,"BENCHMARK%%: V:%8.4f%% VO:%8.4f%% A:%8.4f%% Sys:%8.4f%% = %8.4f%%\n",
           100.0*video_time_usage/total_time_usage,
 	  100.0*vout_time_usage/total_time_usage,
 	  100.0*audio_time_usage/total_time_usage,
@@ -337,7 +337,7 @@
     // can't stop :(
     kill(getpid(),SIGKILL);
   }
-  fprintf(stderr,"\nMPlayer interrupted by signal %d in module: %s \n",x,
+  mp_msg(MSGT_CPLAYER,MSGL_FATAL,"\nMPlayer interrupted by signal %d in module: %s \n",x,
       current_module?current_module:"unknown"
   );
   #ifdef HAVE_GUI
@@ -382,15 +382,15 @@
 if (parse_config_file(conf, "/etc/mplayer.conf") < 0)
   exit(1);
 if ((conffile = get_path("")) == NULL) {
-  printf("Can't find HOME dir\n");
+  mp_msg(MSGT_CPLAYER,MSGL_WARN,"Can't find HOME dir\n");
 } else {
   mkdir(conffile, 0777);
   free(conffile);
   if ((conffile = get_path("config")) == NULL) {
-    printf("get_path(\"config\") sziiiivas\n");
+    mp_msg(MSGT_CPLAYER,MSGL_ERR,"get_path(\"config\") problem\n");
   } else {
     if ((conffile_fd = open(conffile, O_CREAT | O_EXCL | O_WRONLY, 0666)) != -1) {
-      printf("Creating config file: %s\n", conffile);
+      mp_msg(MSGT_CPLAYER,MSGL_INFO,"Creating config file: %s\n", conffile);
       write(conffile_fd, default_config, strlen(default_config));
       close(conffile_fd);
     }
@@ -446,7 +446,9 @@
 int i;
 int use_stdin=0; //int f; // filedes
 
-  printf("%s",banner_text);
+  mp_msg_init(MSGL_STATUS);
+
+  mp_msg(MSGT_CPLAYER,MSGL_INFO,"%s",banner_text);
 
 #ifdef HAVE_GUI
   if ( nogui )
@@ -526,7 +528,7 @@
   }
 #endif
   if(!video_out){
-    fprintf(stderr,"Invalid video output driver name: %s\nUse '-vo help' to get a list of available video drivers.\n",video_driver?video_driver:"?");
+    mp_msg(MSGT_CPLAYER,MSGL_FATAL,"Invalid video output driver name: %s\nUse '-vo help' to get a list of available video drivers.\n",video_driver?video_driver:"?");
     return 0;
   }
 
@@ -555,7 +557,7 @@
     }
   }
   if (!audio_out){
-    fprintf(stderr,"Invalid audio output driver name: %s\nUse '-ao help' to get a list of available audio drivers.\n",audio_driver);
+    mp_msg(MSGT_CPLAYER,MSGL_FATAL,"Invalid audio output driver name: %s\nUse '-ao help' to get a list of available audio drivers.\n",audio_driver);
     return 0;
   }
 /*DSP!!  if(dsp) audio_out->control(AOCONTROL_SET_DEVICE,(int)dsp);*/
@@ -563,8 +565,7 @@
 // check codec.conf
 if(!parse_codec_cfg(get_path("codecs.conf"))){
   if(!parse_codec_cfg(DATADIR"/codecs.conf")){
-    printf("(copy/link DOCS/codecs.conf to ~/.mplayer/codecs.conf)\n");
-    GUI_MSG( mplCodecConfNotFound )
+    mp_msg(MSGT_CPLAYER,MSGL_HINT,"(copy/link DOCS/codecs.conf to ~/.mplayer/codecs.conf)\n");
     exit(1);
   }
 }
@@ -573,7 +574,7 @@
 #ifdef USE_OSD
   if(font_name){
        vo_font=read_font_desc(font_name,font_factor,verbose>1);
-       if(!vo_font) fprintf(stderr,"Can't load font: %s\n",font_name);
+       if(!vo_font) mp_msg(MSGT_CPLAYER,MSGL_ERR,"Can't load font: %s\n",font_name);
   } else {
       // try default:
        vo_font=read_font_desc(get_path("font/font.desc"),font_factor,verbose>1);
@@ -586,7 +587,7 @@
 // check .sub
   if(sub_name){
        subtitles=sub_read_file(sub_name);
-       if(!subtitles) fprintf(stderr,"Can't load subtitles: %s\n",sub_name);
+       if(!subtitles) mp_msg(MSGT_CPLAYER,MSGL_ERR,"Can't load subtitles: %s\n",sub_name);
   } else {
       if(sub_auto)  // auto load sub file ...
          subtitles=sub_read_file( sub_filename( get_path("sub/"), filename ) );
@@ -602,11 +603,10 @@
 #ifdef HAVE_LIBCSS
   if (dvdimportkey) {
     if (dvd_import_key(dvdimportkey)) {
-	fprintf(stderr,"Error processing DVD KEY.\n");
-        GUI_MSG( mplErrorDVDKeyProcess )
+	mp_msg(MSGT_CPLAYER,MSGL_FATAL,"Error processing DVD KEY.\n");
 	exit(1);
     }
-    printf("DVD command line requested key is stored for descrambling.\n");
+    mp_msg(MSGT_CPLAYER,MSGL_INFO,"DVD command line requested key is stored for descrambling.\n");
   }
   if (dvd_auth_device) {
 //  if (dvd_auth(dvd_auth_device,f)) {
@@ -614,7 +614,7 @@
         GUI_MSG( mplErrorDVDAuth )
         exit(0);
       } 
-    printf("DVD auth sequence seems to be OK.\n");
+    mp_msg(MSGT_CPLAYER,MSGL_INFO,"DVD auth sequence seems to be OK.\n");
   }
 #endif
 
@@ -642,7 +642,7 @@
   case 3: ds=d_dvdsub;break;
   }
   if(!ds){        
-      fprintf(stderr,"dump: FATAL: selected stream missing!\n");
+      mp_msg(MSGT_CPLAYER,MSGL_FATAL,"dump: FATAL: selected stream missing!\n");
       exit(1);
   }
   // disable other streams:
@@ -651,7 +651,7 @@
   if(d_dvdsub && d_dvdsub!=ds) {ds_free_packs(d_dvdsub); d_dvdsub->id=-2; }
   // let's dump it!
   f=fopen(stream_dump_name?stream_dump_name:"stream.dump","wb");
-  if(!f){ fprintf(stderr,"Can't open dump file!!!\n");exit(1); }
+  if(!f){ mp_msg(MSGT_CPLAYER,MSGL_FATAL,"Can't open dump file!!!\n");exit(1); }
   while(!ds->eof){
     unsigned char* start;
     int in_size=ds_get_packet(ds,&start);
@@ -660,7 +660,7 @@
     if(in_size>0) fwrite(start,in_size,1,f);
   }
   fclose(f);
-  printf("core dumped :)\n");
+  mp_msg(MSGT_CPLAYER,MSGL_INFO,"core dumped :)\n");
   exit(1);
 }
 
@@ -671,13 +671,13 @@
 
   if(!video_read_properties(sh_video)) exit(1); // couldn't read header?
 
-  printf("[V] filefmt:%d  fourcc:0x%X  size:%dx%d  fps:%5.2f  ftime:=%6.4f\n",
+  mp_msg(MSGT_CPLAYER,MSGL_INFO,"[V] filefmt:%d  fourcc:0x%X  size:%dx%d  fps:%5.2f  ftime:=%6.4f\n",
    file_format,sh_video->format, sh_video->disp_w,sh_video->disp_h,
    sh_video->fps,sh_video->frametime
   );
 
   if(!sh_video->fps && !force_fps){
-    fprintf(stderr,"FPS not specified (or invalid) in the header! Use the -fps option!\n");
+    mp_msg(MSGT_CPLAYER,MSGL_FATAL,"FPS not specified (or invalid) in the header! Use the -fps option!\n");
     exit(1);
   }
 
@@ -686,7 +686,7 @@
 fflush(stdout);
 
 if(!sh_video){
-    fprintf(stderr,"Sorry, no video stream... it's unplayable yet\n");
+    mp_msg(MSGT_CPLAYER,MSGL_FATAL,"Sorry, no video stream... it's unplayable yet\n");
     exit(1);
 }
 
@@ -694,36 +694,36 @@
 if(sh_audio){
   // Go through the codec.conf and find the best codec...
   sh_audio->codec=NULL;
-  if(audio_family!=-1) printf("Trying to force audio codec driver family %d ...\n",audio_family);
+  if(audio_family!=-1) mp_msg(MSGT_CPLAYER,MSGL_INFO,"Trying to force audio codec driver family %d ...\n",audio_family);
   while(1){
     sh_audio->codec=find_codec(sh_audio->format,NULL,sh_audio->codec,1);
     if(!sh_audio->codec){
       if(audio_family!=-1) {
         sh_audio->codec=NULL; /* re-search */
-        printf("Can't find audio codec for forced driver family, fallback to other drivers.\n");
+        mp_msg(MSGT_CPLAYER,MSGL_ERR,"Can't find audio codec for forced driver family, fallback to other drivers.\n");
         audio_family=-1;
         continue;      
       }
-      printf("Can't find codec for audio format 0x%X !\n",sh_audio->format);
-      printf("*** Try to upgrade %s from DOCS/codecs.conf\n",get_path("codecs.conf"));
-      printf("*** If it's still not OK, then read DOCS/CODECS!\n");
+      mp_msg(MSGT_CPLAYER,MSGL_ERR,"Can't find codec for audio format 0x%X !\n",sh_audio->format);
+      mp_msg(MSGT_CPLAYER,MSGL_HINT, "*** Try to upgrade %s from DOCS/codecs.conf\n",get_path("codecs.conf"));
+      mp_msg(MSGT_CPLAYER,MSGL_HINT, "*** If it's still not OK, then read DOCS/CODECS!\n");
       sh_audio=NULL;
       break;
     }
     if(audio_codec && strcmp(sh_audio->codec->name,audio_codec)) continue;
     else if(audio_family!=-1 && sh_audio->codec->driver!=audio_family) continue;
-    printf("%s audio codec: [%s] drv:%d (%s)\n",audio_codec?"Forcing":"Detected",sh_audio->codec->name,sh_audio->codec->driver,sh_audio->codec->info);
+    mp_msg(MSGT_CPLAYER,MSGL_INFO,"%s audio codec: [%s] drv:%d (%s)\n",audio_codec?"Forcing":"Detected",sh_audio->codec->name,sh_audio->codec->driver,sh_audio->codec->info);
     break;
   }
 }
 
 if(sh_audio){
-  if(verbose) printf("Initializing audio codec...\n");
+  mp_msg(MSGT_CPLAYER,MSGL_V,"Initializing audio codec...\n");
   if(!init_audio(sh_audio)){
-    printf("Couldn't initialize audio codec! -> nosound\n");
+    mp_msg(MSGT_CPLAYER,MSGL_ERR,"Couldn't initialize audio codec! -> nosound\n");
     sh_audio=0;
   } else {
-    printf("AUDIO: srate=%d  chans=%d  bps=%d  sfmt=0x%X  ratio: %d->%d\n",sh_audio->samplerate,sh_audio->channels,sh_audio->samplesize,
+    mp_msg(MSGT_CPLAYER,MSGL_INFO,"AUDIO: srate=%d  chans=%d  bps=%d  sfmt=0x%X  ratio: %d->%d\n",sh_audio->samplerate,sh_audio->channels,sh_audio->samplesize,
         sh_audio->sample_format,sh_audio->i_bps,sh_audio->o_bps);
   }
 }
@@ -732,28 +732,20 @@
 
 // Go through the codec.conf and find the best codec...
 sh_video->codec=NULL;
-if(video_family!=-1) printf("Trying to force video codec driver family %d ...\n",video_family);
+if(video_family!=-1) mp_msg(MSGT_CPLAYER,MSGL_INFO,"Trying to force video codec driver family %d ...\n",video_family);
 while(1){
   sh_video->codec=find_codec(sh_video->format,
     sh_video->bih?((unsigned int*) &sh_video->bih->biCompression):NULL,sh_video->codec,0);
   if(!sh_video->codec){
     if(video_family!=-1) {
       sh_video->codec=NULL; /* re-search */
-      printf("Can't find video codec for forced driver family, fallback to other drivers.\n");
+      mp_msg(MSGT_CPLAYER,MSGL_WARN,"Can't find video codec for forced driver family, fallback to other drivers.\n");
       video_family=-1;
       continue;      
     }
-    printf("Can't find codec for video format 0x%X !\n",sh_video->format);
-      printf("*** Try to upgrade %s from DOCS/codecs.conf\n",get_path("codecs.conf"));
-      printf("*** If it's still not OK, then read DOCS/CODECS!\n");
-    #ifdef HAVE_GUI
-     if ( !nogui )
-      {
-       mplShMem->items.videodata.format=sh_video->format;
-       mplSendMessage( mplCantFindCodecForVideoFormat );
-       usec_sleep( 10000 );
-      }
-    #endif
+    mp_msg(MSGT_CPLAYER,MSGL_ERR,"Can't find codec for video format 0x%X !\n",sh_video->format);
+    mp_msg(MSGT_CPLAYER,MSGL_HINT,"*** Try to upgrade %s from DOCS/codecs.conf\n",get_path("codecs.conf"));
+    mp_msg(MSGT_CPLAYER,MSGL_HINT,"*** If it's still not OK, then read DOCS/CODECS!\n");
     exit(1);
   }
   // is next line needed anymore? - atmos ::
@@ -763,7 +755,7 @@
   break;
 }
 
-printf("%s video codec: [%s] drv:%d (%s)\n",video_codec?"Forcing":"Detected",sh_video->codec->name,sh_video->codec->driver,sh_video->codec->info);
+mp_msg(MSGT_CPLAYER,MSGL_INFO,"%s video codec: [%s] drv:%d (%s)\n",video_codec?"Forcing":"Detected",sh_video->codec->name,sh_video->codec->driver,sh_video->codec->info);
 
 for(i=0;i<CODECS_MAX_OUTFMT;i++){
     int ret;
@@ -774,12 +766,11 @@
 #else
     ret=video_out->query_format(out_fmt);
 #endif
-    if(verbose) printf("vo_debug: query(%s) returned 0x%X\n",vo_format_name(out_fmt),ret);
+    mp_msg(MSGT_CPLAYER,MSGL_DBG2,"vo_debug: query(%s) returned 0x%X\n",vo_format_name(out_fmt),ret);
     if(ret) break;
 }
 if(i>=CODECS_MAX_OUTFMT){
-    fprintf(stderr,"Sorry, selected video_out device is incompatible with this codec.\n");
-    GUI_MSG( mplIncompatibleVideoOutDevice )
+    mp_msg(MSGT_CPLAYER,MSGL_FATAL,"Sorry, selected video_out device is incompatible with this codec.\n");
     exit(1);
 }
 sh_video->outfmtidx=i;
@@ -792,11 +783,10 @@
          flip=1;
 }
 
-if(verbose) printf("vo_debug1: out_fmt=%s\n",vo_format_name(out_fmt));
+mp_msg(MSGT_CPLAYER,MSGL_DBG2,"vo_debug1: out_fmt=%s\n",vo_format_name(out_fmt));
 
 if(!init_video(sh_video)){
-     fprintf(stderr,"FATAL: Couldn't initialize video codec :(\n");
-     GUI_MSG( mplUnknowError )
+     mp_msg(MSGT_CPLAYER,MSGL_FATAL,"FATAL: Couldn't initialize video codec :(\n");
      exit(1);
 }
 
@@ -805,7 +795,7 @@
     output_quality=get_video_quality_max(sh_video);
     if(auto_quality>output_quality) auto_quality=output_quality;
     else output_quality=auto_quality;
-    printf("AutoQ: setting quality to %d\n",output_quality);
+    mp_msg(MSGT_CPLAYER,MSGL_V,"AutoQ: setting quality to %d\n",output_quality);
     set_video_quality(sh_video,output_quality);
 }
 
@@ -815,12 +805,12 @@
      FILE *encode_file=fopen(encode_name,"rb");
      if(encode_file){
        fclose(encode_file);
-       fprintf(stderr,"File already exists: %s (don't overwrite your favourite AVI!)\n",encode_name);
+       mp_msg(MSGT_CPLAYER,MSGL_FATAL,"File already exists: %s (don't overwrite your favourite AVI!)\n",encode_name);
        return 0;
      }
      encode_file=fopen(encode_name,"wb");
      if(!encode_file){
-       fprintf(stderr,"Cannot create file for encoding\n");
+       mp_msg(MSGT_CPLAYER,MSGL_FATAL,"Cannot create file for encoding\n");
        return 0;
      }
      write_avi_header_1(encode_file,mmioFOURCC('d', 'i', 'v', 'x'),sh_video->fps,sh_video->disp_w,sh_video->disp_h);
@@ -866,7 +856,7 @@
 
 #ifndef USE_LIBVO2
    { const vo_info_t *info = video_out->get_info();
-     printf("VO: [%s] %dx%d => %dx%d %s %s%s%s%s\n",info->short_name,
+     mp_msg(MSGT_CPLAYER,MSGL_INFO,"VO: [%s] %dx%d => %dx%d %s %s%s%s%s\n",info->short_name,
          sh_video->disp_w,sh_video->disp_h,
          screen_size_x,screen_size_y,
 	 vo_format_name(out_fmt),
@@ -876,19 +866,14 @@
          (flip==1)?"flip ":""
 //         fullscreen|(vidmode<<1)|(softzoom<<2)|(flip<<3)
      );
-    if(verbose){
-    printf("VO: Description: %s\n"
-           "VO: Author: %s\n",
-        info->name,
-        info->author	
-     );
+    mp_msg(MSGT_CPLAYER,MSGL_V,"VO: Description: %s\n",info->name);
+    mp_msg(MSGT_CPLAYER,MSGL_V,"VO: Author: %s\n", info->author);
     if(strlen(info->comment) > 0)
-        printf("VO: Comment: %s\n", info->comment);
-    }
+        mp_msg(MSGT_CPLAYER,MSGL_V,"VO: Comment: %s\n", info->comment);
    }
 #endif
 
-   if(verbose) printf("video_out->init(%dx%d->%dx%d,flags=%d,'%s',0x%X)\n",
+   mp_msg(MSGT_CPLAYER,MSGL_V,"video_out->init(%dx%d->%dx%d,flags=%d,'%s',0x%X)\n",
                       sh_video->disp_w,sh_video->disp_h,
                       screen_size_x,screen_size_y,
                       fullscreen|(vidmode<<1)|(softzoom<<2)|(flip<<3),
@@ -907,8 +892,7 @@
    if(!vo2_start(video_out,
                sh_video->disp_w,sh_video->disp_h,out_fmt,0,
                       fullscreen|(vidmode<<1)|(softzoom<<2)|(flip<<3) )){
-     fprintf(stderr,"FATAL: Cannot initialize video driver!\n");
-     GUI_MSG( mplCantInitVideoDriver )
+     mp_msg(MSGT_CPLAYER,MSGL_FATAL,"FATAL: Cannot initialize video driver!\n");
      exit(1);
    }
 #else
@@ -916,12 +900,11 @@
                       screen_size_x,screen_size_y,
                       fullscreen|(vidmode<<1)|(softzoom<<2)|(flip<<3),
                       title,out_fmt)){
-     fprintf(stderr,"FATAL: Cannot initialize video driver!\n");
-     GUI_MSG( mplCantInitVideoDriver )
+     mp_msg(MSGT_CPLAYER,MSGL_FATAL,"FATAL: Cannot initialize video driver!\n");
      exit(1);
    }
 #endif
-   if(verbose) printf("INFO: Video OUT driver init OK!\n");
+   mp_msg(MSGT_CPLAYER,MSGL_V,"INFO: Video OUT driver init OK!\n");
 
    fflush(stdout);
    
@@ -987,23 +970,21 @@
 if(sh_audio){
   
   const ao_info_t *info=audio_out->info;
-  printf("AO: [%s] %iHz %s %s\n",
+  mp_msg(MSGT_CPLAYER,MSGL_INFO,"AO: [%s] %iHz %s %s\n",
       info->short_name,
       force_srate?force_srate:sh_audio->samplerate,
       sh_audio->channels>1?"Stereo":"Mono",
       audio_out_format_name(sh_audio->sample_format)
    );
-  if(verbose){
-   printf("AO: Description: %s\nAO: Author: %s\n",
+   mp_msg(MSGT_CPLAYER,MSGL_V,"AO: Description: %s\nAO: Author: %s\n",
       info->name,
       info->author	
    );
    if(strlen(info->comment) > 0)
-      printf("AO: Comment: %s\n", info->comment);
-  }
+      mp_msg(MSGT_CPLAYER,MSGL_V,"AO: Comment: %s\n", info->comment);
   if(!audio_out->init(force_srate?force_srate:sh_audio->samplerate,
       sh_audio->channels,sh_audio->sample_format,0)){
-    printf("couldn't open/init audio device -> NOSOUND\n");
+    mp_msg(MSGT_CPLAYER,MSGL_ERR,"couldn't open/init audio device -> NOSOUND\n");
     sh_audio=0; audio_out=NULL;
   }
 
@@ -1022,8 +1003,8 @@
   if(sh_audio) sh_audio->timer=0;
 
 if(!sh_audio){
-  printf("Audio: no sound\n");
-  if(verbose) printf("Freeing %d unused audio chunks\n",d_audio->packs);
+  mp_msg(MSGT_CPLAYER,MSGL_INFO,"Audio: no sound\n");
+  if(verbose) mp_msg(MSGT_CPLAYER,MSGL_V,"Freeing %d unused audio chunks\n",d_audio->packs);
   ds_free_packs(d_audio); // free buffered chunks
   d_audio->id=-2;         // do not read audio chunks
   if(sh_audio) if(sh_audio->a_buffer) free(sh_audio->a_buffer);
@@ -1057,10 +1038,10 @@
 if(force_fps){
   sh_video->fps=force_fps;
   sh_video->frametime=1.0f/sh_video->fps;
-  printf("FPS forced to be %5.3f  (ftime: %5.3f)\n",sh_video->fps,sh_video->frametime);
+  mp_msg(MSGT_CPLAYER,MSGL_INFO,"FPS forced to be %5.3f  (ftime: %5.3f)\n",sh_video->fps,sh_video->frametime);
 }
 
-printf("Start playing...\n");fflush(stdout);
+mp_msg(MSGT_CPLAYER,MSGL_INFO,"Start playing...\n");fflush(stdout);
 
 InitTimer();
 
@@ -1197,7 +1178,7 @@
     // get mpeg fps:
     newfps=frameratecode2framerate[picture->frame_rate_code]*0.0001f;
     if(ABS(sh_video->fps-newfps)>0.01f) if(!force_fps){
-            printf("Warning! FPS changed %5.3f -> %5.3f  (%f) [%d]  \n",sh_video->fps,newfps,sh_video->fps-newfps,picture->frame_rate_code);
+            mp_msg(MSGT_CPLAYER,MSGL_WARN,"Warning! FPS changed %5.3f -> %5.3f  (%f) [%d]  \n",sh_video->fps,newfps,sh_video->fps-newfps,picture->frame_rate_code);
             sh_video->fps=newfps;
             sh_video->frametime=10000.0f/(float)frameratecode2framerate[picture->frame_rate_code];
     }
@@ -1245,22 +1226,22 @@
 
     if(file_format==DEMUXER_TYPE_MPEG_PS) d_video->pts+=frame_time;
     
-    if(verbose>1) printf("*** ftime=%5.3f ***\n",frame_time);
+    mp_dbg(MSGT_AVSYNC,MSGL_DBG2,"*** ftime=%5.3f ***\n",frame_time);
 
     if(drop_frame){
 
       if(sh_audio && !d_audio->eof){
           int delay=audio_out->get_delay();
-          if(verbose>1)printf("delay=%d\n",delay);
+          mp_dbg(MSGT_AVSYNC,MSGL_DBG2,"delay=%d\n",delay);
           time_frame=sh_video->timer;
           time_frame-=sh_audio->timer-(float)delay/(float)sh_audio->o_bps;
 	  if(time_frame>-2*frame_time) {
 	    drop_frame=0; // stop dropping frames
-	    if (verbose>0) printf("\nstop frame drop %.2f\n", time_frame);
+	    mp_msg(MSGT_AVSYNC,MSGL_DBG2,"\nstop frame drop %.2f\n", time_frame);
 	  }else{
 	    ++drop_frame_cnt;
 	    if (verbose > 0 && drop_frame_cnt%10 == 0)
-	      printf("\nstill dropping, %.2f\n", time_frame);
+	      mp_msg(MSGT_AVSYNC,MSGL_DBG2,"\nstill dropping, %.2f\n", time_frame);
 	  }
       }
       video_out->check_events(); // check events AST
@@ -1272,7 +1253,7 @@
 
       if(sh_audio && !d_audio->eof){
           int delay=audio_out->get_delay();
-          if(verbose>1)printf("delay=%d\n",delay);
+          mp_dbg(MSGT_AVSYNC,MSGL_DBG2,"delay=%d\n",delay);
           time_frame=sh_video->timer;
           time_frame-=sh_audio->timer-(float)delay/(float)sh_audio->o_bps;
           // we are out of time... drop next frame!
@@ -1282,12 +1263,13 @@
 	      ++drop_frame_cnt;
 	      if(drop_frame_cnt>50 && AV_delay>0.5 && !drop_message){
 	          drop_message=1;
-	          printf("\n************************************************************************"
+	          mp_msg(MSGT_AVSYNC,MSGL_WARN,
+		         "\n************************************************************************"
 		         "\n** Your system is too SLOW to play this! try with -framedrop or RTFM! **"
 			 "\n************************************************************************"
 			 "\n");
 	      }
-	      if (verbose>0) printf("\nframe drop %d, %.2f\n", drop_frame, time_frame);
+	      mp_msg(MSGT_AVSYNC,MSGL_DBG2,"\nframe drop %d, %.2f\n", drop_frame, time_frame);
 	  }
       } else {
           if( (time_frame<-3*frame_time || time_frame>3*frame_time) || benchmark)
@@ -1367,8 +1349,7 @@
     }
     v_pts=d_video->pts;
 
-    if(verbose>1)
-      printf("### A:%8.3f (%8.3f)  V:%8.3f  A-V:%7.4f  \n",a_pts,a_pts-audio_delay-delay,v_pts,(a_pts-delay-audio_delay)-v_pts);
+      mp_dbg(MSGT_AVSYNC,MSGL_DBG2,"### A:%8.3f (%8.3f)  V:%8.3f  A-V:%7.4f  \n",a_pts,a_pts-audio_delay-delay,v_pts,(a_pts-delay-audio_delay)-v_pts);
 
       if(delay_corrected){
         float x;
@@ -1381,7 +1362,7 @@
         else
           max_pts_correction=sh_video->frametime*0.10; // +-10% of time
         sh_audio->timer+=x; c_total+=x;
-        if(!quiet) printf("A:%6.1f V:%6.1f A-V:%7.3f ct:%7.3f  %3d/%3d  %2d%% %2d%% %4.1f%% %d %d\r",
+        if(!quiet) mp_msg(MSGT_AVSYNC,MSGL_STATUS,"A:%6.1f V:%6.1f A-V:%7.3f ct:%7.3f  %3d/%3d  %2d%% %2d%% %4.1f%% %d %d\r",
 	  a_pts-audio_delay-delay,v_pts,AV_delay,c_total,
           (int)sh_video->num_frames,(int)sh_video->num_frames_decoded,
           (sh_video->timer>0.5)?(int)(100.0*video_time_usage/(double)sh_video->timer):0,
@@ -1397,7 +1378,7 @@
     // No audio:
     
     if(!quiet)
-      printf("V:%6.1f  %3d  %2d%%  %2d%%  %3.1f%% \r",d_video->pts,
+      mp_msg(MSGT_AVSYNC,MSGL_STATUS,"V:%6.1f  %3d  %2d%%  %2d%%  %3.1f%% \r",d_video->pts,
         (int)sh_video->num_frames,
         (sh_video->timer>0.5)?(int)(100.0*video_time_usage/(double)sh_video->timer):0,
         (sh_video->timer>0.5)?(int)(100.0*vout_time_usage/(double)sh_video->timer):0,
@@ -1418,7 +1399,7 @@
      (0.95*sh_video->timer-(vout_time_usage+audio_time_usage))*
      (sh_video->timer-cvideo_base_vframe-frame_correction)){
     output_quality>>=1;
-    printf("Downgrading quality to %i.\n",output_quality);
+    mp_msg(MSGT_AUTOQ,MSGL_DBG2,"Downgrading quality to %i.\n",output_quality);
     set_video_quality(sh_video,output_quality);
   } else
   /*If we had plenty of extra time, upgrade the quality.*/
@@ -1428,7 +1409,7 @@
      (0.67*sh_video->timer-(vout_time_usage+audio_time_usage))*
      (sh_video->timer-cvideo_base_vframe-frame_correction)){
     output_quality++;
-    printf("Upgrading quality to %i.\n",output_quality);
+    mp_msg(MSGT_AUTOQ,MSGL_DBG2,"Upgrading quality to %i.\n",output_quality);
     set_video_quality(sh_video,output_quality);
   }
 #else
@@ -1458,7 +1439,7 @@
 #endif
 
   if(osd_function==OSD_PAUSE){
-      printf("\n------ PAUSED -------\r");fflush(stdout);
+      mp_msg(MSGT_CPLAYER,MSGL_STATUS,"\n------ PAUSED -------\r");fflush(stdout);
       if (audio_out && sh_audio)
          audio_out->pause();	// pause audio, keep data if possible
 #ifdef HAVE_GUI
@@ -1651,7 +1632,7 @@
 
     case 'd':
       frame_dropping=(frame_dropping+1)%3;
-      printf("== drop: %d ==  \n",frame_dropping);
+      mp_msg(MSGT_CPLAYER,MSGL_V,"== drop: %d ==  \n",frame_dropping);
       break;
   }
 } // keyboard event handler
@@ -1678,11 +1659,11 @@
 	if(verbose){
 	    float a_pts=d_audio->pts;
             a_pts+=(ds_tell_pts(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps;
-	    printf("SEEK: A: %5.3f  V: %5.3f  A-V: %5.3f   \n",a_pts,d_video->pts,a_pts-d_video->pts);
+	    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);
 	}
-        printf("A:%6.1f  V:%6.1f  A-V:%7.3f  ct: ?   \r",d_audio->pts,d_video->pts,0.0f);
+        mp_msg(MSGT_AVSYNC,MSGL_STATUS,"A:%6.1f  V:%6.1f  A-V:%7.3f  ct: ?   \r",d_audio->pts,d_video->pts,0.0f);
       } else {
-        printf("A: ---   V:%6.1f   \r",d_video->pts);
+        mp_msg(MSGT_AVSYNC,MSGL_STATUS,"A: ---   V:%6.1f   \r",d_video->pts);
       }
       fflush(stdout);
 
@@ -1745,19 +1726,19 @@
     if(len>=2){
       int len2;
       len2=(packet[0]<<8)+packet[1];
-      if(verbose) printf("\rDVD sub: %d / %d  \n",len,len2);
+      mp_msg(MSGT_CPLAYER,MSGL_V,"\rDVD sub: %d / %d  \n",len,len2);
       if(len==len2)
         spudec_decode(packet,len);
       else
-        printf("fragmented dvd-subs not yet supported!!!\n");
+        mp_msg(MSGT_CPLAYER,MSGL_V,"fragmented dvd-subs not yet supported!!!\n");
     } else if(len>=0) {
-      printf("invalud dvd sub\n");
+      mp_msg(MSGT_CPLAYER,MSGL_V,"invalid dvd sub\n");
     }
   }
   
 } // while(!eof)
 
-if(verbose) printf("EOF code: %d  \n",eof);
+mp_msg(MSGT_GLOBAL,MSGL_V,"EOF code: %d  \n",eof);
 
 exit_player("End of file");
 }

Index: open.c
===================================================================
RCS file: /cvsroot/mplayer/main/open.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- open.c	11 Aug 2001 12:46:01 -0000	1.3
+++ open.c	17 Aug 2001 00:40:25 -0000	1.4
@@ -6,6 +6,7 @@
 #include <fcntl.h>
 
 #include "config.h"
+#include "mp_msg.h"
 
 #ifdef __FreeBSD__
 #include <sys/cdrio.h>
@@ -20,7 +21,6 @@
 static URL_t* url;
 #endif
 
-extern int verbose;
 extern int vcd_get_track_end(int fd,int track);
 
 // Open a new stream  (stdin/file/vcd/url)
@@ -40,14 +40,14 @@
 if(vcd_track){
   int ret,ret2;
   f=open(filename,O_RDONLY);
-  if(f<0){ fprintf(stderr,"CD-ROM Device '%s' not found!\n",filename);return NULL; }
+  if(f<0){ mp_msg(MSGT_OPEN,MSGL_ERR,"CD-ROM Device '%s' not found!\n",filename);return NULL; }
   vcd_read_toc(f);
   ret2=vcd_get_track_end(f,vcd_track);
-  if(ret2<0){ fprintf(stderr,"Error selecting VCD track! (get)\n");return NULL;}
+  if(ret2<0){ mp_msg(MSGT_OPEN,MSGL_ERR,"Error selecting VCD track! (get)\n");return NULL;}
   ret=vcd_seek_to_track(f,vcd_track);
-  if(ret<0){ fprintf(stderr,"Error selecting VCD track! (seek)\n");return NULL;}
+  if(ret<0){ mp_msg(MSGT_OPEN,MSGL_ERR,"Error selecting VCD track! (seek)\n");return NULL;}
 //  seek_to_byte+=ret;
-  if(verbose) printf("VCD start byte position: 0x%X  end: 0x%X\n",ret,ret2);
+  mp_msg(MSGT_OPEN,MSGL_V,"VCD start byte position: 0x%X  end: 0x%X\n",ret,ret2);
 #ifdef VCD_CACHE
   vcd_cache_init(vcd_cache_size);
 #endif
@@ -65,7 +65,7 @@
 //============ Open STDIN ============
   if(!strcmp(filename,"-")){
       // read from stdin
-      printf("Reading from stdin...\n");
+      mp_msg(MSGT_OPEN,MSGL_INFO,"Reading from stdin...\n");
       f=0; // 0=stdin
       stream=new_stream(f,STREAMTYPE_STREAM);
       return stream;
@@ -76,13 +76,13 @@
   if(url) {
         (*file_format)=autodetectProtocol( url, &f );
         if( (*file_format)==DEMUXER_TYPE_UNKNOWN ) { 
-          fprintf(stderr,"Unable to open URL: %s\n", filename);
+          mp_msg(MSGT_OPEN,MSGL_ERR,"Unable to open URL: %s\n", filename);
           url_free(url);
           return NULL;
         }
         f=streaming_start( &url, f, file_format );
-        if(f<0){ fprintf(stderr,"Unable to open URL: %s\n", url->url); return NULL; }
-        printf("Connected to server: %s\n", url->hostname );
+        if(f<0){ mp_msg(MSGT_OPEN,MSGL_ERR,"Unable to open URL: %s\n", url->url); return NULL; }
+        mp_msg(MSGT_OPEN,MSGL_INFO,"Connected to server: %s\n", url->hostname );
         stream=new_stream(f,STREAMTYPE_STREAM);
 	return NULL;
   }
@@ -90,16 +90,16 @@
 
 //============ Open plain FILE ============
        f=open(filename,O_RDONLY);
-       if(f<0){ fprintf(stderr,"File not found: '%s'\n",filename);return NULL; }
+       if(f<0){ mp_msg(MSGT_OPEN,MSGL_ERR,"File not found: '%s'\n",filename);return NULL; }
        len=lseek(f,0,SEEK_END); lseek(f,0,SEEK_SET);
        if (len == -1)
 	 perror("Error: lseek failed to obtain video file size");
        else
         if(verbose)
 #ifdef _LARGEFILE_SOURCE
-	 printf("File size is %lld bytes\n", (long long)len);
+	 mp_msg(MSGT_OPEN,MSGL_V,"File size is %lld bytes\n", (long long)len);
 #else
-	 printf("File size is %u bytes\n", (unsigned int)len);
+	 mp_msg(MSGT_OPEN,MSGL_V,"File size is %u bytes\n", (unsigned int)len);
 #endif
        stream=new_stream(f,STREAMTYPE_FILE);
        stream->end_pos=len;




More information about the MPlayer-cvslog mailing list