]> git.sesse.net Git - vlc/commitdiff
Fixed aiff support for stereo files and files with odd chunk size.
authorLaurent Aimar <fenrir@videolan.org>
Wed, 13 Jun 2007 19:25:08 +0000 (19:25 +0000)
committerLaurent Aimar <fenrir@videolan.org>
Wed, 13 Jun 2007 19:25:08 +0000 (19:25 +0000)
modules/demux/aiff.c

index da98254d1cb2913b33495a04d3520fd274d3c1c5..8a5e80ebaeab51c26173d3c14321ed121d2e522e 100644 (file)
@@ -103,11 +103,10 @@ static int Open( vlc_object_t *p_this )
 
     uint8_t     *p_peek;
 
-    if( stream_Peek( p_demux->s, &p_peek, 12 ) < 12 ) return VLC_EGENERIC;
+    if( stream_Peek( p_demux->s, &p_peek, 12 ) < 12 )
+        return VLC_EGENERIC;
     if( strncmp( (char *)&p_peek[0], "FORM", 4 ) || strncmp( (char *)&p_peek[8], "AIFF", 4 ) )
-    {
         return VLC_EGENERIC;
-    }
 
     /* skip aiff header */
     stream_Read( p_demux->s, NULL, 12 );
@@ -157,6 +156,8 @@ static int Open( vlc_object_t *p_this )
 
         /* Skip this chunk */
         i_size += 8;
+        if( (i_size % 2) != 0 )
+            i_size++;
         if( stream_Read( p_demux->s, NULL, i_size ) != (int)i_size )
         {
             msg_Warn( p_demux, "incomplete file" );
@@ -168,7 +169,7 @@ static int Open( vlc_object_t *p_this )
     p_sys->i_ssnd_end   = p_sys->i_ssnd_start + p_sys->i_ssnd_size;
 
     p_sys->i_ssnd_fsize = p_sys->fmt.audio.i_channels *
-                          ( p_sys->fmt.audio.i_bitspersample + 7 ) / 8;
+                          ((p_sys->fmt.audio.i_bitspersample + 7) / 8);
 
     if( p_sys->i_ssnd_fsize <= 0 )
     {