#! /bin/sh -e
## 50_suppress_updates.dpatch by dean gaudet <dean@arctic.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.

if [ $# -lt 1 ]; then
    echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
    exit 1
fi

[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
patch_opts="${patch_opts:--f --no-backup-if-mismatch} ${2:+-d $2}"

case "$1" in
    -patch) patch -p1 ${patch_opts} < $0;;
    -unpatch) patch -R -p1 ${patch_opts} < $0;;
    *)
        echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
        exit 1;;
esac

exit 0

@DPATCH@
diff -urNad /home/dean/tmp/mplayer/mplayer-1.0-pre4/libmpdemux/cache2.c mplayer-1.0-pre4/libmpdemux/cache2.c
--- /home/dean/tmp/mplayer/mplayer-1.0-pre4/libmpdemux/cache2.c	2003-06-09 05:15:45.000000000 -0700
+++ mplayer-1.0-pre4/libmpdemux/cache2.c	2004-08-23 01:15:11.000000000 -0700
@@ -239,6 +239,7 @@
 int stream_enable_cache(stream_t *stream,int size,int min,int prefill){
   int ss=(stream->type==STREAMTYPE_VCD)?VCD_SECTOR_DATA:STREAM_BUFFER_SIZE;
   cache_vars_t* s;
+  int last_cache_bytes = 0;
 
   if (stream->type==STREAMTYPE_STREAM && stream->fd < 0) {
     // The stream has no 'fd' behind it, so is non-cacheable
@@ -266,10 +267,13 @@
     mp_msg(MSGT_CACHE,MSGL_V,"CACHE_PRE_INIT: %d [%d] %d  pre:%d  eof:%d  \n",
 	s->min_filepos,s->read_filepos,s->max_filepos,min,s->eof);
     while(s->read_filepos<s->min_filepos || s->max_filepos-s->read_filepos<min){
-	mp_msg(MSGT_CACHE,MSGL_STATUS,"\rCache fill: %5.2f%% (%d bytes)    ",
-	    100.0*(float)(s->max_filepos-s->read_filepos)/(float)(s->buffer_size),
-	    s->max_filepos-s->read_filepos
-	);
+	if (last_cache_bytes != s->max_filepos-s->read_filepos) {
+	  last_cache_bytes = s->max_filepos-s->read_filepos;
+	  mp_msg(MSGT_CACHE,MSGL_STATUS,"\rCache fill: %5.2f%% (%d bytes)    ",
+	      100.0*(float)last_cache_bytes/(float)(s->buffer_size),
+	      last_cache_bytes
+	  );
+	}
 	if(s->eof) break; // file is smaller than prefill size
 	if(mp_input_check_interrupt(PREFILL_SLEEP_TIME))
 	  return 0;
diff -urNad /home/dean/tmp/mplayer/mplayer-1.0-pre4/mplayer.c mplayer-1.0-pre4/mplayer.c
--- /home/dean/tmp/mplayer/mplayer-1.0-pre4/mplayer.c	2004-04-26 14:15:13.000000000 -0700
+++ mplayer-1.0-pre4/mplayer.c	2004-08-23 01:15:11.000000000 -0700
@@ -2014,35 +2014,39 @@
       // convert time to HH:MM:SS.F format
       //
       long tenths = 10 * sh_audio->delay-audio_out->get_delay();
-      int hh = (tenths / 36000) % 100;
-      int mm = (tenths / 600) % 60;
-      int ss = (tenths /  10) % 60;
-      int f1 = tenths % 10;
-      char hhmmssf[16]; // only really need 11, but just in case...
-      sprintf( hhmmssf, "%2d:%2d:%2d.%1d", hh, mm, ss, f1);
-      if (0 == hh) {
-        hhmmssf[1] = ' ';
-        hhmmssf[2] = ' ';
-      }
-      // uncomment the next three lines to show leading zero ten-hours
-      // else if (' ' == hhmmssf[0]) {
-      //   hhmmssf[0] = '0';
-      // }
-      if ((0 == hh) && (0 == mm)) {
-        hhmmssf[4] = ' ';
-        hhmmssf[5] = ' ';
-      }
-      else if ((' ' == hhmmssf[3]) && (' ' != hhmmssf[2])) {
-        hhmmssf[3] = '0';
-      }
-      if ((' ' == hhmmssf[6]) && (' ' != hhmmssf[5])) {
-        hhmmssf[6] = '0';
-      }
+      static long last_tenths;
+      if (tenths != last_tenths) {
+	int hh = (tenths / 36000) % 100;
+	int mm = (tenths / 600) % 60;
+	int ss = (tenths /  10) % 60;
+	int f1 = tenths % 10;
+	char hhmmssf[16]; // only really need 11, but just in case...
+	last_tenths = tenths;
+	sprintf( hhmmssf, "%2d:%2d:%2d.%1d", hh, mm, ss, f1);
+	if (0 == hh) {
+	  hhmmssf[1] = ' ';
+	  hhmmssf[2] = ' ';
+	}
+	// uncomment the next three lines to show leading zero ten-hours
+	// else if (' ' == hhmmssf[0]) {
+	//   hhmmssf[0] = '0';
+	// }
+	if ((0 == hh) && (0 == mm)) {
+	  hhmmssf[4] = ' ';
+	  hhmmssf[5] = ' ';
+	}
+	else if ((' ' == hhmmssf[3]) && (' ' != hhmmssf[2])) {
+	  hhmmssf[3] = '0';
+	}
+	if ((' ' == hhmmssf[6]) && (' ' != hhmmssf[5])) {
+	  hhmmssf[6] = '0';
+	}
              mp_msg(MSGT_AVSYNC,MSGL_STATUS,"A:  %s %4.1f%% %d%%   \r"
 		    ,hhmmssf
 		    ,(sh_audio->delay>0.5)?100.0*audio_time_usage/(double)sh_audio->delay:0
 		    ,cache_fill_status
 		    );
+      }
   }
   if(d_audio->eof) eof = PT_NEXT_ENTRY;
 
@@ -2324,6 +2328,8 @@
 
       if(delay_corrected){
 	static int drop_message=0;
+	static float last_a_pts;
+	static float last_v_pts;
         float x;
 	AV_delay=(a_pts-delay-audio_delay)-v_pts;
 	if(AV_delay>0.5 && drop_frame_cnt>50 && drop_message==0){
@@ -2338,7 +2344,10 @@
         else
           max_pts_correction=sh_video->frametime*0.10; // +-10% of time
 	if(!frame_time_remaining){ sh_audio->delay+=x; c_total+=x;} // correction
-        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 %d%%\r",
+        if(!quiet && (a_pts != last_a_pts || v_pts != last_v_pts)) {
+	  last_a_pts = a_pts;
+	  last_v_pts = v_pts;
+	  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 %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*playback_speed/(double)sh_video->timer):0,
@@ -2348,13 +2357,16 @@
 	  ,output_quality
 	  ,cache_fill_status
         );
+	}
         fflush(stdout);
       }
     
   } else {
     // No audio:
+    static float last_pts;
     
-    if(!quiet)
+    if(!quiet && sh_video->pts != last_pts) {
+      last_pts = sh_video->pts;
       mp_msg(MSGT_AVSYNC,MSGL_STATUS,"V:%6.1f  %3d  %2d%% %2d%% %4.1f%% %d %d %d%%\r",sh_video->pts,
         (int)sh_video->num_frames,
         (sh_video->timer>0.5)?(int)(100.0*video_time_usage/(double)sh_video->timer):0,
@@ -2364,6 +2376,7 @@
 	  ,output_quality
 	  ,cache_fill_status
         );
+    }
 
       fflush(stdout);
 
