X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fdemux%2Fnsv.c;h=19f112019e9148e4d1d0f583fd8f7425ee3b1a16;hb=54b65bedc9a2abe2461f650c0d40b387f0839174;hp=e0154aa092fb4dfa7c99a483333b2ff12068e072;hpb=6443ce82795740d8d778affa5e190a718663ea56;p=vlc diff --git a/modules/demux/nsv.c b/modules/demux/nsv.c index e0154aa092..19f112019e 100644 --- a/modules/demux/nsv.c +++ b/modules/demux/nsv.c @@ -1,7 +1,7 @@ /***************************************************************************** * nsv.c: NullSoft Video demuxer. ***************************************************************************** - * Copyright (C) 2004 the VideoLAN team + * Copyright (C) 2004-2007 the VideoLAN team * $Id$ * * Authors: Laurent Aimar @@ -24,10 +24,14 @@ /***************************************************************************** * Preamble *****************************************************************************/ -#include /* malloc(), free() */ -#include -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include +#include /* TODO: * - implement NSVf parsing (to get meta data) @@ -42,8 +46,8 @@ static int Open ( vlc_object_t * ); static void Close ( vlc_object_t * ); vlc_module_begin(); - set_description( _("NullSoft demuxer" ) ); - set_capability( "demux2", 10 ); + set_description( N_("NullSoft demuxer" ) ); + set_capability( "demux", 10 ); set_category( CAT_INPUT ); set_subcategory( SUBCAT_INPUT_DEMUX ); set_callbacks( Open, Close ); @@ -86,19 +90,16 @@ static int Open( vlc_object_t *p_this ) 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 */ @@ -142,7 +143,7 @@ static int Demux( demux_t *p_demux ) 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; @@ -155,14 +156,14 @@ static int Demux( demux_t *p_demux ) 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 ) ) { @@ -182,7 +183,7 @@ static int Demux( demux_t *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; @@ -382,11 +383,11 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) *****************************************************************************/ static int ReSynch( demux_t *p_demux ) { - uint8_t *p_peek; + const uint8_t *p_peek; int i_skip; int i_peek; - while( !p_demux->b_die ) + while( vlc_object_alive (p_demux) ) { if( ( i_peek = stream_Peek( p_demux->s, &p_peek, 1024 ) ) < 8 ) { @@ -396,8 +397,8 @@ static int ReSynch( demux_t *p_demux ) 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 ) { @@ -420,7 +421,7 @@ static int ReSynch( demux_t *p_demux ) 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" ); @@ -456,7 +457,10 @@ static int ReadNSVs( demux_t *p_demux ) 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: