changeset 3781:3a2bd7d449f7

better, nicer progress status for index generation
author arpi
date Thu, 27 Dec 2001 00:37:03 +0000
parents 9eb4aa623ab6
children 3e53c3991170
files libmpdemux/aviheader.c
diffstat 1 files changed, 16 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/aviheader.c	Thu Dec 27 00:34:00 2001 +0000
+++ b/libmpdemux/aviheader.c	Thu Dec 27 00:37:03 2001 +0000
@@ -223,8 +223,22 @@
 	    case 2: if(c==0x1B6) idx->dwFlags=0;break; // divx 4
 	}
       }
-    mp_msg(MSGT_HEADER,MSGL_STATUS,"Generating Index: %02d (byteposition)\r", (int)demuxer->filepos/((int)demuxer->movi_end/100+1));
-    fflush(stdout);
+
+    // update status line:
+    { static int lastpos;
+      int pos;
+      off_t len=demuxer->movi_end-demuxer->movi_start;
+      if(len){
+          pos=100*(demuxer->filepos-demuxer->movi_start)/len; // %
+      } else {
+          pos=(demuxer->filepos-demuxer->movi_start)>>20; // MB
+      }
+      if(pos!=lastpos){
+          lastpos=pos;
+	  mp_msg(MSGT_HEADER,MSGL_STATUS,"Generating Index: %3d %s     \r",
+	      pos, len?"%":"MB");
+      }
+    }
     mp_dbg(MSGT_HEADER,MSGL_DBG2,"%08X %08X %.4s %08X %X\n",(int)demuxer->filepos,id,(char *) &id,(int)c,(unsigned int) idx->dwFlags);
 #if 0
     { unsigned char tmp[64];