[MPlayer-dev-eng] [PATCH] libmpdemux/aviprint.c printf --> mp_msg

Diego Biurrun diego at biurrun.de
Mon Mar 13 19:52:18 CET 2006


On Mon, Mar 06, 2006 at 10:06:07AM +0100, Diego Biurrun wrote:
> On Sun, Mar 05, 2006 at 08:10:10PM +0100, Reimar Döffinger wrote:
> > On Sun, Mar 05, 2006 at 07:41:30PM +0100, Diego Biurrun wrote:
> > 
> > > What do you have in mind?
> > > 
> > >   void print_wave_header(WAVEFORMATEX *h){
> > > 
> > > -->
> > > 
> > >   void print_wave_header(WAVEFORMATEX *h, int verbose_level){
> > > 
> > > ?
> > 
> > Yes. At least that's the best idea to solve this at least somewhat
> > consistently.
> 
> OK, check out the attached patch.  It's just an RFC, so I haven't
> changed the calls to print_*_header outside of aviheader.c.  Let's see
> what you think of this first.
> 
> I've also followed Oded's suggestion of changing if(verbose>0) to
> if(mp_msg_test(MSGT_HEADER,MSGL_V).

And here is a fancy version that does all the fancy bells and whistles
like compile and run..

Diego
-------------- next part --------------
--- libmpdemux/aviprint.c	13 Oct 2005 18:33:56 -0000	1.20
+++ libmpdemux/aviprint.c	13 Mar 2006 18:47:41 -0000
@@ -15,8 +15,8 @@
 //#include "codec-cfg.h"
 //#include "stheader.h"
 
-void print_avih_flags(MainAVIHeader *h){
-  printf("MainAVIHeader.dwFlags: (%ld)%s%s%s%s%s%s\n",h->dwFlags,
+void print_avih_flags(MainAVIHeader *h, int verbose_level){
+  mp_msg(MSGT_HEADER, verbose_level, "MainAVIHeader.dwFlags: (%ld)%s%s%s%s%s%s\n",h->dwFlags,
     (h->dwFlags&AVIF_HASINDEX)?" HAS_INDEX":"",
     (h->dwFlags&AVIF_MUSTUSEINDEX)?" MUST_USE_INDEX":"",
     (h->dwFlags&AVIF_ISINTERLEAVED)?" IS_INTERLEAVED":"",
@@ -26,111 +26,111 @@
   );
 }
 
-void print_avih(MainAVIHeader *h){
-  printf("======= AVI Header =======\n");
-  printf("us/frame: %ld  (fps=%5.3f)\n",h->dwMicroSecPerFrame,1000000.0f/(float)h->dwMicroSecPerFrame);
-  printf("max bytes/sec: %ld\n",h->dwMaxBytesPerSec);
-  printf("padding: %ld\n",h->dwPaddingGranularity);
-  print_avih_flags(h);
-  printf("frames  total: %ld   initial: %ld\n",h->dwTotalFrames,h->dwInitialFrames);
-  printf("streams: %ld\n",h->dwStreams);
-  printf("Suggested BufferSize: %ld\n",h->dwSuggestedBufferSize);
-  printf("Size:  %ld x %ld\n",h->dwWidth,h->dwHeight);
-  printf("==========================\n");
-}
-
-void print_strh(AVIStreamHeader *h){
-  printf("====== STREAM Header =====\n");
-  printf("Type: %.4s   FCC: %.4s (%X)\n",(char *)&h->fccType,(char *)&h->fccHandler,(unsigned int)h->fccHandler);
-  printf("Flags: %ld\n",h->dwFlags);
-  printf("Priority: %d   Language: %d\n",h->wPriority,h->wLanguage);
-  printf("InitialFrames: %ld\n",h->dwInitialFrames);
-  printf("Rate: %ld/%ld = %5.3f\n",h->dwRate,h->dwScale,(float)h->dwRate/(float)h->dwScale);
-  printf("Start: %ld   Len: %ld\n",h->dwStart,h->dwLength);
-  printf("Suggested BufferSize: %ld\n",h->dwSuggestedBufferSize);
-  printf("Quality %ld\n",h->dwQuality);
-  printf("Sample size: %ld\n",h->dwSampleSize);
-  printf("==========================\n");
-}
-
-void print_wave_header(WAVEFORMATEX *h){
-  printf("======= WAVE Format =======\n");
-  printf("Format Tag: %d (0x%X)\n",h->wFormatTag,h->wFormatTag);
-  printf("Channels: %d\n",h->nChannels);
-  printf("Samplerate: %ld\n",h->nSamplesPerSec);
-  printf("avg byte/sec: %ld\n",h->nAvgBytesPerSec);
-  printf("Block align: %d\n",h->nBlockAlign);
-  printf("bits/sample: %d\n",h->wBitsPerSample);
-  printf("cbSize: %d\n",h->cbSize);
+void print_avih(MainAVIHeader *h, int verbose_level){
+  mp_msg(MSGT_HEADER, verbose_level, "======= AVI Header =======\n");
+  mp_msg(MSGT_HEADER, verbose_level, "us/frame: %ld  (fps=%5.3f)\n",h->dwMicroSecPerFrame,1000000.0f/(float)h->dwMicroSecPerFrame);
+  mp_msg(MSGT_HEADER, verbose_level, "max bytes/sec: %ld\n",h->dwMaxBytesPerSec);
+  mp_msg(MSGT_HEADER, verbose_level, "padding: %ld\n",h->dwPaddingGranularity);
+  print_avih_flags(h, verbose_level);
+  mp_msg(MSGT_HEADER, verbose_level, "frames  total: %ld   initial: %ld\n",h->dwTotalFrames,h->dwInitialFrames);
+  mp_msg(MSGT_HEADER, verbose_level, "streams: %ld\n",h->dwStreams);
+  mp_msg(MSGT_HEADER, verbose_level, "Suggested BufferSize: %ld\n",h->dwSuggestedBufferSize);
+  mp_msg(MSGT_HEADER, verbose_level, "Size:  %ld x %ld\n",h->dwWidth,h->dwHeight);
+  mp_msg(MSGT_HEADER, verbose_level, "==========================\n");
+}
+
+void print_strh(AVIStreamHeader *h, int verbose_level){
+  mp_msg(MSGT_HEADER, verbose_level, "====== STREAM Header =====\n");
+  mp_msg(MSGT_HEADER, verbose_level, "Type: %.4s   FCC: %.4s (%X)\n",(char *)&h->fccType,(char *)&h->fccHandler,(unsigned int)h->fccHandler);
+  mp_msg(MSGT_HEADER, verbose_level, "Flags: %ld\n",h->dwFlags);
+  mp_msg(MSGT_HEADER, verbose_level, "Priority: %d   Language: %d\n",h->wPriority,h->wLanguage);
+  mp_msg(MSGT_HEADER, verbose_level, "InitialFrames: %ld\n",h->dwInitialFrames);
+  mp_msg(MSGT_HEADER, verbose_level, "Rate: %ld/%ld = %5.3f\n",h->dwRate,h->dwScale,(float)h->dwRate/(float)h->dwScale);
+  mp_msg(MSGT_HEADER, verbose_level, "Start: %ld   Len: %ld\n",h->dwStart,h->dwLength);
+  mp_msg(MSGT_HEADER, verbose_level, "Suggested BufferSize: %ld\n",h->dwSuggestedBufferSize);
+  mp_msg(MSGT_HEADER, verbose_level, "Quality %ld\n",h->dwQuality);
+  mp_msg(MSGT_HEADER, verbose_level, "Sample size: %ld\n",h->dwSampleSize);
+  mp_msg(MSGT_HEADER, verbose_level, "==========================\n");
+}
+
+void print_wave_header(WAVEFORMATEX *h, int verbose_level){
+  mp_msg(MSGT_HEADER, verbose_level, "======= WAVE Format =======\n");
+  mp_msg(MSGT_HEADER, verbose_level, "Format Tag: %d (0x%X)\n",h->wFormatTag,h->wFormatTag);
+  mp_msg(MSGT_HEADER, verbose_level, "Channels: %d\n",h->nChannels);
+  mp_msg(MSGT_HEADER, verbose_level, "Samplerate: %ld\n",h->nSamplesPerSec);
+  mp_msg(MSGT_HEADER, verbose_level, "avg byte/sec: %ld\n",h->nAvgBytesPerSec);
+  mp_msg(MSGT_HEADER, verbose_level, "Block align: %d\n",h->nBlockAlign);
+  mp_msg(MSGT_HEADER, verbose_level, "bits/sample: %d\n",h->wBitsPerSample);
+  mp_msg(MSGT_HEADER, verbose_level, "cbSize: %d\n",h->cbSize);
   if(h->wFormatTag==0x55 && h->cbSize>=12){
       MPEGLAYER3WAVEFORMAT* h2=(MPEGLAYER3WAVEFORMAT *)h;
-      printf("mp3.wID=%d\n",h2->wID);
-      printf("mp3.fdwFlags=0x%lX\n",h2->fdwFlags);
-      printf("mp3.nBlockSize=%d\n",h2->nBlockSize);
-      printf("mp3.nFramesPerBlock=%d\n",h2->nFramesPerBlock);
-      printf("mp3.nCodecDelay=%d\n",h2->nCodecDelay);
+      mp_msg(MSGT_HEADER, verbose_level, "mp3.wID=%d\n",h2->wID);
+      mp_msg(MSGT_HEADER, verbose_level, "mp3.fdwFlags=0x%lX\n",h2->fdwFlags);
+      mp_msg(MSGT_HEADER, verbose_level, "mp3.nBlockSize=%d\n",h2->nBlockSize);
+      mp_msg(MSGT_HEADER, verbose_level, "mp3.nFramesPerBlock=%d\n",h2->nFramesPerBlock);
+      mp_msg(MSGT_HEADER, verbose_level, "mp3.nCodecDelay=%d\n",h2->nCodecDelay);
   }
   else if (h->cbSize > 0)
   {
     int i;
     uint8_t* p = ((uint8_t*)h) + sizeof(WAVEFORMATEX);
-    printf("Unknown extra header dump: ");
+    mp_msg(MSGT_HEADER, verbose_level, "Unknown extra header dump: ");
     for (i = 0; i < h->cbSize; i++)
-	printf("[%x] ", p[i]);
-    printf("\n");
+	mp_msg(MSGT_HEADER, verbose_level, "[%x] ", p[i]);
+    mp_msg(MSGT_HEADER, verbose_level, "\n");
   }
-  printf("===========================\n");
+  mp_msg(MSGT_HEADER, verbose_level, "==========================================================================\n");
 }
 
 
-void print_video_header(BITMAPINFOHEADER *h){
-  printf("======= VIDEO Format ======\n");
-	printf("  biSize %d\n", h->biSize);
-	printf("  biWidth %d\n", h->biWidth);
-	printf("  biHeight %d\n", h->biHeight);
-	printf("  biPlanes %d\n", h->biPlanes);
-	printf("  biBitCount %d\n", h->biBitCount);
-	printf("  biCompression %d='%.4s'\n", h->biCompression, (char *)&h->biCompression);
-	printf("  biSizeImage %d\n", h->biSizeImage);
+void print_video_header(BITMAPINFOHEADER *h, int verbose_level){
+  mp_msg(MSGT_HEADER, verbose_level, "======= VIDEO Format ======\n");
+	mp_msg(MSGT_HEADER, verbose_level, "  biSize %d\n", h->biSize);
+	mp_msg(MSGT_HEADER, verbose_level, "  biWidth %d\n", h->biWidth);
+	mp_msg(MSGT_HEADER, verbose_level, "  biHeight %d\n", h->biHeight);
+	mp_msg(MSGT_HEADER, verbose_level, "  biPlanes %d\n", h->biPlanes);
+	mp_msg(MSGT_HEADER, verbose_level, "  biBitCount %d\n", h->biBitCount);
+	mp_msg(MSGT_HEADER, verbose_level, "  biCompression %d='%.4s'\n", h->biCompression, (char *)&h->biCompression);
+	mp_msg(MSGT_HEADER, verbose_level, "  biSizeImage %d\n", h->biSizeImage);
   if (h->biSize > sizeof(BITMAPINFOHEADER))
   {
     int i;
     uint8_t* p = ((uint8_t*)h) + sizeof(BITMAPINFOHEADER);
-    printf("Unknown extra header dump: ");
+    mp_msg(MSGT_HEADER, verbose_level, "Unknown extra header dump: ");
     for (i = 0; i < h->biSize-sizeof(BITMAPINFOHEADER); i++)
-	printf("[%x] ", *(p+i));
-    printf("\n");
+	mp_msg(MSGT_HEADER, verbose_level, "[%x] ", *(p+i));
+    mp_msg(MSGT_HEADER, verbose_level, "\n");
   }
-  printf("===========================\n");
+  mp_msg(MSGT_HEADER, verbose_level, "===========================\n");
 }
 
-void print_vprp(VideoPropHeader *vprp){
+void print_vprp(VideoPropHeader *vprp, int verbose_level){
   int i;
-  printf("======= Video Properties Header =======\n");
-  printf("Format: %d  VideoStandard: %d\n",
+  mp_msg(MSGT_HEADER, verbose_level, "======= Video Properties Header =======\n");
+  mp_msg(MSGT_HEADER, verbose_level, "Format: %d  VideoStandard: %d\n",
          vprp->VideoFormatToken,vprp->VideoStandard);
-  printf("VRefresh: %d  HTotal: %d  VTotal: %d\n",
+  mp_msg(MSGT_HEADER, verbose_level, "VRefresh: %d  HTotal: %d  VTotal: %d\n",
          vprp->dwVerticalRefreshRate, vprp->dwHTotalInT, vprp->dwVTotalInLines);
-  printf("FrameAspect: %d:%d  Framewidth: %d  Frameheight: %d\n",
+  mp_msg(MSGT_HEADER, verbose_level, "FrameAspect: %d:%d  Framewidth: %d  Frameheight: %d\n",
          vprp->dwFrameAspectRatio >> 16, vprp->dwFrameAspectRatio & 0xffff,
          vprp->dwFrameWidthInPixels, vprp->dwFrameHeightInLines);
-  printf("Fields: %d\n", vprp->nbFieldPerFrame);
+  mp_msg(MSGT_HEADER, verbose_level, "Fields: %d\n", vprp->nbFieldPerFrame);
   for (i=0; i<vprp->nbFieldPerFrame; i++) {
     VIDEO_FIELD_DESC *vfd = &vprp->FieldInfo[i];
-    printf("  == Field %d description ==\n", i);
-    printf("  CompressedBMHeight: %d  CompressedBMWidth: %d\n",
+    mp_msg(MSGT_HEADER, verbose_level, "  == Field %d description ==\n", i);
+    mp_msg(MSGT_HEADER, verbose_level, "  CompressedBMHeight: %d  CompressedBMWidth: %d\n",
            vfd->CompressedBMHeight, vfd->CompressedBMWidth);
-    printf("  ValidBMHeight: %d  ValidBMWidth: %d\n",
+    mp_msg(MSGT_HEADER, verbose_level, "  ValidBMHeight: %d  ValidBMWidth: %d\n",
            vfd->ValidBMHeight, vfd->ValidBMWidth);
-    printf("  ValidBMXOffset: %d  ValidBMYOffset: %d\n",
+    mp_msg(MSGT_HEADER, verbose_level, "  ValidBMXOffset: %d  ValidBMYOffset: %d\n",
            vfd->ValidBMXOffset, vfd->ValidBMYOffset);
-    printf("  VideoXOffsetInT: %d  VideoYValidStartLine: %d\n",
+    mp_msg(MSGT_HEADER, verbose_level, "  VideoXOffsetInT: %d  VideoYValidStartLine: %d\n",
            vfd->VideoXOffsetInT, vfd->VideoYValidStartLine);
   }
-  printf("=======================================\n");
+  mp_msg(MSGT_HEADER, verbose_level, "=======================================\n");
 }
 
-void print_index(AVIINDEXENTRY *idx,int idx_size){
+void print_index(AVIINDEXENTRY *idx, int idx_size, int verbose_level){
   int i;
   unsigned int pos[256];
   unsigned int num[256];
@@ -138,7 +138,7 @@
   for(i=0;i<idx_size;i++){
     int id=avi_stream_id(idx[i].ckid);
     if(id<0 || id>255) id=255;
-    printf("%5d:  %.4s  %4X  %016llX  len:%6ld  pos:%7d->%7.3f %7d->%7.3f\n",i,
+    mp_msg(MSGT_HEADER, MSGL_DBG2, "%5d:  %.4s  %4X  %016llX  len:%6ld  pos:%7d->%7.3f %7d->%7.3f\n",i,
       (char *)&idx[i].ckid,
       (unsigned int)idx[i].dwFlags&0xffff,
       (uint64_t)AVI_IDX_OFFSET(&idx[i]),
@@ -152,21 +152,21 @@
   }
 }
 
-void print_avistdindex_chunk(avistdindex_chunk *h){
-    mp_msg (MSGT_HEADER, MSGL_V, "====== AVI Standard Index Header ========\n");
-    mp_msg (MSGT_HEADER, MSGL_V, "  FCC (%.4s) dwSize (%d) wLongsPerEntry(%d)\n", h->fcc, h->dwSize, h->wLongsPerEntry);
-    mp_msg (MSGT_HEADER, MSGL_V, "  bIndexSubType (%d) bIndexType (%d)\n", h->bIndexSubType, h->bIndexType);
-    mp_msg (MSGT_HEADER, MSGL_V, "  nEntriesInUse (%d) dwChunkId (%.4s)\n", h->nEntriesInUse, h->dwChunkId);
-    mp_msg (MSGT_HEADER, MSGL_V, "  qwBaseOffset (0x%"PRIX64") dwReserved3 (%d)\n", h->qwBaseOffset, h->dwReserved3);
-    mp_msg (MSGT_HEADER, MSGL_V, "===========================\n");
-}
-void print_avisuperindex_chunk(avisuperindex_chunk *h){
-    mp_msg (MSGT_HEADER, MSGL_V, "====== AVI Super Index Header ========\n");
-    mp_msg (MSGT_HEADER, MSGL_V, "  FCC (%.4s) dwSize (%d) wLongsPerEntry(%d)\n", h->fcc, h->dwSize, h->wLongsPerEntry);
-    mp_msg (MSGT_HEADER, MSGL_V, "  bIndexSubType (%d) bIndexType (%d)\n", h->bIndexSubType, h->bIndexType);
-    mp_msg (MSGT_HEADER, MSGL_V, "  nEntriesInUse (%d) dwChunkId (%.4s)\n", h->nEntriesInUse, h->dwChunkId);
-    mp_msg (MSGT_HEADER, MSGL_V, "  dwReserved[0] (%d) dwReserved[1] (%d) dwReserved[2] (%d)\n", 
+void print_avistdindex_chunk(avistdindex_chunk *h, int verbose_level){
+    mp_msg (MSGT_HEADER, verbose_level, "====== AVI Standard Index Header ========\n");
+    mp_msg (MSGT_HEADER, verbose_level, "  FCC (%.4s) dwSize (%d) wLongsPerEntry(%d)\n", h->fcc, h->dwSize, h->wLongsPerEntry);
+    mp_msg (MSGT_HEADER, verbose_level, "  bIndexSubType (%d) bIndexType (%d)\n", h->bIndexSubType, h->bIndexType);
+    mp_msg (MSGT_HEADER, verbose_level, "  nEntriesInUse (%d) dwChunkId (%.4s)\n", h->nEntriesInUse, h->dwChunkId);
+    mp_msg (MSGT_HEADER, verbose_level, "  qwBaseOffset (0x%"PRIX64") dwReserved3 (%d)\n", h->qwBaseOffset, h->dwReserved3);
+    mp_msg (MSGT_HEADER, verbose_level, "===========================\n");
+}
+void print_avisuperindex_chunk(avisuperindex_chunk *h, int verbose_level){
+    mp_msg (MSGT_HEADER, verbose_level, "====== AVI Super Index Header ========\n");
+    mp_msg (MSGT_HEADER, verbose_level, "  FCC (%.4s) dwSize (%d) wLongsPerEntry(%d)\n", h->fcc, h->dwSize, h->wLongsPerEntry);
+    mp_msg (MSGT_HEADER, verbose_level, "  bIndexSubType (%d) bIndexType (%d)\n", h->bIndexSubType, h->bIndexType);
+    mp_msg (MSGT_HEADER, verbose_level, "  nEntriesInUse (%d) dwChunkId (%.4s)\n", h->nEntriesInUse, h->dwChunkId);
+    mp_msg (MSGT_HEADER, verbose_level, "  dwReserved[0] (%d) dwReserved[1] (%d) dwReserved[2] (%d)\n", 
 	    h->dwReserved[0], h->dwReserved[1], h->dwReserved[2]);
-    mp_msg (MSGT_HEADER, MSGL_V, "===========================\n");
+    mp_msg (MSGT_HEADER, verbose_level, "===========================\n");
 }
 
--- libmpdemux/aviheader.c	9 Feb 2006 00:40:35 -0000	1.70
+++ libmpdemux/aviheader.c	13 Mar 2006 18:47:41 -0000
@@ -20,15 +20,15 @@
 
 static MainAVIHeader avih;
 
-extern void print_avih(MainAVIHeader *h);
-extern void print_avih_flags(MainAVIHeader *h);
-extern void print_strh(AVIStreamHeader *h);
-extern void print_wave_header(WAVEFORMATEX *h);
-extern void print_video_header(BITMAPINFOHEADER *h);
-extern void print_index(AVIINDEXENTRY *idx,int idx_size);
-extern void print_avistdindex_chunk(avistdindex_chunk *h);
-extern void print_avisuperindex_chunk(avisuperindex_chunk *h);
-extern void print_vprp(VideoPropHeader *vprp);
+extern void print_avih(MainAVIHeader *h, int verbose_level);
+extern void print_avih_flags(MainAVIHeader *h, int verbose_level);
+extern void print_strh(AVIStreamHeader *h, int verbose_level);
+extern void print_wave_header(WAVEFORMATEX *h, int verbose_level);
+extern void print_video_header(BITMAPINFOHEADER *h, int verbose_level);
+extern void print_index(AVIINDEXENTRY *idx,int idx_size, int verbose_level);
+extern void print_avistdindex_chunk(avistdindex_chunk *h, int verbose_level);
+extern void print_avisuperindex_chunk(avisuperindex_chunk *h, int verbose_level);
+extern void print_vprp(VideoPropHeader *vprp, int verbose_level);
 
 static int odml_get_vstream_id(int id, unsigned char res[])
 {
@@ -185,7 +185,7 @@
       stream_read(demuxer->stream,(char*) &avih,MIN(size2,sizeof(avih)));
       le2me_MainAVIHeader(&avih); // swap to machine endian
       chunksize-=MIN(size2,sizeof(avih));
-      if(verbose>0) print_avih(&avih); // else print_avih_flags(&avih);
+      if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_avih(&avih,MSGL_V); // else print_avih_flags(&avih,MSGL_V);
       break;
     case ckidSTREAMHEADER: {      // read 'strh'
       AVIStreamHeader h;
@@ -202,7 +202,7 @@
         memcpy(&sh_audio->audio,&h,sizeof(h));
       }
       last_fccType=h.fccType;
-      if(verbose>=1) print_strh(&h);
+      if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_strh(&h,MSGL_V);
       break; }
     case mmioFOURCC('i', 'n', 'd', 'x'): {
       uint32_t i;
@@ -223,7 +223,7 @@
       stream_read(demuxer->stream, (char *)s->dwReserved, 3*4);
       memset(s->dwReserved, 0, 3*4);
 	  
-      print_avisuperindex_chunk(s);
+      print_avisuperindex_chunk(s,MSGL_V);
 
       msize = sizeof (uint32_t) * s->wLongsPerEntry * s->nEntriesInUse;
       s->aIndex = malloc(msize);
@@ -254,7 +254,7 @@
 	// fixup MS-RLE header (seems to be broken for <256 color files)
 	if(sh_video->bih->biCompression<=1 && sh_video->bih->biSize==40)
 	    sh_video->bih->biSize=chunksize;
-        if(verbose>=1) print_video_header(sh_video->bih);
+        if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_video_header(sh_video->bih,MSGL_V);
         chunksize=0;
 //        sh_video->fps=(float)sh_video->video.dwRate/(float)sh_video->video.dwScale;
 //        sh_video->frametime=(float)sh_video->video.dwScale/(float)sh_video->video.dwRate;
@@ -309,7 +309,7 @@
 	    sh_audio->wf=realloc(sh_audio->wf, sizeof(WAVEFORMATEX)+sh_audio->wf->cbSize);
 	}
         chunksize=0;
-        if(verbose>=1) print_wave_header(sh_audio->wf);
+        if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_wave_header(sh_audio->wf,MSGL_V);
 	++priv->audio_streams;
 //        if(demuxer->audio->id==-1) demuxer->audio->id=stream_id;
       }
@@ -332,7 +332,7 @@
 	if (sh_video) {
 		sh_video->aspect = GET_AVI_ASPECT(vprp->dwFrameAspectRatio);
 	}
-	if(verbose>=1) print_vprp(vprp);
+	if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_vprp(vprp,MSGL_V);
 	free(vprp);
 	break;
     }
@@ -368,7 +368,7 @@
 	entry->dwFlags&=0xffff;
       }
       chunksize-=priv->idx_size<<4;
-      if(verbose>=2) print_index(priv->idx,priv->idx_size);
+      if( mp_msg_test(MSGT_HEADER,MSGL_DBG2) ) print_index(priv->idx,priv->idx_size,MSGL_DBG2);
     }
     break;
     /* added May 2002 */
@@ -465,7 +465,7 @@
 	    }
 
 	    le2me_AVISTDIDXCHUNK(&cx->stdidx[j]);
-	    print_avistdindex_chunk(&cx->stdidx[j]);
+	    print_avistdindex_chunk(&cx->stdidx[j],MSGL_V);
 	    priv->idx_size += cx->stdidx[j].nEntriesInUse;
 	    cx->stdidx[j].aIndex = malloc(cx->stdidx[j].nEntriesInUse*sizeof(avistdindex_entry));
 	    stream_read(demuxer->stream, (char *)cx->stdidx[j].aIndex, 
@@ -539,7 +539,7 @@
 	}
     }
 
-    if (verbose>=2) print_index(priv->idx, priv->idx_size);
+    if ( mp_msg_test(MSGT_HEADER,MSGL_DBG2) ) print_index(priv->idx, priv->idx_size,MSGL_DBG2);
 
     demuxer->movi_end=demuxer->stream->end_pos;
 
@@ -677,7 +677,7 @@
   }
   priv->idx_size=priv->idx_pos;
   mp_msg(MSGT_HEADER,MSGL_INFO,MSGTR_MPDEMUX_AVIHDR_IdxGeneratedForHowManyChunks,priv->idx_size);
-  if(verbose>=2) print_index(priv->idx,priv->idx_size);
+  if( mp_msg_test(MSGT_HEADER,MSGL_DBG2) ) print_index(priv->idx,priv->idx_size,MSGL_DBG2);
 
   /* Write generated index to a file */
   if (index_file_save) {
--- libmpdemux/demux_lavf.c	17 Feb 2006 01:57:40 -0000	1.28
+++ libmpdemux/demux_lavf.c	13 Mar 2006 18:47:41 -0000
@@ -46,8 +46,8 @@
     int64_t last_pts;
 }lavf_priv_t;
 
-extern void print_wave_header(WAVEFORMATEX *h);
-extern void print_video_header(BITMAPINFOHEADER *h);
+extern void print_wave_header(WAVEFORMATEX *h, int verbose_level);
+extern void print_video_header(BITMAPINFOHEADER *h, int verbose_level);
 
 int64_t ff_gcd(int64_t a, int64_t b);
 
@@ -237,7 +237,7 @@
                 sh_audio->format = 0x7;
                 break;
             }
-            if(verbose>=1) print_wave_header(sh_audio->wf);
+            if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_wave_header(sh_audio->wf, MSGL_V);
             if(demuxer->audio->id != i && demuxer->audio->id != -1)
                 st->discard= AVDISCARD_ALL;
             else{
@@ -286,7 +286,7 @@
             sh_video->ds= demuxer->video;
             if(codec->extradata_size)
                 memcpy(sh_video->bih + 1, codec->extradata, codec->extradata_size);
-            if(verbose>=1) print_video_header(sh_video->bih);
+            if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_video_header(sh_video->bih, MSGL_V);
 /*    short 	biPlanes;
     int  	biXPelsPerMeter;
     int  	biYPelsPerMeter;
--- libmpdemux/demux_ogg.c	8 Mar 2006 22:23:21 -0000	1.89
+++ libmpdemux/demux_ogg.c	13 Mar 2006 18:47:41 -0000
@@ -705,8 +705,8 @@
   
 }
 
-extern void print_wave_header(WAVEFORMATEX *h);
-extern void print_video_header(BITMAPINFOHEADER *h);
+extern void print_wave_header(WAVEFORMATEX *h, int verbose_level);
+extern void print_video_header(BITMAPINFOHEADER *h, int verbose_level);
 
 /** \brief Return the number of subtitle tracks in the file.
 
@@ -993,7 +993,7 @@
 		   (int)inf.version_minor, 
 		   (int)inf.version_subminor, 
 		   n_video - 1);
-	    if(verbose>0) print_video_header(sh_v->bih);
+	    if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_video_header(sh_v->bih,MSGL_V);
 	}
 #   endif /* HAVE_OGGTHEORA */
 #   ifdef HAVE_FLAC
@@ -1036,7 +1036,7 @@
 	n_video++;
 	mp_msg(MSGT_DEMUX,MSGL_INFO,"[Ogg] stream %d: video (FOURCC %c%c%c%c), -vid %d\n",
 	       ogg_d->num_sub,pack.packet[68],pack.packet[69],pack.packet[70],pack.packet[71],n_video-1);
-	if(verbose>0) print_video_header(sh_v->bih);
+	if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_video_header(sh_v->bih,MSGL_V);
 	// Old audio header
       } else if(get_uint32(pack.packet+96) == 0x05589F81) {
 	unsigned int extra_size;
@@ -1060,7 +1060,7 @@
 	ogg_d->subs[ogg_d->num_sub].id = n_audio;
 	n_audio++;
 	mp_msg(MSGT_DEMUX,MSGL_INFO,"[Ogg] stream %d: audio (format 0x%04x), -aid %d\n",ogg_d->num_sub,sh_a->format,n_audio-1);
-	if(verbose>0) print_wave_header(sh_a->wf);
+	if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_wave_header(sh_a->wf,MSGL_V);
       } else
 	mp_msg(MSGT_DEMUX,MSGL_WARN,"Ogg stream %d contains an old header but the header type is unknown\n",ogg_d->num_sub);
 
@@ -1092,7 +1092,7 @@
 	n_video++;
 	mp_msg(MSGT_DEMUX,MSGL_INFO,"[Ogg] stream %d: video (FOURCC %c%c%c%c), -vid %d\n",
 	       ogg_d->num_sub,st->subtype[0],st->subtype[1],st->subtype[2],st->subtype[3],n_video-1);
-	if(verbose>0) print_video_header(sh_v->bih);
+	if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_video_header(sh_v->bih,MSGL_V);
 	/// New audio header
       } else if(strncmp(st->streamtype,"audio",5) == 0) {
 	char buffer[5];
@@ -1131,7 +1131,7 @@
 	ogg_d->subs[ogg_d->num_sub].id = n_audio;
 	n_audio++;
 	mp_msg(MSGT_DEMUX,MSGL_INFO,"[Ogg] stream %d: audio (format 0x%04x), -aid %d\n",ogg_d->num_sub,sh_a->format,n_audio-1);
-	if(verbose>0) print_wave_header(sh_a->wf);
+	if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_wave_header(sh_a->wf,MSGL_V);
 
 	/// Check for text (subtitles) header
       } else if (strncmp(st->streamtype, "text", 4) == 0) {
@@ -1162,7 +1162,7 @@
 	// If the audio stream is not defined we took the first one
 	if(demuxer->audio->id == -1) {
 	  demuxer->audio->id = n_audio - 1;
-//	  if(sh_a->wf) print_wave_header(sh_a->wf);
+//	  if(sh_a->wf) print_wave_header(sh_a->wf,MSGL_INFO);
 	}
 	/// Is it the stream we want
 	if(demuxer->audio->id == (n_audio - 1)) {
@@ -1176,7 +1176,7 @@
 	/// Also for video
 	if(demuxer->video->id == -1) {
 	  demuxer->video->id = n_video - 1;
-//	  if(sh_v->bih) print_video_header(sh_v->bih);
+//	  if(sh_v->bih) print_video_header(sh_v->bih,MSGL_INFO);
 	}
 	if(demuxer->video->id == (n_video - 1)) {
 	  demuxer->video->sh = sh_v;
--- libmpdemux/asfheader.c	31 Oct 2005 23:37:41 -0000	1.45
+++ libmpdemux/asfheader.c	13 Mar 2006 18:47:41 -0000
@@ -5,8 +5,6 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-extern int verbose; // defined in mplayer.c
-
 #include "config.h"
 #include "mp_msg.h"
 #include "help_mp.h"
@@ -139,8 +137,8 @@
   return DEMUXER_TYPE_ASF;
 }
 
-extern void print_wave_header(WAVEFORMATEX *h);
-extern void print_video_header(BITMAPINFOHEADER *h);
+//extern void print_wave_header(WAVEFORMATEX *h);
+//extern void print_video_header(BITMAPINFOHEADER *h);
 
 int find_asf_guid(char *buf, const char *guid, int cur_pos, int buf_len)
 {
@@ -212,7 +210,7 @@
         sh_audio->wf=calloc((streamh->type_size<sizeof(WAVEFORMATEX))?sizeof(WAVEFORMATEX):streamh->type_size,1);
         memcpy(sh_audio->wf,buffer,streamh->type_size);
 	le2me_WAVEFORMATEX(sh_audio->wf);
-        if(verbose>=1) print_wave_header(sh_audio->wf);
+        if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_wave_header(sh_audio->wf,MSGL_V);
 	if(ASF_LOAD_GUID_PREFIX(streamh->concealment)==ASF_GUID_PREFIX_audio_conceal_interleave){
           buffer = &hdr[pos];
           pos += streamh->stream_size;
--- libmpcodecs/vd_vfw.c	12 Jan 2006 20:04:34 -0000	1.27
+++ libmpcodecs/vd_vfw.c	13 Mar 2006 18:47:41 -0000
@@ -138,7 +138,7 @@
     return CONTROL_UNKNOWN;
 }
 
-extern void print_video_header(BITMAPINFOHEADER *h);
+extern void print_video_header(BITMAPINFOHEADER *h, int verbose_level);
 
 // init driver
 static int init(sh_video_t *sh){
@@ -241,9 +241,9 @@
 	set_csp(priv->o_bih,sh->codec->outfmt[sh->outfmtidx]);
 
     mp_msg(MSGT_WIN32, MSGL_V, "Input format:\n");
-    if(verbose>0) print_video_header(sh->bih);
+    if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_video_header(sh->bih,MSGL_V);
     mp_msg(MSGT_WIN32, MSGL_V, "Output format:\n");
-    if(verbose>0) print_video_header(priv->o_bih);
+    if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_video_header(priv->o_bih,MSGL_V);
 
     // set postprocessing level in xvid/divx4 .dll
     ICSendMessage(priv->handle, ICM_USER+80, (long)(&divx_quality), 0);
--- TOOLS/asfinfo.c	11 Jun 2001 12:47:48 -0000	1.2
+++ TOOLS/asfinfo.c	13 Mar 2006 18:47:40 -0000
@@ -105,7 +105,7 @@
   return NULL;
 }
 
-void print_wave_header(WAVEFORMATEX *h){
+void print_wave_header(WAVEFORMATEX *h,MSGL_INFO){
 
   printf("======= WAVE Format =======\n");
   
@@ -135,7 +135,7 @@
 
 }
 
-void print_video_header(BITMAPINFOHEADER *h){
+void print_video_header(BITMAPINFOHEADER *h,MSGL_INFO){
   printf("======= VIDEO Format ======\n");
 	printf("  biSize %d\n", h->biSize);
 	printf("  biWidth %d\n", h->biWidth);
@@ -176,10 +176,10 @@
       fread(buffer,streamh.type_size,1,f);
       switch(*((unsigned int*)&streamh.type)){
       case 0xF8699E40:  // guid_audio_stream
-        print_wave_header((WAVEFORMATEX*)buffer);
+        print_wave_header((WAVEFORMATEX*)buffer,MSGL_INFO);
         break;
       case 0xBC19EFC0:  // guid_video_stream
-        print_video_header((BITMAPINFOHEADER*)&buffer[4+4+1+2]);
+        print_video_header((BITMAPINFOHEADER*)&buffer[4+4+1+2],MSGL_INFO);
         break;
       }
       // stream-specific data:


More information about the MPlayer-dev-eng mailing list