/*****************************************************************************
* nsv.c: NullSoft Video demuxer.
*****************************************************************************
- * Copyright (C) 2004 the VideoLAN team
+ * Copyright (C) 2004-2007 the VideoLAN team
* $Id$
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
/*****************************************************************************
* Preamble
*****************************************************************************/
-#include <stdlib.h> /* malloc(), free() */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
#include <vlc/vlc.h>
-#include <vlc/input.h>
+#include <vlc_demux.h>
/* TODO:
* - implement NSVf parsing (to get meta data)
demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys;
- uint8_t *p_peek;
+ const uint8_t *p_peek;
if( stream_Peek( p_demux->s, &p_peek, 8 ) < 8 )
return VLC_EGENERIC;
- if( strncmp( (char *)p_peek, "NSVf", 4 )
- && strncmp( (char *)p_peek, "NSVs", 4 ))
+ if( memcmp( p_peek, "NSVf", 4 ) && memcmp( p_peek, "NSVs", 4 ) )
{
/* In case we had force this demuxer we try to resynch */
- if( strcmp( p_demux->psz_demux, "nsv" ) || ReSynch( p_demux ) )
- {
+ if( !p_demux->b_force || ReSynch( p_demux ) )
return VLC_EGENERIC;
- }
}
/* Fill p_demux field */
demux_sys_t *p_sys = p_demux->p_sys;
uint8_t header[5];
- uint8_t *p_peek;
+ const uint8_t *p_peek;
int i_size;
block_t *p_frame;
return 0;
}
- if( !strncmp( (char *)p_peek, "NSVf", 4 ) )
+ if( !memcmp( p_peek, "NSVf", 4 ) )
{
if( ReadNSVf( p_demux ) )
{
return -1;
}
}
- else if( !strncmp( (char *)p_peek, "NSVs", 4 ) )
+ else if( !memcmp( p_peek, "NSVs", 4 ) )
{
if( ReadNSVs( p_demux ) )
{
}
else
{
- msg_Err( p_demux, "invalid signature 0x%x (%4.4s)", *(uint32_t*)p_peek, (char*)p_peek );
+ msg_Err( p_demux, "invalid signature 0x%x (%4.4s)", GetDWLE( p_peek ), (const char*)p_peek );
if( ReSynch( p_demux ) )
{
return -1;
*****************************************************************************/
static int ReSynch( demux_t *p_demux )
{
- uint8_t *p_peek;
+ const uint8_t *p_peek;
int i_skip;
int i_peek;
while( i_skip < i_peek - 4 )
{
- if( !strncmp( (char *)p_peek, "NSVf", 4 )
- || !strncmp( (char *)p_peek, "NSVs", 4 ) )
+ if( !memcmp( p_peek, "NSVf", 4 )
+ || !memcmp( p_peek, "NSVs", 4 ) )
{
if( i_skip > 0 )
{
static int ReadNSVf( demux_t *p_demux )
{
/* demux_sys_t *p_sys = p_demux->p_sys; */
- uint8_t *p;
+ const uint8_t *p;
int i_size;
msg_Dbg( p_demux, "new NSVf chunk" );
case VLC_FOURCC( 'V', 'P', '3', '1' ):
fcc = VLC_FOURCC( 'V', 'P', '3', '1' );
break;
+ case VLC_FOURCC( 'V', 'P', '6', '0' ):
+ case VLC_FOURCC( 'V', 'P', '6', '1' ):
case VLC_FOURCC( 'V', 'P', '6', '2' ):
+ case VLC_FOURCC( 'H', '2', '6', '4' ):
case VLC_FOURCC( 'N', 'O', 'N', 'E' ):
break;
default: