Mercurial > mplayer.hg
changeset 2635:c1e24e01601b
fixed AVI header creation - now should be compatible with NaNdub
author | arpi |
---|---|
date | Fri, 02 Nov 2001 17:43:05 +0000 |
parents | 5f47e380254c |
children | 27e829d53e8e |
files | libmpdemux/aviwrite.c mencoder.c |
diffstat | 2 files changed, 21 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/aviwrite.c Fri Nov 02 17:42:19 2001 +0000 +++ b/libmpdemux/aviwrite.c Fri Nov 02 17:43:05 2001 +0000 @@ -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; } }
--- a/mencoder.c Fri Nov 02 17:42:19 2001 +0000 +++ b/mencoder.c Fri Nov 02 17:43:05 2001 +0000 @@ -415,7 +415,7 @@ mux_v->bih->biSize=sizeof(BITMAPINFOHEADER); mux_v->bih->biWidth=sh_video->disp_w; mux_v->bih->biHeight=sh_video->disp_h; - mux_v->bih->biPlanes=0; + mux_v->bih->biPlanes=1; mux_v->bih->biBitCount=24; mux_v->bih->biCompression=mmioFOURCC('d','i','v','x'); mux_v->bih->biSizeImage=mux_v->bih->biWidth*mux_v->bih->biHeight*(mux_v->bih->biBitCount/8); @@ -460,14 +460,21 @@ mux_a->h.dwSampleSize=0; // VBR mux_a->h.dwScale=4608/4; mux_a->h.dwRate=sh_audio->samplerate; - mux_a->wf=malloc(sizeof(WAVEFORMATEX)); + if(sizeof(MPEGLAYER3WAVEFORMAT)!=30) mp_msg(MSGT_MENCODER,MSGL_WARN,"sizeof(MPEGLAYER3WAVEFORMAT)==%d!=30, maybe broken C compiler?\n",sizeof(MPEGLAYER3WAVEFORMAT)); + mux_a->wf=malloc(sizeof(MPEGLAYER3WAVEFORMAT)); // should be 30 mux_a->wf->wFormatTag=0x55; // MP3 mux_a->wf->nChannels=sh_audio->channels; mux_a->wf->nSamplesPerSec=sh_audio->samplerate; - mux_a->wf->nAvgBytesPerSec=0; + mux_a->wf->nAvgBytesPerSec=192000/8; // FIXME! mux_a->wf->nBlockAlign=1; - mux_a->wf->wBitsPerSample=16; - mux_a->wf->cbSize=0; // FIXME for l3codeca.acm + mux_a->wf->wBitsPerSample=0; //16; + // from NaNdub: (requires for l3codeca.acm) + mux_a->wf->cbSize=12; + ((MPEGLAYER3WAVEFORMAT*)(mux_a->wf))->wID=1; + ((MPEGLAYER3WAVEFORMAT*)(mux_a->wf))->fdwFlags=2; + ((MPEGLAYER3WAVEFORMAT*)(mux_a->wf))->nBlockSize=1024; // ??? + ((MPEGLAYER3WAVEFORMAT*)(mux_a->wf))->nFramesPerBlock=1; + ((MPEGLAYER3WAVEFORMAT*)(mux_a->wf))->nCodecDelay=0; break; } }