vlc | branch: master | Frédéric Yhuel <yhu...@gmail.com> | Fri Oct 26 17:27:01 
2012 +0200| [fbe00443ab25626d22d2a5040280f54eda432784] | committer: 
Jean-Baptiste Kempf

libmp4: don't parse twice the file in MP4_BoxGetRoot

Signed-off-by: Jean-Baptiste Kempf <j...@videolan.org>

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

 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 70198d8..0dd92c3 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -3571,12 +3571,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;

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
http://mailman.videolan.org/listinfo/vlc-commits

Reply via email to