From: Gildas Bazin Date: Thu, 5 Oct 2006 22:01:01 +0000 (+0000) Subject: * modules/demux/mpeg/m4v.c,h264.c: fixed detection and use p_demux->b_force. X-Git-Tag: 0.9.0-test0~10036 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=9361dd4a55eb771f3f5ee093bab569cf3149393f;p=vlc * modules/demux/mpeg/m4v.c,h264.c: fixed detection and use p_demux->b_force. * src/misc/modules.c: only set b_force when we have b_strict. * src/input/demux.c: add m4v and h264 extensions. --- diff --git a/modules/demux/mpeg/h264.c b/modules/demux/mpeg/h264.c index 9d0f8e24b6..03867f841e 100644 --- a/modules/demux/mpeg/h264.c +++ b/modules/demux/mpeg/h264.c @@ -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 */ diff --git a/modules/demux/mpeg/m4v.c b/modules/demux/mpeg/m4v.c index 4cbd185057..2be0fb177b 100644 --- a/modules/demux/mpeg/m4v.c +++ b/modules/demux/mpeg/m4v.c @@ -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; diff --git a/src/input/demux.c b/src/input/demux.c index c1ed4a858d..c62be61b9b 100644 --- a/src/input/demux.c +++ b/src/input/demux.c @@ -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 */ diff --git a/src/misc/modules.c b/src/misc/modules.c index 33b0a8bfaf..cf9892f387 100644 --- a/src/misc/modules.c +++ b/src/misc/modules.c @@ -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 )