1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-26 00:42:57 +00:00

malloc->calloc at wf/bih allocation

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@434 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
arpi_esp 2001-04-15 14:45:15 +00:00
parent 415c45924b
commit 544e51e95c

View File

@ -56,8 +56,9 @@ while(1){
break; }
case ckidSTREAMFORMAT: { // read 'strf'
if(last_fccType==streamtypeVIDEO){
sh_video->bih=malloc(chunksize); memset(sh_video->bih,0,chunksize);
if(verbose>=2) printf("found 'bih', %d bytes of %d\n",chunksize,sizeof(BITMAPINFOHEADER));
sh_video->bih=calloc((chunksize<sizeof(BITMAPINFOHEADER))?sizeof(BITMAPINFOHEADER):chunksize,1);
// sh_video->bih=malloc(chunksize); memset(sh_video->bih,0,chunksize);
if(verbose>=1) printf("found 'bih', %d bytes of %d\n",chunksize,sizeof(BITMAPINFOHEADER));
stream_read(demuxer->stream,(char*) sh_video->bih,chunksize);
chunksize=0;
// sh_video->fps=(float)sh_video->video.dwRate/(float)sh_video->video.dwScale;
@ -65,8 +66,9 @@ while(1){
// if(demuxer->video->id==-1) demuxer->video->id=stream_id;
} else
if(last_fccType==streamtypeAUDIO){
sh_audio->wf=malloc(chunksize); memset(sh_audio->wf,0,chunksize);
if(verbose>=2) printf("found 'wf', %d bytes of %d\n",chunksize,sizeof(WAVEFORMATEX));
sh_audio->wf=calloc((chunksize<sizeof(WAVEFORMATEX))?sizeof(WAVEFORMATEX):chunksize,1);
// sh_audio->wf=malloc(chunksize); memset(sh_audio->wf,0,chunksize);
if(verbose>=1) printf("found 'wf', %d bytes of %d\n",chunksize,sizeof(WAVEFORMATEX));
stream_read(demuxer->stream,(char*) sh_audio->wf,chunksize);
chunksize=0;
if(verbose>=1) print_wave_header(sh_audio->wf);