Commit 6f768ab4 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

AVI: support WAVEFORMATEXTENSIBLE for audio

This is notably used by files produced by FFmpeg
Closes #4742
parent 0e52a3d8
...@@ -401,6 +401,14 @@ static int Open( vlc_object_t * p_this ) ...@@ -401,6 +401,14 @@ static int Open( vlc_object_t * p_this )
{ {
case( AVIFOURCC_auds ): case( AVIFOURCC_auds ):
tk->i_cat = AUDIO_ES; tk->i_cat = AUDIO_ES;
if( p_auds->p_wf->wFormatTag == WAVE_FORMAT_EXTENSIBLE &&
p_auds->p_wf->cbSize >= sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) )
{
WAVEFORMATEXTENSIBLE *p_wfe = (WAVEFORMATEXTENSIBLE *)p_auds->p_wf;
tk->i_codec = AVI_FourccGetCodec( AUDIO_ES,
p_wfe->SubFormat.Data1 );
}
else
tk->i_codec = AVI_FourccGetCodec( AUDIO_ES, tk->i_codec = AVI_FourccGetCodec( AUDIO_ES,
p_auds->p_wf->wFormatTag ); p_auds->p_wf->wFormatTag );
......
...@@ -342,10 +342,12 @@ static int AVI_ChunkRead_strf( stream_t *s, avi_chunk_t *p_chk ) ...@@ -342,10 +342,12 @@ static int AVI_ChunkRead_strf( stream_t *s, avi_chunk_t *p_chk )
AVI_READ4BYTES( p_chk->strf.auds.p_wf->nAvgBytesPerSec ); AVI_READ4BYTES( p_chk->strf.auds.p_wf->nAvgBytesPerSec );
AVI_READ2BYTES( p_chk->strf.auds.p_wf->nBlockAlign ); AVI_READ2BYTES( p_chk->strf.auds.p_wf->nBlockAlign );
AVI_READ2BYTES( p_chk->strf.auds.p_wf->wBitsPerSample ); AVI_READ2BYTES( p_chk->strf.auds.p_wf->wBitsPerSample );
if( p_chk->strf.auds.p_wf->wFormatTag != WAVE_FORMAT_PCM if( p_chk->strf.auds.p_wf->wFormatTag != WAVE_FORMAT_PCM
&& p_chk->common.i_chunk_size > sizeof( WAVEFORMATEX ) ) && p_chk->common.i_chunk_size > sizeof( WAVEFORMATEX ) )
{ {
AVI_READ2BYTES( p_chk->strf.auds.p_wf->cbSize ); AVI_READ2BYTES( p_chk->strf.auds.p_wf->cbSize );
/* prevent segfault */ /* prevent segfault */
if( p_chk->strf.auds.p_wf->cbSize > if( p_chk->strf.auds.p_wf->cbSize >
p_chk->common.i_chunk_size - sizeof( WAVEFORMATEX ) ) p_chk->common.i_chunk_size - sizeof( WAVEFORMATEX ) )
...@@ -353,11 +355,10 @@ static int AVI_ChunkRead_strf( stream_t *s, avi_chunk_t *p_chk ) ...@@ -353,11 +355,10 @@ static int AVI_ChunkRead_strf( stream_t *s, avi_chunk_t *p_chk )
p_chk->strf.auds.p_wf->cbSize = p_chk->strf.auds.p_wf->cbSize =
p_chk->common.i_chunk_size - sizeof( WAVEFORMATEX ); p_chk->common.i_chunk_size - sizeof( WAVEFORMATEX );
} }
if( p_chk->strf.auds.p_wf->wFormatTag == WAVE_FORMAT_EXTENSIBLE ) if( p_chk->strf.auds.p_wf->wFormatTag == WAVE_FORMAT_EXTENSIBLE )
{ {
/* Found an extensible header atm almost nothing uses that. */ msg_Dbg( s, "Extended header found" );
msg_Warn( (vlc_object_t*)s, "WAVE_FORMAT_EXTENSIBLE or "
"vorbis audio dectected: not supported" );
} }
} }
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment