[vlc-devel] [PATCH 3/5] libmp4: modify MP4_BoxGetNextChunk()

Frédéric Yhuel fyhuel at viotech.net
Tue May 22 17:11:10 CEST 2012


so that a initialization segment which has been put between
two chunks is properly handled.
---
 modules/demux/mp4/libmp4.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 4c65b93..a1fa455 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -3509,11 +3509,21 @@ MP4_Box_t *MP4_BoxGetNextChunk( stream_t *s )
     MP4_Box_t *p_chunk;
     MP4_Box_t *p_moof = NULL;
     MP4_Box_t *p_sidx = NULL;
+    MP4_Box_t *p_trash = NULL;
+
+    p_trash = calloc( 1, sizeof( MP4_Box_t ) );
+    if( unlikely( p_trash == NULL ) )
+        return NULL;
+    MP4_ReadBoxCommon( s, p_trash );
+    if( (p_trash->i_type == ATOM_uuid && !CmpUUID( &p_trash->i_uuid, &SmooBoxUUID ))
+            || p_trash->i_type == ATOM_ftyp )
+        return p_trash;
+    else
+        free( p_trash );
 
     p_chunk = calloc( 1, sizeof( MP4_Box_t ) );
     if( unlikely( p_chunk == NULL ) )
         return NULL;
-
     p_chunk->i_type = ATOM_root;
     p_chunk->i_shortsize = 1;
 
-- 
1.7.9.5




More information about the vlc-devel mailing list