comparison libmpdemux/aviheader.c @ 23965:8d4b1bda30f1

Fix detection of xan audio. -noidx or -forceidx still is necessary to detect audio at all.
author reimar
date Wed, 01 Aug 2007 09:01:28 +0000
parents 27327c023b7e
children 50159082a80b
comparison
equal deleted inserted replaced
23964:918dd2856cb6 23965:8d4b1bda30f1
62 priv->audio_streams=0; 62 priv->audio_streams=0;
63 while(1){ 63 while(1){
64 int id=stream_read_dword_le(demuxer->stream); 64 int id=stream_read_dword_le(demuxer->stream);
65 unsigned chunksize,size2; 65 unsigned chunksize,size2;
66 static int last_fccType=0; 66 static int last_fccType=0;
67 static int last_fccHandler=0;
67 char* hdr=NULL; 68 char* hdr=NULL;
68 // 69 //
69 if(stream_eof(demuxer->stream)) break; 70 if(stream_eof(demuxer->stream)) break;
70 // Imply -forceidx if -saveidx is specified 71 // Imply -forceidx if -saveidx is specified
71 if (index_file_save) 72 if (index_file_save)
201 mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_AudioID, "aviheader", stream_id); 202 mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_AudioID, "aviheader", stream_id);
202 memcpy(&sh_audio->audio,&h,sizeof(h)); 203 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; 204 sh_audio->stream_delay = (float)sh_audio->audio.dwStart * sh_audio->audio.dwScale/sh_audio->audio.dwRate;
204 } 205 }
205 last_fccType=h.fccType; 206 last_fccType=h.fccType;
207 last_fccHandler=h.fccHandler;
206 if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_strh(&h,MSGL_V); 208 if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_strh(&h,MSGL_V);
207 break; } 209 break; }
208 case mmioFOURCC('i', 'n', 'd', 'x'): { 210 case mmioFOURCC('i', 'n', 'd', 'x'): {
209 uint32_t i; 211 uint32_t i;
210 avisuperindex_chunk *s; 212 avisuperindex_chunk *s;
321 if (sh_audio->wf->cbSize != 0 && 323 if (sh_audio->wf->cbSize != 0 &&
322 wf_size < sizeof(WAVEFORMATEX)+sh_audio->wf->cbSize) { 324 wf_size < sizeof(WAVEFORMATEX)+sh_audio->wf->cbSize) {
323 sh_audio->wf=realloc(sh_audio->wf, sizeof(WAVEFORMATEX)+sh_audio->wf->cbSize); 325 sh_audio->wf=realloc(sh_audio->wf, sizeof(WAVEFORMATEX)+sh_audio->wf->cbSize);
324 } 326 }
325 sh_audio->format=sh_audio->wf->wFormatTag; 327 sh_audio->format=sh_audio->wf->wFormatTag;
328 if (sh_audio->format == 1 &&
329 last_fccHandler == mmioFOURCC('A', 'x', 'a', 'n'))
330 sh_audio->format = last_fccHandler;
326 sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec; 331 sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec;
327 chunksize=0; 332 chunksize=0;
328 if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_wave_header(sh_audio->wf,MSGL_V); 333 if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_wave_header(sh_audio->wf,MSGL_V);
329 ++priv->audio_streams; 334 ++priv->audio_streams;
330 // if(demuxer->audio->id==-1) demuxer->audio->id=stream_id; 335 // if(demuxer->audio->id==-1) demuxer->audio->id=stream_id;