vlc | branch: master | Francois Cartegnie <[email protected]> | Tue Sep 8 16:53:33 2015 +0200| [89c26f3581721572ee86b62dfdbb3e2a672a5568] | committer: Francois Cartegnie
demux: mp4: add check for reversed moov/mdat order with non seekable files > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=89c26f3581721572ee86b62dfdbb3e2a672a5568 --- modules/demux/mp4/libmp4.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c index 6e59ba7..1063110 100644 --- a/modules/demux/mp4/libmp4.c +++ b/modules/demux/mp4/libmp4.c @@ -4185,13 +4185,29 @@ MP4_Box_t *MP4_BoxGetRoot( stream_t *p_stream ) CreateUUID( &p_root->i_uuid, p_root->i_type ); /* First get the moov */ - const uint32_t stoplist[] = { ATOM_moov, 0 }; + const uint32_t stoplist[] = { ATOM_moov, ATOM_mdat, 0 }; i_result = MP4_ReadBoxContainerChildren( p_stream, p_root, stoplist ); + /* mdat appeared first */ + if( i_result && !MP4_BoxGet( p_root, "moov" ) ) + { + bool b_seekable; + if( stream_Control( p_stream, STREAM_CAN_SEEK, &b_seekable ) != VLC_SUCCESS || !b_seekable ) + { + msg_Err( p_stream, "no moov before mdat and the stream is not seekable" ); + goto error; + } + + /* continue loading up to moov */ + const uint32_t stoplist[] = { ATOM_moov, 0 }; + i_result = MP4_ReadBoxContainerChildren( p_stream, p_root, stoplist ); + } + if( !i_result ) goto error; + /* If there is a mvex box, it means fragmented MP4, and we're done */ - else if( MP4_BoxCount( p_root, "moov/mvex" ) > 0 ) + if( MP4_BoxCount( p_root, "moov/mvex" ) > 0 ) return p_root; if( stream_Tell( p_stream ) + 8 < (uint64_t) stream_Size( p_stream ) ) _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
