comparison libmpdemux/aviheader.c @ 21387:8621736097f8

Move initialization of sh_audio/sh_video members to aviheader where possible so that all a_streams[]/v_streams[] are initialized and switching becomes simpler.
author reimar
date Thu, 30 Nov 2006 17:48:00 +0000
parents 1767c271d710
children 7e36c7edce3d
comparison
equal deleted inserted replaced
21386:3c20bb1ac789 21387:8621736097f8
193 chunksize-=MIN(size2,sizeof(h)); 193 chunksize-=MIN(size2,sizeof(h));
194 ++stream_id; 194 ++stream_id;
195 if(h.fccType==streamtypeVIDEO){ 195 if(h.fccType==streamtypeVIDEO){
196 sh_video=new_sh_video(demuxer,stream_id); 196 sh_video=new_sh_video(demuxer,stream_id);
197 memcpy(&sh_video->video,&h,sizeof(h)); 197 memcpy(&sh_video->video,&h,sizeof(h));
198 sh_video->stream_delay = (float)sh_video->video.dwStart * sh_video->video.dwScale/sh_video->video.dwRate;
198 } else 199 } else
199 if(h.fccType==streamtypeAUDIO){ 200 if(h.fccType==streamtypeAUDIO){
200 sh_audio=new_sh_audio(demuxer,stream_id); 201 sh_audio=new_sh_audio(demuxer,stream_id);
201 memcpy(&sh_audio->audio,&h,sizeof(h)); 202 memcpy(&sh_audio->audio,&h,sizeof(h));
203 sh_audio->stream_delay = (float)sh_audio->audio.dwStart * sh_audio->audio.dwScale/sh_audio->audio.dwRate;
202 } 204 }
203 last_fccType=h.fccType; 205 last_fccType=h.fccType;
204 if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_strh(&h,MSGL_V); 206 if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_strh(&h,MSGL_V);
205 break; } 207 break; }
206 case mmioFOURCC('i', 'n', 'd', 'x'): { 208 case mmioFOURCC('i', 'n', 'd', 'x'): {
262 // fixup MS-RLE header (seems to be broken for <256 color files) 264 // fixup MS-RLE header (seems to be broken for <256 color files)
263 if(sh_video->bih->biCompression<=1 && sh_video->bih->biSize==40) 265 if(sh_video->bih->biCompression<=1 && sh_video->bih->biSize==40)
264 sh_video->bih->biSize=chunksize; 266 sh_video->bih->biSize=chunksize;
265 if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_video_header(sh_video->bih,MSGL_V); 267 if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_video_header(sh_video->bih,MSGL_V);
266 chunksize=0; 268 chunksize=0;
267 // sh_video->fps=(float)sh_video->video.dwRate/(float)sh_video->video.dwScale; 269 sh_video->fps=(float)sh_video->video.dwRate/(float)sh_video->video.dwScale;
268 // sh_video->frametime=(float)sh_video->video.dwScale/(float)sh_video->video.dwRate; 270 sh_video->frametime=(float)sh_video->video.dwScale/(float)sh_video->video.dwRate;
269 // if(demuxer->video->id==-1) demuxer->video->id=stream_id; 271 // if(demuxer->video->id==-1) demuxer->video->id=stream_id;
270 // IdxFix: 272 // IdxFix:
271 idxfix_videostream=stream_id; 273 idxfix_videostream=stream_id;
272 switch(sh_video->bih->biCompression){ 274 switch(sh_video->bih->biCompression){
273 case mmioFOURCC('M', 'P', 'G', '4'): 275 case mmioFOURCC('M', 'P', 'G', '4'):
314 le2me_WAVEFORMATEX(sh_audio->wf); 316 le2me_WAVEFORMATEX(sh_audio->wf);
315 if (sh_audio->wf->cbSize != 0 && 317 if (sh_audio->wf->cbSize != 0 &&
316 wf_size < sizeof(WAVEFORMATEX)+sh_audio->wf->cbSize) { 318 wf_size < sizeof(WAVEFORMATEX)+sh_audio->wf->cbSize) {
317 sh_audio->wf=realloc(sh_audio->wf, sizeof(WAVEFORMATEX)+sh_audio->wf->cbSize); 319 sh_audio->wf=realloc(sh_audio->wf, sizeof(WAVEFORMATEX)+sh_audio->wf->cbSize);
318 } 320 }
321 sh_audio->format=sh_audio->wf->wFormatTag;
322 sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec;
319 chunksize=0; 323 chunksize=0;
320 if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_wave_header(sh_audio->wf,MSGL_V); 324 if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_wave_header(sh_audio->wf,MSGL_V);
321 ++priv->audio_streams; 325 ++priv->audio_streams;
322 // if(demuxer->audio->id==-1) demuxer->audio->id=stream_id; 326 // if(demuxer->audio->id==-1) demuxer->audio->id=stream_id;
323 } 327 }