[vlc-commits] demux: libmp4: expose MP4_seek

Francois Cartegnie git at videolan.org
Sun May 14 21:46:07 CEST 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon May  8 17:33:40 2017 +0200| [178e6d95ac5ed4eab6a5b973d452a1b583fc7f65] | committer: Francois Cartegnie

demux: libmp4: expose MP4_seek

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

 modules/demux/mp4/libmp4.c | 9 +++++----
 modules/demux/mp4/libmp4.h | 5 +++++
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index dfc6072389..f61d4c4496 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -77,7 +77,7 @@ static int MP4_Box_Read_Specific( stream_t *p_stream, MP4_Box_t *p_box, MP4_Box_
 static void MP4_Box_Clean_Specific( MP4_Box_t *p_box );
 static int MP4_PeekBoxHeader( stream_t *p_stream, MP4_Box_t *p_box );
 
-static int MP4_Seek( stream_t *p_stream, uint64_t i_pos )
+int MP4_Seek( stream_t *p_stream, uint64_t i_pos )
 {
     /* Prevent prefetch breakage */
     uint64_t i_size = stream_Size( p_stream );
@@ -102,9 +102,10 @@ static int MP4_Seek( stream_t *p_stream, uint64_t i_pos )
         return VLC_SUCCESS;
     else if( i_toread > (1<<17) )
         return VLC_EGENERIC;
-    else
-        return vlc_stream_Read( p_stream, NULL,
-                                i_toread ) != (ssize_t)i_toread;
+
+    if( vlc_stream_Read( p_stream, NULL, i_toread ) != (ssize_t)i_toread )
+        return VLC_EGENERIC;
+    return VLC_SUCCESS;
 }
 
 static void MP4_BoxAddChild( MP4_Box_t *p_parent, MP4_Box_t *p_childbox )
diff --git a/modules/demux/mp4/libmp4.h b/modules/demux/mp4/libmp4.h
index 77cccbd8ee..ad2c373132 100644
--- a/modules/demux/mp4/libmp4.h
+++ b/modules/demux/mp4/libmp4.h
@@ -1869,6 +1869,11 @@ static const UUID_t XML360BoxUUID = {
                   0x88, 0x14, 0x58, 0x7a, 0x02, 0x52, 0x1f, 0xdd } };
 
 /*****************************************************************************
+ * MP4_Seek : non seekable stream safe seek
+ ****************************************************************************/
+int MP4_Seek( stream_t *p_stream, uint64_t i_pos );
+
+/*****************************************************************************
  * MP4_BoxGetNextChunk : Parse the entire moof box.
  *****************************************************************************
  *  The first box is a virtual box "root" and is the father of the boxes



More information about the vlc-commits mailing list