#include <stdlib.h> /* malloc(), free() */
#include <vlc/vlc.h>
-#include <vlc/input.h>
+#include <vlc_demux.h>
#include "vlc_codec.h"
/*****************************************************************************
{
demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys;
- vlc_bool_t b_forced = VLC_FALSE;
-
uint8_t *p_peek;
- es_format_t fmt;
-
- if( stream_Peek( p_demux->s, &p_peek, 4 ) < 4 )
- {
- msg_Err( p_demux, "cannot peek" );
- return VLC_EGENERIC;
- }
+ if( stream_Peek( p_demux->s, &p_peek, 4 ) < 4 ) return VLC_EGENERIC;
- if( !strncmp( p_demux->psz_demux, "mp4v", 4 ) ||
- !strncmp( p_demux->psz_demux, "m4v", 4 ) )
+ if( p_peek[0] != 0x00 || p_peek[1] != 0x00 || p_peek[2] != 0x01 )
{
- b_forced = VLC_TRUE;
- }
-
- if( p_peek[0] != 0x00 || p_peek[1] != 0x00 || p_peek[2] != 0x01 || p_peek[3] > 0x2f )
- {
- 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;
/* Load the mpeg4video packetizer */
INIT_VPACKETIZER( p_sys->p_packetizer, 'm', 'p', '4', 'v' );
es_format_Init( &p_sys->p_packetizer->fmt_out, UNKNOWN_ES, 0 );
-
+
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;