changeset 1456:8c57a5a3c645

printfs cleanup - moved to higher -v level or moved to stderr
author arpi
date Mon, 06 Aug 2001 23:59:50 +0000
parents b2f3962d0e0e
children b9b9b0d2e220
files aviheader.c aviprint.c dec_audio.c demuxer.c libao2/ao_oss.c libao2/ao_sun.c libvo/x11_common.c mplayer.c
diffstat 8 files changed, 42 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/aviheader.c	Mon Aug 06 23:59:22 2001 +0000
+++ b/aviheader.c	Mon Aug 06 23:59:50 2001 +0000
@@ -24,6 +24,7 @@
 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_index(AVIINDEXENTRY *idx,int idx_size);
@@ -67,7 +68,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) print_avih(&avih);
+      if(verbose) print_avih(&avih); else print_avih_flags(&avih);
       break;
     case ckidSTREAMHEADER: {      // read 'strh'
       AVIStreamHeader h;
--- a/aviprint.c	Mon Aug 06 23:59:22 2001 +0000
+++ b/aviprint.c	Mon Aug 06 23:59:50 2001 +0000
@@ -15,13 +15,8 @@
 //#include "codec-cfg.h"
 //#include "stheader.h"
 
-
-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);
-  printf("flags: (%ld)%s%s%s%s%s%s\n",h->dwFlags,
+void print_avih_flags(MainAVIHeader *h){
+  printf("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":"",
@@ -29,6 +24,14 @@
     (h->dwFlags&AVIF_WASCAPTUREFILE)?" WAS_CAPTUREFILE":"",
     (h->dwFlags&AVIF_COPYRIGHTED)?" COPYRIGHTED":""
   );
+}
+
+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);
--- a/dec_audio.c	Mon Aug 06 23:59:22 2001 +0000
+++ b/dec_audio.c	Mon Aug 06 23:59:50 2001 +0000
@@ -145,12 +145,12 @@
 // allocate audio out buffer:
 sh_audio->a_buffer_size=sh_audio->audio_out_minsize+MAX_OUTBURST; // worst case calc.
 
-printf("dec_audio: Allocating %d + %d = %d bytes for output buffer\n",
+if(verbose) printf("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){
-    printf("Cannot allocate audio out buffer\n");
+    fprintf(stderr,"Cannot allocate audio out buffer\n");
     return 0;
 }
 memset(sh_audio->a_buffer,0,sh_audio->a_buffer_size);
--- a/demuxer.c	Mon Aug 06 23:59:22 2001 +0000
+++ b/demuxer.c	Mon Aug 06 23:59:50 2001 +0000
@@ -64,7 +64,7 @@
     if(demuxer->a_streams[id]){
         printf("Warning! Audio stream header %d redefined!\n",id);
     } else {
-        printf("==> Found audio stream: %d\n",id);
+        if(verbose) printf("==> 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,7 +75,7 @@
     if(demuxer->v_streams[id]){
         printf("Warning! video stream header %d redefined!\n",id);
     } else {
-        printf("==> Found video stream: %d\n",id);
+        if(verbose) printf("==> 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));
     }
--- a/libao2/ao_oss.c	Mon Aug 06 23:59:22 2001 +0000
+++ b/libao2/ao_oss.c	Mon Aug 06 23:59:50 2001 +0000
@@ -102,8 +102,8 @@
 // return: 1=success 0=fail
 static int init(int rate,int channels,int format,int flags){
 
-  printf("ao2: %d Hz  %d chans  %s\n",rate,channels,
-    audio_out_format_name(format));
+//  printf("ao2: %d Hz  %d chans  %s\n",rate,channels,
+//    audio_out_format_name(format));
 
   if (ao_subdevice)
     dsp = ao_subdevice;
--- a/libao2/ao_sun.c	Mon Aug 06 23:59:22 2001 +0000
+++ b/libao2/ao_sun.c	Mon Aug 06 23:59:50 2001 +0000
@@ -238,8 +238,8 @@
 	enable_sample_timing = realtime_samplecounter_available(audio_dev);
     }
 
-    printf("ao2: %d Hz  %d chans  %s [0x%X]\n",
-	   rate,channels,audio_out_format_name(format),format);
+//    printf("ao2: %d Hz  %d chans  %s [0x%X]\n",
+//	   rate,channels,audio_out_format_name(format),format);
 
     audio_fd=open(audio_dev, O_WRONLY);
     if(audio_fd<0){
--- a/libvo/x11_common.c	Mon Aug 06 23:59:22 2001 +0000
+++ b/libvo/x11_common.c	Mon Aug 06 23:59:50 2001 +0000
@@ -21,6 +21,8 @@
 #include <X11/extensions/dpms.h>
 #endif
 
+extern verbose;
+
 static int dpms_disabled=0;
 static int timeout_save=0;
 
@@ -83,6 +85,7 @@
    bpp=mXImage->bits_per_pixel;
    if((vo_depthonscreen+7)/8 != (bpp+7)/8) vo_depthonscreen=bpp; // by A'rpi
    mask=mXImage->red_mask|mXImage->green_mask|mXImage->blue_mask;
+   if(verbose)
    printf("vo: X11 color mask:  %X  (R:%lX G:%lX B:%lX)\n",
      mask,mXImage->red_mask,mXImage->green_mask,mXImage->blue_mask);
    if(((vo_depthonscreen+7)/8)==2){
--- a/mplayer.c	Mon Aug 06 23:59:22 2001 +0000
+++ b/mplayer.c	Mon Aug 06 23:59:50 2001 +0000
@@ -677,6 +677,7 @@
        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);
 #else
@@ -979,6 +980,7 @@
          (flip==1)?"flip ":""
 //         fullscreen|(vidmode<<1)|(softzoom<<2)|(flip<<3)
      );
+    if(verbose){
     printf("VO: Description: %s\n"
            "VO: Author: %s\n",
         info->name,
@@ -986,6 +988,7 @@
      );
     if(strlen(info->comment) > 0)
         printf("VO: Comment: %s\n", info->comment);
+    }
    }
 #endif
 
@@ -1088,19 +1091,20 @@
 if(sh_audio){
   
   const ao_info_t *info=audio_out->info;
-  printf("AO: [%s] %iHz %s %s\n"
-         "AO: Description: %s\n"
-         "AO: Author: %s\n",
+  printf("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),
+      audio_out_format_name(sh_audio->sample_format)
+   );
+  if(verbose){
+   printf("AO: Description: %s\nAO: Author: %s\n",
       info->name,
       info->author	
    );
-  if(strlen(info->comment) > 0)
+   if(strlen(info->comment) > 0)
       printf("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");
@@ -1371,6 +1375,11 @@
 	  if(time_frame<-2*frame_time){
 	      drop_frame=frame_dropping; // tricky!
 	      ++drop_frame_cnt;
+	      if(drop_frame_cnt==50 && frame_dropping<1)
+	          printf("\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);
 	  }
       } else {
@@ -1434,9 +1443,10 @@
       if(verbose)printf("%5.3f|",v_pts-d_video->pts);
     } else {
       if(!delay_corrected && d_audio->pts){
+//        float x=d_audio->pts-d_video->pts-(delay);
         float x=d_audio->pts-d_video->pts-(delay+audio_delay);
         float y=-(delay+audio_delay);
-        printf("Initial PTS delay: %5.3f sec  (calculated: %5.3f)\n",x,y);
+        printf("Initial PTS delay: %5.3f sec  (calculated: %5.3f)  audio_delay=%5.3f\n",x,y,audio_delay);
 	initial_pts_delay+=x;
         audio_delay+=x;
         delay_corrected=1;
@@ -1447,7 +1457,8 @@
       // PTS = (last timestamp) + (bytes after last timestamp)/(bytes per sec)
       a_pts=d_audio->pts;
       a_pts+=(ds_tell_pts(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps;
-      v_pts=d_video->pts-frame_time;
+//      v_pts=d_video->pts-frame_time;
+      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);