comparison libmpdemux/aviheader.c @ 32105:c08363dc5320

Replace sizoef(type) by sizeof(*ptrvar). Besides being consistent with FFmpeg style, this reduces the size of a patch to rename these types to not conflict with the windows.h definitions.
author reimar
date Sun, 12 Sep 2010 13:01:05 +0000
parents 64ba1daa147a
children 2e4da7887fd1
comparison
equal deleted inserted replaced
32104:e24003316c1c 32105:c08363dc5320
264 } 264 }
265 265
266 break; } 266 break; }
267 case ckidSTREAMFORMAT: { // read 'strf' 267 case ckidSTREAMFORMAT: { // read 'strf'
268 if(last_fccType==streamtypeVIDEO){ 268 if(last_fccType==streamtypeVIDEO){
269 sh_video->bih=calloc(FFMAX(chunksize, sizeof(BITMAPINFOHEADER)), 1); 269 sh_video->bih=calloc(FFMAX(chunksize, sizeof(*sh_video->bih)), 1);
270 // sh_video->bih=malloc(chunksize); memset(sh_video->bih,0,chunksize); 270 // sh_video->bih=malloc(chunksize); memset(sh_video->bih,0,chunksize);
271 mp_msg(MSGT_HEADER,MSGL_V,MSGTR_MPDEMUX_AVIHDR_FoundBitmapInfoHeader,chunksize,sizeof(BITMAPINFOHEADER)); 271 mp_msg(MSGT_HEADER,MSGL_V,MSGTR_MPDEMUX_AVIHDR_FoundBitmapInfoHeader,chunksize,sizeof(*sh_video->bih));
272 stream_read(demuxer->stream,(char*) sh_video->bih,chunksize); 272 stream_read(demuxer->stream,(char*) sh_video->bih,chunksize);
273 le2me_BITMAPINFOHEADER(sh_video->bih); // swap to machine endian 273 le2me_BITMAPINFOHEADER(sh_video->bih); // swap to machine endian
274 if (sh_video->bih->biSize > chunksize && sh_video->bih->biSize > sizeof(BITMAPINFOHEADER)) 274 if (sh_video->bih->biSize > chunksize && sh_video->bih->biSize > sizeof(*sh_video->bih))
275 sh_video->bih->biSize = chunksize; 275 sh_video->bih->biSize = chunksize;
276 // fixup MS-RLE header (seems to be broken for <256 color files) 276 // fixup MS-RLE header (seems to be broken for <256 color files)
277 if(sh_video->bih->biCompression<=1 && sh_video->bih->biSize==40) 277 if(sh_video->bih->biCompression<=1 && sh_video->bih->biSize==40)
278 sh_video->bih->biSize=chunksize; 278 sh_video->bih->biSize=chunksize;
279 if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_video_header(sh_video->bih,MSGL_V); 279 if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_video_header(sh_video->bih,MSGL_V);
319 mp_msg(MSGT_HEADER,MSGL_V,MSGTR_MPDEMUX_AVIHDR_RegeneratingKeyfTableForMPEG4); 319 mp_msg(MSGT_HEADER,MSGL_V,MSGTR_MPDEMUX_AVIHDR_RegeneratingKeyfTableForMPEG4);
320 break; 320 break;
321 } 321 }
322 } else 322 } else
323 if(last_fccType==streamtypeAUDIO){ 323 if(last_fccType==streamtypeAUDIO){
324 unsigned wf_size = chunksize<sizeof(WAVEFORMATEX)?sizeof(WAVEFORMATEX):chunksize; 324 unsigned wf_size = chunksize<sizeof(*sh_audio->wf)?sizeof(*sh_audio->wf):chunksize;
325 sh_audio->wf=calloc(wf_size,1); 325 sh_audio->wf=calloc(wf_size,1);
326 // sh_audio->wf=malloc(chunksize); memset(sh_audio->wf,0,chunksize); 326 // sh_audio->wf=malloc(chunksize); memset(sh_audio->wf,0,chunksize);
327 mp_msg(MSGT_HEADER,MSGL_V,MSGTR_MPDEMUX_AVIHDR_FoundWaveFmt,chunksize,sizeof(WAVEFORMATEX)); 327 mp_msg(MSGT_HEADER,MSGL_V,MSGTR_MPDEMUX_AVIHDR_FoundWaveFmt,chunksize,sizeof(*sh_audio->wf));
328 stream_read(demuxer->stream,(char*) sh_audio->wf,chunksize); 328 stream_read(demuxer->stream,(char*) sh_audio->wf,chunksize);
329 le2me_WAVEFORMATEX(sh_audio->wf); 329 le2me_WAVEFORMATEX(sh_audio->wf);
330 if (sh_audio->wf->cbSize != 0 && 330 if (sh_audio->wf->cbSize != 0 &&
331 wf_size < sizeof(WAVEFORMATEX)+sh_audio->wf->cbSize) { 331 wf_size < sizeof(*sh_audio->wf)+sh_audio->wf->cbSize) {
332 sh_audio->wf=realloc(sh_audio->wf, sizeof(WAVEFORMATEX)+sh_audio->wf->cbSize); 332 sh_audio->wf=realloc(sh_audio->wf, sizeof(*sh_audio->wf)+sh_audio->wf->cbSize);
333 } 333 }
334 sh_audio->format=sh_audio->wf->wFormatTag; 334 sh_audio->format=sh_audio->wf->wFormatTag;
335 if (sh_audio->format == 1 && 335 if (sh_audio->format == 1 &&
336 last_fccHandler == mmioFOURCC('A', 'x', 'a', 'n')) 336 last_fccHandler == mmioFOURCC('A', 'x', 'a', 'n'))
337 sh_audio->format = last_fccHandler; 337 sh_audio->format = last_fccHandler;