Commit 6df306b9 authored by Laurent Aimar's avatar Laurent Aimar

Added a workaround for broken avi files (close #1850).

parent 2e4d57cf
...@@ -384,19 +384,28 @@ static int Open( vlc_object_t * p_this ) ...@@ -384,19 +384,28 @@ static int Open( vlc_object_t * p_this )
tk->i_cat = AUDIO_ES; tk->i_cat = AUDIO_ES;
tk->i_codec = AVI_FourccGetCodec( AUDIO_ES, tk->i_codec = AVI_FourccGetCodec( AUDIO_ES,
p_auds->p_wf->wFormatTag ); p_auds->p_wf->wFormatTag );
if( tk->i_codec == VLC_FOURCC( 'v', 'o', 'r', 'b' ) )
tk->i_blocksize = 0; /* fix vorbis VBR decoding */ tk->i_blocksize = p_auds->p_wf->nBlockAlign;
else if( ( tk->i_blocksize = p_auds->p_wf->nBlockAlign ) == 0 ) if( tk->i_blocksize == 0 )
{ {
if( p_auds->p_wf->wFormatTag == 1 ) if( p_auds->p_wf->wFormatTag == 1 )
{
tk->i_blocksize = p_auds->p_wf->nChannels * (p_auds->p_wf->wBitsPerSample/8); tk->i_blocksize = p_auds->p_wf->nChannels * (p_auds->p_wf->wBitsPerSample/8);
}
else else
{
tk->i_blocksize = 1; tk->i_blocksize = 1;
}
} }
else if( tk->i_samplesize != 0 && tk->i_samplesize != tk->i_blocksize )
{
msg_Warn( p_demux, "track[%d] samplesize=%d and blocksize=%d are not equal."
"Using blocksize as a workaround.",
i, tk->i_samplesize, tk->i_blocksize );
tk->i_samplesize = tk->i_blocksize;
}
if( tk->i_codec == VLC_FOURCC( 'v', 'o', 'r', 'b' ) )
{
tk->i_blocksize = 0; /* fix vorbis VBR decoding */
}
es_format_Init( &fmt, AUDIO_ES, tk->i_codec ); es_format_Init( &fmt, AUDIO_ES, tk->i_codec );
fmt.audio.i_channels = p_auds->p_wf->nChannels; fmt.audio.i_channels = p_auds->p_wf->nChannels;
......
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