[vlc-devel] [PATCH] libmp4: don't parse twice the file in MP4_BoxGetRoot
Frédéric Yhuel
yhuelf at gmail.com
Fri Oct 26 17:27:01 CEST 2012
---
modules/demux/mp4/libmp4.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 9621f92..5bfe98f 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -3572,12 +3572,14 @@ MP4_Box_t *MP4_BoxGetRoot( stream_t *s )
return p_root;
p_root->i_size = stream_Size( s );
- stream_Seek( p_stream, 0 );
- /* Get the rest of the file */
- i_result = MP4_ReadBoxContainerRaw( p_stream, p_root );
+ if( stream_Tell( s ) < stream_Size( s ) )
+ {
+ /* Get the rest of the file */
+ i_result = MP4_ReadBoxContainerRaw( p_stream, p_root );
- if( !i_result )
- goto error;
+ if( !i_result )
+ goto error;
+ }
MP4_Box_t *p_moov;
MP4_Box_t *p_cmov;
--
1.7.9.5
More information about the vlc-devel
mailing list