mirror of
https://github.com/mpv-player/mpv
synced 2025-01-18 21:31:13 +00:00
fixed AVI header creation - now should be compatible with NaNdub
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@2636 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
77abad770c
commit
c890da19bb
@ -115,6 +115,9 @@ static void write_avi_list(FILE *f,unsigned int id,int len){
|
||||
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 @@ void aviwrite_write_header(aviwrite_t *muxer,FILE *f){
|
||||
// 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 @@ void aviwrite_write_header(aviwrite_t *muxer,FILE *f){
|
||||
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 @@ void aviwrite_write_header(aviwrite_t *muxer,FILE *f){
|
||||
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 @@ void aviwrite_write_header(aviwrite_t *muxer,FILE *f){
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
17
mencoder.c
17
mencoder.c
@ -415,7 +415,7 @@ case VCODEC_DIVX4:
|
||||
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 @@ case ACODEC_VBRMP3:
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user