[Mplayer-cvslog] CVS: main/libmpdemux aviwrite.c,1.4,1.5

Arpi of Ize arpi at mplayer.dev.hu
Fri Nov 2 18:43:07 CET 2001


Update of /cvsroot/mplayer/main/libmpdemux
In directory mplayer:/var/tmp.root/cvs-serv32042/libmpdemux

Modified Files:
	aviwrite.c 
Log Message:
fixed AVI header creation - now should be compatible with NaNdub

Index: aviwrite.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/aviwrite.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- aviwrite.c	30 Oct 2001 17:03:10 -0000	1.4
+++ aviwrite.c	2 Nov 2001 17:43:05 -0000	1.5
@@ -115,6 +115,9 @@
   fwrite(&id,4,1,f);
 }
 
+// muxer->streams[i]->wf->cbSize
+#define WFSIZE(wf) (sizeof(WAVEFORMATEX)+(((wf)->cbSize)?((wf)->cbSize-2):0))
+
 void aviwrite_write_header(aviwrite_t *muxer,FILE *f){
   unsigned int riff[3];
   int i;
@@ -128,11 +131,11 @@
   // update AVI header:
   if(muxer->def_v){
       muxer->avih.dwMicroSecPerFrame=1000000.0*muxer->def_v->h.dwScale/muxer->def_v->h.dwRate;
-      muxer->avih.dwMaxBytesPerSec=1000000; // dummy!!!!! FIXME
-      muxer->avih.dwPaddingGranularity=2; // ???
+//      muxer->avih.dwMaxBytesPerSec=1000000; // dummy!!!!! FIXME
+//      muxer->avih.dwPaddingGranularity=2; // ???
       muxer->avih.dwFlags|=AVIF_ISINTERLEAVED|AVIF_TRUSTCKTYPE;
       muxer->avih.dwTotalFrames=muxer->def_v->h.dwLength;
-      muxer->avih.dwSuggestedBufferSize=muxer->def_v->h.dwSuggestedBufferSize;
+//      muxer->avih.dwSuggestedBufferSize=muxer->def_v->h.dwSuggestedBufferSize;
       muxer->avih.dwWidth=muxer->def_v->bih->biWidth;
       muxer->avih.dwHeight=muxer->def_v->bih->biHeight;
   }
@@ -148,7 +151,7 @@
           hdrsize+=muxer->streams[i]->bih->biSize+8; // strf
 	  break;
       case AVIWRITE_TYPE_AUDIO:
-          hdrsize+=sizeof(WAVEFORMATEX)+muxer->streams[i]->wf->cbSize+8; // strf
+          hdrsize+=WFSIZE(muxer->streams[i]->wf)+8; // strf
 	  break;
       }
   }
@@ -163,7 +166,7 @@
           hdrsize+=muxer->streams[i]->bih->biSize+8; // strf
 	  break;
       case AVIWRITE_TYPE_AUDIO:
-          hdrsize+=sizeof(WAVEFORMATEX)+muxer->streams[i]->wf->cbSize+8; // strf
+          hdrsize+=WFSIZE(muxer->streams[i]->wf)+8; // strf
 	  break;
       }
       write_avi_list(f,listtypeSTREAMHEADER,hdrsize);
@@ -173,7 +176,7 @@
           write_avi_chunk(f,ckidSTREAMFORMAT,muxer->streams[i]->bih->biSize,muxer->streams[i]->bih);
 	  break;
       case AVIWRITE_TYPE_AUDIO:
-          write_avi_chunk(f,ckidSTREAMFORMAT,sizeof(WAVEFORMATEX)+muxer->streams[i]->wf->cbSize,muxer->streams[i]->wf);
+          write_avi_chunk(f,ckidSTREAMFORMAT,WFSIZE(muxer->streams[i]->wf),muxer->streams[i]->wf);
 	  break;
       }
   }




More information about the MPlayer-cvslog mailing list