[vlc-commits] demux: avi: point directly to next parent chunk on empty

Francois Cartegnie git at videolan.org
Fri Jun 8 16:23:33 CEST 2018


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Jun  8 15:59:47 2018 +0200| [ba61c94a423e4248361f28de1262c85b9085d73a] | committer: Francois Cartegnie

demux: avi: point directly to next parent chunk on empty

refs #9056 #8413
ch01-20130719054942.avi
REC000.avi
MOVI0000.AVI

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

 modules/demux/avi/libavi.c | 45 ++++++++++++++++++++++-----------------------
 1 file changed, 22 insertions(+), 23 deletions(-)

diff --git a/modules/demux/avi/libavi.c b/modules/demux/avi/libavi.c
index 6b04dfb93e..a622b9a3cd 100644
--- a/modules/demux/avi/libavi.c
+++ b/modules/demux/avi/libavi.c
@@ -107,19 +107,8 @@ static int AVI_ChunkReadCommon( stream_t *s, avi_chunk_t *p_chk,
     return VLC_SUCCESS;
 }
 
-static int AVI_NextChunk( stream_t *s, avi_chunk_t *p_chk )
+static int AVI_GotoNextChunk( stream_t *s, const avi_chunk_t *p_chk )
 {
-    avi_chunk_t chk;
-
-    if( !p_chk )
-    {
-        if( AVI_ChunkReadCommon( s, &chk, NULL ) )
-        {
-            return VLC_EGENERIC;
-        }
-        p_chk = &chk;
-    }
-
     bool b_seekable = false;
     const uint64_t i_offset = AVI_ChunkEnd( p_chk );
     if ( !vlc_stream_Control(s, STREAM_CAN_SEEK, &b_seekable) && b_seekable )
@@ -134,6 +123,22 @@ static int AVI_NextChunk( stream_t *s, avi_chunk_t *p_chk )
     }
 }
 
+static int AVI_NextChunk( stream_t *s, avi_chunk_t *p_chk )
+{
+    avi_chunk_t chk;
+
+    if( !p_chk )
+    {
+        if( AVI_ChunkReadCommon( s, &chk, NULL ) )
+        {
+            return VLC_EGENERIC;
+        }
+        p_chk = &chk;
+    }
+
+    return AVI_GotoNextChunk( s, p_chk );
+}
+
 /****************************************************************************
  *
  * Functions to read chunks
@@ -225,9 +230,11 @@ static int AVI_ChunkRead_list( stream_t *s, avi_chunk_t *p_container )
         }
 
     }
-    msg_Dbg( (vlc_object_t*)s, "</list \'%4.4s\'>", (char*)&p_container->list.i_type );
+    msg_Dbg( (vlc_object_t*)s, "</list \'%4.4s\'>%x", (char*)&p_container->list.i_type, i_ret );
+
+    if( i_ret == AVI_ZERO_FOURCC || i_ret == AVI_ZEROSIZED_CHUNK )
+        return AVI_GotoNextChunk( s, p_container );
 
-    if ( i_ret == AVI_ZERO_FOURCC ) return i_ret;
     return VLC_SUCCESS;
 }
 
@@ -998,15 +1005,7 @@ int  AVI_ChunkRead( stream_t *s, avi_chunk_t *p_chk, avi_chunk_t *p_father )
     i_index = AVI_ChunkFunctionFind( p_chk->common.i_chunk_fourcc );
     if( AVI_Chunk_Function[i_index].AVI_ChunkRead_function )
     {
-        int i_return = AVI_Chunk_Function[i_index].AVI_ChunkRead_function( s, p_chk );
-        if ( i_return == AVI_ZEROSIZED_CHUNK || i_return == AVI_ZERO_FOURCC )
-        {
-            if ( !p_father )
-                return VLC_EGENERIC;
-            p_chk->common.i_chunk_fourcc = 0;
-            return AVI_NextChunk( s, ( i_return == AVI_ZEROSIZED_CHUNK ) ? p_chk : p_father );
-        }
-        return i_return;
+        return AVI_Chunk_Function[i_index].AVI_ChunkRead_function( s, p_chk );
     }
     else if( ( ((char*)&p_chk->common.i_chunk_fourcc)[0] == 'i' &&
                ((char*)&p_chk->common.i_chunk_fourcc)[1] == 'x' ) ||



More information about the vlc-commits mailing list