]> git.sesse.net Git - vlc/commitdiff
* modules/demux/mpeg/m4v.c,h264.c: fixed detection and use p_demux->b_force.
authorGildas Bazin <gbazin@videolan.org>
Thu, 5 Oct 2006 22:01:01 +0000 (22:01 +0000)
committerGildas Bazin <gbazin@videolan.org>
Thu, 5 Oct 2006 22:01:01 +0000 (22:01 +0000)
* src/misc/modules.c: only set b_force when we have b_strict.
* src/input/demux.c: add m4v and h264 extensions.

modules/demux/mpeg/h264.c
modules/demux/mpeg/m4v.c
src/input/demux.c
src/misc/modules.c

index 9d0f8e24b68e181d58f1f1cf8fb624140cb8d25c..03867f841e874a80cebc46f2b6e2bc324f5ade73 100644 (file)
@@ -75,33 +75,23 @@ static int Open( vlc_object_t * p_this )
 {
     demux_t     *p_demux = (demux_t*)p_this;
     demux_sys_t *p_sys;
-    vlc_bool_t   b_forced = VLC_FALSE;
-
     uint8_t     *p_peek;
     vlc_value_t val;
 
-    if( stream_Peek( p_demux->s, &p_peek, 5 ) < 5 )
-    {
-        msg_Err( p_demux, "cannot peek" );
-        return VLC_EGENERIC;
-    }
-
-    if( !strncmp( p_demux->psz_demux, "h264", 4 ) )
-    {
-        b_forced = VLC_TRUE;
-    }
+    if( stream_Peek( p_demux->s, &p_peek, 5 ) < 5 ) return VLC_EGENERIC;
 
     if( p_peek[0] != 0x00 || p_peek[1] != 0x00 ||
         p_peek[2] != 0x00 || p_peek[3] != 0x01 ||
         (p_peek[4]&0x1F) != 7 ) /* SPS */
     {
-        if( !b_forced )
+        if( !p_demux->b_force )
         {
             msg_Warn( p_demux, "h264 module discarded (no startcode)" );
             return VLC_EGENERIC;
         }
 
-        msg_Err( p_demux, "this doesn't look like a H264 ES stream, continuing" );
+        msg_Err( p_demux, "this doesn't look like a H264 ES stream, "
+                 "continuing anyway" );
     }
 
     p_demux->pf_demux  = Demux;
@@ -112,10 +102,7 @@ static int Open( vlc_object_t * p_this )
     var_Create( p_demux, "h264-fps", VLC_VAR_FLOAT|VLC_VAR_DOINHERIT );
     var_Get( p_demux, "h264-fps", &val );
     p_sys->f_fps = val.f_float;
-    if( val.f_float < 0.001 )
-    {
-        p_sys->f_fps = 0.001;
-    }
+    if( val.f_float < 0.001 ) p_sys->f_fps = 0.001;
     msg_Dbg( p_demux, "using %.2f fps", p_sys->f_fps );
 
     /* Load the mpegvideo packetizer */
index 4cbd185057420b33cc170d61aa0576e9acebdff5..2be0fb177bdc925eb60547f2209478fe7a4bfe5b 100644 (file)
@@ -69,30 +69,20 @@ static int Open( vlc_object_t * p_this )
 {
     demux_t     *p_demux = (demux_t*)p_this;
     demux_sys_t *p_sys;
-    vlc_bool_t   b_forced = VLC_FALSE;
     uint8_t     *p_peek;
 
-    if( stream_Peek( p_demux->s, &p_peek, 4 ) < 4 )
-    {
-        msg_Err( p_demux, "cannot peek" );
-        return VLC_EGENERIC;
-    }
-
-    if( !strncmp( p_demux->psz_demux, "mp4v", 4 ) ||
-        !strncmp( p_demux->psz_demux, "m4v", 4 ) )
-    {
-        b_forced = VLC_TRUE;
-    }
+    if( stream_Peek( p_demux->s, &p_peek, 4 ) < 4 ) return VLC_EGENERIC;
 
-    if( p_peek[0] != 0x00 || p_peek[1] != 0x00 || p_peek[2] != 0x01 || p_peek[3] > 0x2f )
+    if( p_peek[0] != 0x00 || p_peek[1] != 0x00 || p_peek[2] != 0x01 )
     {
-        if( !b_forced )
+        if( !p_demux->b_force )
         {
             msg_Warn( p_demux, "m4v module discarded (no startcode)" );
             return VLC_EGENERIC;
         }
 
-        msg_Warn( p_demux, "this doesn't look like an MPEG-4 ES stream, continuing anyway" );
+        msg_Warn( p_demux, "this doesn't look like an MPEG-4 ES stream, "
+                  "continuing anyway" );
     }
 
     p_demux->pf_demux  = Demux;
@@ -107,7 +97,7 @@ static int Open( vlc_object_t * p_this )
 
     LOAD_PACKETIZER_OR_FAIL( p_sys->p_packetizer, "mpeg4 video" );
 
-    /* We need to wait until we gtt p_extra (VOL header) from the packetizer
+    /* We need to wait until we get p_extra (VOL header) from the packetizer
      * before we create the output */
 
     return VLC_SUCCESS;
index c1ed4a858dcc7ec13bb1db622a51e260398e7181..c62be61b9bef871ae50c66b506325f541c3cfa10 100644 (file)
@@ -97,6 +97,8 @@ demux_t *__demux2_New( vlc_object_t *p_obj,
             { "ogg",  "ogg" }, { "ogm",  "ogg" },
             { "pva",  "pva" },
             { "rm",   "rm" },
+            { "m4v",  "m4v" },
+            { "h264",  "h264" },
             { NULL,  NULL },
         };
         /* Here, we don't mind if it does not work, it must be quick */
index 33b0a8bfafbb2685f7812c9650df8a07931b20ae..cf9892f387cdd2a0ff3c5ba12172670925a78fe1 100644 (file)
@@ -578,7 +578,7 @@ module_t * __module_Need( vlc_object_t *p_this, const char *psz_capability,
         /* Store this new module */
         p_list[ i_index ].p_module = p_module;
         p_list[ i_index ].i_score = p_module->i_score + i_shortcut_bonus;
-        p_list[ i_index ].b_force = !!i_shortcut_bonus;
+        p_list[ i_index ].b_force = i_shortcut_bonus && b_strict;
 
         /* Add it to the modules-to-probe list */
         if( i_index == 0 )