[vlc-commits] demux: mp4: allow non seekable on fragmented

Francois Cartegnie git at videolan.org
Thu Dec 18 22:39:57 CET 2014


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Dec 15 20:12:34 2014 +0100| [e186a15e09a3016b79f4fe8c201f9cc2a9678236] | committer: Francois Cartegnie

demux: mp4: allow non seekable on fragmented

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

 modules/demux/mp4/mp4.c |   79 ++++++++++++++++++++++++-----------------------
 1 file changed, 41 insertions(+), 38 deletions(-)

diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index f6a6a2f..25218f9 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -585,12 +585,6 @@ static int Open( vlc_object_t * p_this )
 
     /* I need to seek */
     stream_Control( p_demux->s, STREAM_CAN_SEEK, &p_sys->b_seekable );
-    if( !p_sys->b_seekable )
-    {
-        msg_Warn( p_demux, "MP4 plugin discarded (not seekable)" );
-        free( p_sys );
-        return VLC_EGENERIC;
-    }
     stream_Control( p_demux->s, STREAM_CAN_FASTSEEK, &p_sys->b_fastseekable );
     p_sys->b_seekmode = p_sys->b_fastseekable;
 
@@ -610,38 +604,6 @@ static int Open( vlc_object_t * p_this )
     if( LoadInitFrag( p_demux ) != VLC_SUCCESS )
         goto error;
 
-    if( MP4_BoxCount( p_sys->p_root, "/moov/mvex" ) > 0 )
-    {
-        if ( p_sys->b_seekable )
-        {
-            /* Probe remaining to check if there's really fragments
-               or if that file is just ready to append fragments */
-            ProbeFragments( p_demux, false );
-            p_sys->b_fragmented = !!MP4_BoxCount( p_sys->p_root, "/moof" );
-
-            if ( p_sys->b_fragmented && !p_sys->i_overall_duration )
-                ProbeFragments( p_demux, true );
-        }
-        else
-            p_sys->b_fragmented = true;
-    }
-
-    if ( !p_sys->moovfragment.p_moox )
-        AddFragment( p_demux, MP4_BoxGet( p_sys->p_root, "/moov" ) );
-
-    /* we always need a moov entry, but smooth has a workaround */
-    if ( !p_sys->moovfragment.p_moox && !p_sys->b_smooth )
-        goto error;
-
-    if( p_sys->b_smooth )
-    {
-        if( InitTracks( p_demux ) != VLC_SUCCESS )
-            goto error;
-        CreateTracksFromSmooBox( p_demux );
-        return VLC_SUCCESS;
-    }
-
-    MP4_BoxDumpStructure( p_demux->s, p_sys->p_root );
 
     if( ( p_ftyp = MP4_BoxGet( p_sys->p_root, "/ftyp" ) ) )
     {
@@ -695,13 +657,54 @@ static int Open( vlc_object_t * p_this )
         msg_Dbg( p_demux, "file type box missing (assuming ISO Media file)" );
     }
 
+    if( MP4_BoxCount( p_sys->p_root, "/moov/mvex" ) > 0 )
+    {
+        if ( p_sys->b_seekable && !p_sys->b_smooth && !p_sys->b_dash )
+        {
+            /* Probe remaining to check if there's really fragments
+               or if that file is just ready to append fragments */
+            ProbeFragments( p_demux, false );
+            p_sys->b_fragmented = !!MP4_BoxCount( p_sys->p_root, "/moof" );
+
+            if ( p_sys->b_fragmented && !p_sys->i_overall_duration )
+                ProbeFragments( p_demux, true );
+        }
+        else
+            p_sys->b_fragmented = true;
+    }
+
+    if ( !p_sys->moovfragment.p_moox )
+        AddFragment( p_demux, MP4_BoxGet( p_sys->p_root, "/moov" ) );
+
+    /* we always need a moov entry, but smooth has a workaround */
+    if ( !p_sys->moovfragment.p_moox && !p_sys->b_smooth )
+        goto error;
+
+    if( p_sys->b_smooth )
+    {
+        if( InitTracks( p_demux ) != VLC_SUCCESS )
+            goto error;
+        CreateTracksFromSmooBox( p_demux );
+        return VLC_SUCCESS;
+    }
+
+    MP4_BoxDumpStructure( p_demux->s, p_sys->p_root );
+
     if ( p_sys->b_smooth || p_sys->b_dash )
     {
         p_demux->pf_demux = DemuxFrg;
+        msg_Dbg( p_demux, "Set DemuxFrg mode" );
     }
     else if( p_sys->b_fragmented )
     {
         p_demux->pf_demux = DemuxAsLeaf;
+        msg_Dbg( p_demux, "Set experimental DemuxLeaf mode" );
+    }
+
+    if( !p_sys->b_seekable && p_demux->pf_demux == Demux )
+    {
+        msg_Warn( p_demux, "MP4 plugin discarded (not seekable)" );
+        goto error;
     }
 
     /* the file need to have one moov box */



More information about the vlc-commits mailing list