Commit 9361dd4a authored by Gildas Bazin's avatar Gildas Bazin

* 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.
parent 410b11fd
......@@ -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 */
......
......@@ -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;
......
......@@ -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 */
......
......@@ -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 )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment