[MPlayer-cvslog] CVS: main/TOOLS avi-fix.c,1.1,1.2

Oded Shimon CVS syncmail at mplayerhq.hu
Tue Aug 16 20:19:08 CEST 2005


CVS change done by Oded Shimon CVS

Update of /cvsroot/mplayer/main/TOOLS
In directory mail:/var2/tmp/cvs-serv22408/TOOLS

Modified Files:
	avi-fix.c 
Log Message:
silly printf() is the onyl reason avi-fix was so slow, a printf for
EVERY byte is pretty hefty...



Index: avi-fix.c
===================================================================
RCS file: /cvsroot/mplayer/main/TOOLS/avi-fix.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- avi-fix.c	5 Feb 2004 22:37:43 -0000	1.1
+++ avi-fix.c	16 Aug 2005 18:19:06 -0000	1.2
@@ -2,6 +2,13 @@
 // simple tool to fix chunk sizes in a RIFF AVI file
 // it doesn't check/fix index, use mencoder -forceidx -oac copy -ovc copy to fix index!
 
+#include "../config.h"
+#ifdef MP_DEBUG
+#define mp_debug(...) printf(__VA_ARGS__)
+#else
+#define mp_debug(...)
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 //#include <string.h>
@@ -59,17 +66,17 @@
 //    if(!lastgood && feof(f)) break;
     id=(id<<8)|fgetc(f);
 //    lastgood=ftell(f);
-    printf("%08X: %c%c%c%c\n",(int)ftell(f)-4,xx(id>>24),xx(id>>16),xx(id>>8),xx(id));
+    mp_debug("%08X: %c%c%c%c\n",(int)ftell(f)-4,xx(id>>24),xx(id>>16),xx(id>>8),xx(id));
     switch(id){
     case FCC('R','I','F','F'):
 	fread(&len,4,1,f); // filesize
 	id=getid(f);  // AVI
-	printf("RIFF header, filesize=0x%X  format=%c%c%c%c\n",len,xx(id>>24),xx(id>>16),xx(id>>8),xx(id));
+	mp_debug("RIFF header, filesize=0x%X  format=%c%c%c%c\n",len,xx(id>>24),xx(id>>16),xx(id>>8),xx(id));
 	break;
     case FCC('L','I','S','T'):
 	fread(&len,4,1,f); // size
 	id=getid(f);  // AVI
-	printf("LIST size=0x%X  format=%c%c%c%c\n",len,xx(id>>24),xx(id>>16),xx(id>>8),xx(id));
+	mp_debug("LIST size=0x%X  format=%c%c%c%c\n",len,xx(id>>24),xx(id>>16),xx(id>>8),xx(id));
 	//case FCC('h','d','r','l'):
 	//case FCC('s','t','r','l'):
 	//case FCC('o','d','m','l'):
@@ -106,23 +113,23 @@
 	    // fix last chunk's size field:
 	    fseek(f,fixat,SEEK_SET);
 	    len=lastgood-fixat-8;
-	    printf("Correct len to 0x%X\n",len);
+	    mp_debug("Correct len to 0x%X\n",len);
 	    fwrite(&len,4,1,f);
 	    fseek(f,lastgood,SEEK_SET);
 	    fixat=0;
 	}
 	fread(&len,4,1,f); // size
-	printf("ID ok, chunk len=0x%X\n",len);
+	mp_debug("ID ok, chunk len=0x%X\n",len);
 	len+=len&1; // align at 2
 	fseek(f,len,SEEK_CUR); // skip data
 	break;
     default:
 	if(!lastgood){
 	    ++offset;
-	    printf("invalid ID, trying %d byte offset\n",offset);
+	    mp_debug("invalid ID, trying %d byte offset\n",offset);
 	    goto faszom; // try again @ next post
 	}
-	printf("invalid ID, parsing next chunk's data at 0x%X\n",lastgood);
+	mp_debug("invalid ID, parsing next chunk's data at 0x%X\n",lastgood);
 	fseek(f,lastgood,SEEK_SET);
 	fixat=lastgood;
 	lastgood=0;




More information about the MPlayer-cvslog mailing list