[vlc-devel] commit: Added a workaround for broken avi files (close #1850). ( Laurent Aimar )

git version control git at videolan.org
Mon Aug 18 19:39:24 CEST 2008


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Mon Aug 18 19:36:39 2008 +0200| [6df306b912ea186eb07b49ff6791f2d56b195d6b] | committer: Laurent Aimar 

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

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6df306b912ea186eb07b49ff6791f2d56b195d6b
---

 modules/demux/avi/avi.c |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index 2e1b306..5244802 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -384,19 +384,28 @@ static int Open( vlc_object_t * p_this )
                 tk->i_cat   = AUDIO_ES;
                 tk->i_codec = AVI_FourccGetCodec( AUDIO_ES,
                                                   p_auds->p_wf->wFormatTag );
-                if( tk->i_codec == VLC_FOURCC( 'v', 'o', 'r', 'b' ) )
-                    tk->i_blocksize = 0; /* fix vorbis VBR decoding */
-                else if( ( tk->i_blocksize = p_auds->p_wf->nBlockAlign ) == 0 )
+
+                tk->i_blocksize = p_auds->p_wf->nBlockAlign;
+                if( tk->i_blocksize == 0 )
                 {
                     if( p_auds->p_wf->wFormatTag == 1 )
-                    {
                         tk->i_blocksize = p_auds->p_wf->nChannels * (p_auds->p_wf->wBitsPerSample/8);
-                    }
                     else
-                    {
                         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 );
 
                 fmt.audio.i_channels        = p_auds->p_wf->nChannels;




More information about the vlc-devel mailing list