Commit f0ddd615 authored by zorglub's avatar zorglub
Browse files

Add a bunch of helper functions/macros and start using them:

* malloc with NULL check
* file extension check
* check if a demux was forced
* try peeking, and check what we poke
* init standard demuxer fields
* create packetizers
parent 50a87715
...@@ -596,6 +596,20 @@ static int64_t GCD( int64_t a, int64_t b ) ...@@ -596,6 +596,20 @@ static int64_t GCD( int64_t a, int64_t b )
else return a; else return a;
} }
/* Malloc with automatic error */
#define MALLOC_VOID( var, type ) { var = (type*)malloc( sizeof( type) ); \
if( !var ) return; }
#define MALLOC_NULL( var, type ) { var = (type*)malloc( sizeof( type) ); \
if( !var ) return NULL; }
#define MALLOC_ERR( var, type ) { var = (type*)malloc( sizeof( type) ); \
if( !var ) return VLC_ENOMEM; }
#define MALLOC_GOTOERR( var, type ) { var = (type*)malloc( sizeof( type) ); \
if( !var ) goto error; }
#define DECMALLOC_VOID( var, type ) type* var = (type*)malloc( sizeof(type) );\
if( !var ) return;
#define DECMALLOC_NULL( var, type ) type* var = (type*)malloc( sizeof(type) );\
if( !var ) return NULL;
/* Dynamic array handling: realloc array, move data, increment position */ /* Dynamic array handling: realloc array, move data, increment position */
#if defined( _MSC_VER ) && _MSC_VER < 1300 && !defined( UNDER_CE ) #if defined( _MSC_VER ) && _MSC_VER < 1300 && !defined( UNDER_CE )
# define VLCCVP (void**) /* Work-around for broken compiler */ # define VLCCVP (void**) /* Work-around for broken compiler */
......
...@@ -132,6 +132,97 @@ static inline int demux2_Control( demux_t *p_demux, int i_query, ... ) ...@@ -132,6 +132,97 @@ static inline int demux2_Control( demux_t *p_demux, int i_query, ... )
va_end( args ); va_end( args );
return i_result; return i_result;
} }
/*************************************************************************
* Miscellaneous helpers for demuxers
*************************************************************************/
static inline vlc_bool_t isExtension( demux_t *p_demux, char *psz_requested )
{
char *psz_ext;
psz_ext = strrchr ( p_demux->psz_path, '.' );
if( !psz_ext || strcmp( psz_ext, psz_requested ) )
return VLC_FALSE;
return VLC_TRUE;
}
static inline vlc_bool_t isDemux( demux_t *p_demux, char *psz_requested )
{
if( !p_demux->psz_demux || strcmp( p_demux->psz_demux, psz_requested ) )
return VLC_FALSE;
return VLC_TRUE;
}
#define STANDARD_DEMUX_INIT \
p_demux->pf_control = Control; \
p_demux->pf_demux = Demux; \
MALLOC_ERR( p_demux->p_sys, demux_sys_t );
#define STANDARD_DEMUX_INIT_MSG( msg ) \
p_demux->pf_control = Control; \
p_demux->pf_demux = Demux; \
MALLOC_ERR( p_demux->p_sys, demux_sys_t ); \
msg_Dbg( p_demux, msg ); \
#define DEMUX_BY_EXTENSION( ext ) \
demux_t *p_demux = (demux_t *)p_this; \
if( !isExtension( p_demux, ext ) ) \
return VLC_EGENERIC; \
STANDARD_DEMUX_INIT;
#define DEMUX_BY_EXTENSION_MSG( ext, msg ) \
demux_t *p_demux = (demux_t *)p_this; \
if( !isExtension( p_demux, ext ) ) \
return VLC_EGENERIC; \
STANDARD_DEMUX_INIT_MSG( msg );
#define DEMUX_BY_EXTENSION_OR_FORCED( ext, module ) \
demux_t *p_demux = (demux_t *)p_this; \
if( !isExtension( p_demux, ext ) && !isDemux( p_demux, module ) ) \
return VLC_EGENERIC; \
STANDARD_DEMUX_INIT;
#define DEMUX_BY_EXTENSION_OR_FORCED_MSG( ext, module, msg ) \
demux_t *p_demux = (demux_t *)p_this; \
if( !isExtension( p_demux, ext ) && !isDemux( p_demux, module ) ) \
return VLC_EGENERIC; \
STANDARD_DEMUX_INIT_MSG( msg );
#define CHECK_PEEK( zepeek, size ) \
if( stream_Peek( p_demux->s , &zepeek, size ) < size ){ \
msg_Dbg( p_demux, "not enough data" ); return VLC_EGENERIC; }
#define CHECK_PEEK_GOTO( zepeek, size ) \
if( stream_Peek( p_demux->s , &zepeek, size ) < size ) { \
msg_Dbg( p_demux, "not enough data" ); goto error; }
#define CHECK_DISCARD_PEEK( size ) { uint8_t *p_peek; \
if( stream_Peek( p_demux->s , &p_peek, size ) < size ) return VLC_EGENERIC;}
#define POKE( peek, stuff, size ) (strncasecmp( (char *)peek, stuff, size )==0)
#define CREATE_PACKETIZER( a,b,c,d ) \
p_sys->p_packetizer = vlc_object_create( p_demux, VLC_OBJECT_DECODER ); \
p_sys->p_packetizer->pf_decode_audio = 0; \
p_sys->p_packetizer->pf_decode_video = 0; \
p_sys->p_packetizer->pf_decode_sub = 0; \
p_sys->p_packetizer->pf_packetize = 0; \
es_format_Init( &p_sys->p_packetizer->fmt_in, AUDIO_ES, \
VLC_FOURCC( a, b, c, d ) );
/* BEWARE ! This can lead to memory leaks ! */
#define LOAD_PACKETIZER_OR_FAIL( msg ) \
p_sys->p_packetizer->p_module = \
module_Need( p_sys->p_packetizer, "packetizer", NULL, 0 ); \
\
if( p_sys->p_packetizer->p_module == NULL ) \
{ \
vlc_object_destroy( p_sys->p_packetizer ); \
msg_Err( p_demux, "cannot find packetizer for " # msg ); \
free( p_sys ); \
return VLC_EGENERIC; \
}
/** /**
* @} * @}
*/ */
......
...@@ -125,13 +125,7 @@ static int Open( vlc_object_t * p_this ) ...@@ -125,13 +125,7 @@ static int Open( vlc_object_t * p_this )
} }
/* Have a peep at the show. */ /* Have a peep at the show. */
if( stream_Peek( p_demux->s, &p_peek, i_peek + A52_MAX_HEADER_SIZE * 2 ) < CHECK_PEEK( p_peek, i_peek + A52_MAX_HEADER_SIZE * 2 );
i_peek + A52_MAX_HEADER_SIZE * 2 )
{
/* Stream too short */
msg_Warn( p_demux, "cannot peek()" );
return VLC_EGENERIC;
}
if( CheckSync( p_peek + i_peek, &b_big_endian ) != VLC_SUCCESS ) if( CheckSync( p_peek + i_peek, &b_big_endian ) != VLC_SUCCESS )
{ {
...@@ -146,16 +140,12 @@ static int Open( vlc_object_t * p_this ) ...@@ -146,16 +140,12 @@ static int Open( vlc_object_t * p_this )
} }
/* Fill p_demux fields */ /* Fill p_demux fields */
p_demux->pf_demux = Demux; STANDARD_DEMUX_INIT; p_sys = p_demux->p_sys;
p_demux->pf_control = Control;
p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
p_sys->b_start = VLC_TRUE; p_sys->b_start = VLC_TRUE;
p_sys->i_mux_rate = 0; p_sys->i_mux_rate = 0;
p_sys->b_big_endian = b_big_endian; p_sys->b_big_endian = b_big_endian;
/* /* Load the A52 packetizer */
* Load the A52 packetizer
*/
p_sys->p_packetizer = vlc_object_create( p_demux, VLC_OBJECT_DECODER ); p_sys->p_packetizer = vlc_object_create( p_demux, VLC_OBJECT_DECODER );
p_sys->p_packetizer->pf_decode_audio = 0; p_sys->p_packetizer->pf_decode_audio = 0;
p_sys->p_packetizer->pf_decode_video = 0; p_sys->p_packetizer->pf_decode_video = 0;
......
...@@ -113,10 +113,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -113,10 +113,7 @@ static int Open( vlc_object_t *p_this )
stream_Read( p_demux->s, NULL, 12 ); stream_Read( p_demux->s, NULL, 12 );
/* Fill p_demux field */ /* Fill p_demux field */
p_demux->pf_demux = Demux; STANDARD_DEMUX_INIT; p_sys = p_demux->p_sys;
p_demux->pf_control = Control;
p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
es_format_Init( &p_sys->fmt, UNKNOWN_ES, 0 ); es_format_Init( &p_sys->fmt, UNKNOWN_ES, 0 );
p_sys->i_time = 1; p_sys->i_time = 1;
p_sys->i_ssnd_pos = -1; p_sys->i_ssnd_pos = -1;
...@@ -125,22 +122,14 @@ static int Open( vlc_object_t *p_this ) ...@@ -125,22 +122,14 @@ static int Open( vlc_object_t *p_this )
{ {
uint32_t i_size; uint32_t i_size;
if( stream_Peek( p_demux->s, &p_peek, 8 ) < 8 ) CHECK_PEEK_GOTO( p_peek, 8 );
{
msg_Dbg( p_demux, "cannot peek()" );
goto error;
}
i_size = GetDWBE( &p_peek[4] ); i_size = GetDWBE( &p_peek[4] );
msg_Dbg( p_demux, "chunk fcc=%4.4s size=%d", p_peek, i_size ); msg_Dbg( p_demux, "chunk fcc=%4.4s size=%d", p_peek, i_size );
if( !strncmp( (char *)&p_peek[0], "COMM", 4 ) ) if( !strncmp( (char *)&p_peek[0], "COMM", 4 ) )
{ {
if( stream_Peek( p_demux->s, &p_peek, 18 + 8 ) < 18 + 8 ) CHECK_PEEK_GOTO( p_peek, 18+8 );
{
msg_Dbg( p_demux, "cannot peek()" );
goto error;
}
es_format_Init( &p_sys->fmt, AUDIO_ES, VLC_FOURCC( 't', 'w', 'o', 's' ) ); es_format_Init( &p_sys->fmt, AUDIO_ES, VLC_FOURCC( 't', 'w', 'o', 's' ) );
p_sys->fmt.audio.i_channels = GetWBE( &p_peek[8] ); p_sys->fmt.audio.i_channels = GetWBE( &p_peek[8] );
p_sys->fmt.audio.i_bitspersample = GetWBE( &p_peek[14] ); p_sys->fmt.audio.i_bitspersample = GetWBE( &p_peek[14] );
...@@ -151,12 +140,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -151,12 +140,7 @@ static int Open( vlc_object_t *p_this )
} }
else if( !strncmp( (char *)&p_peek[0], "SSND", 4 ) ) else if( !strncmp( (char *)&p_peek[0], "SSND", 4 ) )
{ {
if( stream_Peek( p_demux->s, &p_peek, 8 + 8 ) < 8 + 8 ) CHECK_PEEK_GOTO( p_peek, 8+8 );
{
msg_Dbg( p_demux, "cannot peek()" );
goto error;
}
p_sys->i_ssnd_pos = stream_Tell( p_demux->s ); p_sys->i_ssnd_pos = stream_Tell( p_demux->s );
p_sys->i_ssnd_size = i_size; p_sys->i_ssnd_size = i_size;
p_sys->i_ssnd_offset = GetDWBE( &p_peek[8] ); p_sys->i_ssnd_offset = GetDWBE( &p_peek[8] );
......
...@@ -89,7 +89,7 @@ struct demux_sys_t ...@@ -89,7 +89,7 @@ struct demux_sys_t
int i_header_size; int i_header_size;
}; };
static int DemuxPCM( demux_t * ); static int Demux( demux_t * );
static int Control ( demux_t *, int i_query, va_list args ); static int Control ( demux_t *, int i_query, va_list args );
/***************************************************************************** /*****************************************************************************
...@@ -105,7 +105,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -105,7 +105,7 @@ static int Open( vlc_object_t *p_this )
int i_cat; int i_cat;
int i_samples, i_modulo; int i_samples, i_modulo;
if( stream_Peek( p_demux->s, &p_peek, 4 ) < 4 ) return VLC_EGENERIC; CHECK_PEEK( p_peek, 4 );
if( memcmp( p_peek, ".snd", 4 ) ) if( memcmp( p_peek, ".snd", 4 ) )
{ {
...@@ -128,7 +128,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -128,7 +128,7 @@ static int Open( vlc_object_t *p_this )
return VLC_EGENERIC; return VLC_EGENERIC;
} }
p_sys = p_demux->p_sys = malloc( sizeof( demux_sys_t ) ); STANDARD_DEMUX_INIT; p_sys = p_demux->p_sys;
p_sys->i_time = 1; p_sys->i_time = 1;
p_sys->i_header_size = GetDWBE( &hdr[0] ); p_sys->i_header_size = GetDWBE( &hdr[0] );
...@@ -276,19 +276,15 @@ static int Open( vlc_object_t *p_this ) ...@@ -276,19 +276,15 @@ static int Open( vlc_object_t *p_this )
(mtime_t)i_samples / (mtime_t)i_samples /
(mtime_t)p_sys->fmt.audio.i_rate; (mtime_t)p_sys->fmt.audio.i_rate;
/* finish to set up p_demux */
p_demux->pf_demux = DemuxPCM;
p_demux->pf_control = Control;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
/***************************************************************************** /*****************************************************************************
* DemuxPCM: read packet and send them to decoders * Demux: read packet and send them to decoders
***************************************************************************** *****************************************************************************
* Returns -1 in case of error, 0 in case of EOF, 1 otherwise * Returns -1 in case of error, 0 in case of EOF, 1 otherwise
*****************************************************************************/ *****************************************************************************/
static int DemuxPCM( demux_t *p_demux ) static int Demux( demux_t *p_demux )
{ {
demux_sys_t *p_sys = p_demux->p_sys; demux_sys_t *p_sys = p_demux->p_sys;
block_t *p_block; block_t *p_block;
......
...@@ -136,13 +136,7 @@ static int Open( vlc_object_t * p_this ) ...@@ -136,13 +136,7 @@ static int Open( vlc_object_t * p_this )
} }
/* Have a peep at the show. */ /* Have a peep at the show. */
if( stream_Peek( p_demux->s, &p_peek, i_peek + DTS_MAX_HEADER_SIZE * 2 ) < CHECK_PEEK( p_peek, i_peek + DTS_MAX_HEADER_SIZE * 2 );
i_peek + DTS_MAX_HEADER_SIZE * 2 )
{
/* Stream too short */
msg_Warn( p_demux, "cannot peek()" );
return VLC_EGENERIC;
}
if( CheckSync( p_peek + i_peek ) != VLC_SUCCESS ) if( CheckSync( p_peek + i_peek ) != VLC_SUCCESS )
{ {
...@@ -155,32 +149,10 @@ static int Open( vlc_object_t * p_this ) ...@@ -155,32 +149,10 @@ static int Open( vlc_object_t * p_this )
"continuing anyway" ); "continuing anyway" );
} }
p_demux->pf_demux = Demux; STANDARD_DEMUX_INIT; p_sys = p_demux->p_sys;
p_demux->pf_control = Control;
p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) ); INIT_PACKETIZER( 'd','t','s',' ' );
p_sys->b_start = VLC_TRUE; LOAD_PACKETIZER_OR_FAIL( "DTS" );
p_sys->i_mux_rate = 0;
/*
* Load the DTS packetizer
*/
p_sys->p_packetizer = vlc_object_create( p_demux, VLC_OBJECT_DECODER );
p_sys->p_packetizer->pf_decode_audio = 0;
p_sys->p_packetizer->pf_decode_video = 0;
p_sys->p_packetizer->pf_decode_sub = 0;
p_sys->p_packetizer->pf_packetize = 0;
/* Initialization of decoder structure */
es_format_Init( &p_sys->p_packetizer->fmt_in, AUDIO_ES,
VLC_FOURCC( 'd', 't', 's', ' ' ) );
p_sys->p_packetizer->p_module =
module_Need( p_sys->p_packetizer, "packetizer", NULL, 0 );
if( !p_sys->p_packetizer->p_module )
{
msg_Err( p_demux, "cannot find DTS packetizer" );
return VLC_EGENERIC;
}
p_sys->p_es = es_out_Add( p_demux->out, &p_sys->p_packetizer->fmt_in ); p_sys->p_es = es_out_Add( p_demux->out, &p_sys->p_packetizer->fmt_in );
......
...@@ -86,7 +86,6 @@ static int StoreString( demux_t *p_demux, char **ppsz_string, char *psz_source_s ...@@ -86,7 +86,6 @@ static int StoreString( demux_t *p_demux, char **ppsz_string, char *psz_source_s
int E_(Import_ASX)( vlc_object_t *p_this ) int E_(Import_ASX)( vlc_object_t *p_this )
{ {
demux_t *p_demux = (demux_t *)p_this; demux_t *p_demux = (demux_t *)p_this;
demux_sys_t *p_sys;
char *psz_ext; char *psz_ext;
...@@ -95,7 +94,7 @@ int E_(Import_ASX)( vlc_object_t *p_this ) ...@@ -95,7 +94,7 @@ int E_(Import_ASX)( vlc_object_t *p_this )
if( ( psz_ext && !strcasecmp( psz_ext, ".asx") ) || if( ( psz_ext && !strcasecmp( psz_ext, ".asx") ) ||
( psz_ext && !strcasecmp( psz_ext, ".wax") ) || ( psz_ext && !strcasecmp( psz_ext, ".wax") ) ||
( psz_ext && !strcasecmp( psz_ext, ".wvx") ) || ( psz_ext && !strcasecmp( psz_ext, ".wvx") ) ||
( p_demux->psz_demux && !strcmp(p_demux->psz_demux, "asx-open") ) ) isDemux( p_demux, "asx-open" ) )
{ {
; ;
} }
...@@ -103,20 +102,11 @@ int E_(Import_ASX)( vlc_object_t *p_this ) ...@@ -103,20 +102,11 @@ int E_(Import_ASX)( vlc_object_t *p_this )
{ {
return VLC_EGENERIC; return VLC_EGENERIC;
} }
msg_Dbg( p_demux, "using asx playlist import"); STANDARD_DEMUX_INIT_MSG( "using ASX playlist reader" );
p_demux->p_sys->psz_prefix = E_(FindPrefix)( p_demux );
p_demux->pf_control = Control; p_demux->p_sys->psz_data = NULL;
p_demux->pf_demux = Demux; p_demux->p_sys->i_data_len = -1;
p_demux->p_sys = p_sys = malloc( sizeof(demux_sys_t) ); p_demux->p_sys->b_utf8 = VLC_FALSE;
if( p_sys == NULL )
{
msg_Err( p_demux, "out of memory" );
return VLC_ENOMEM;
}
p_sys->psz_prefix = E_(FindPrefix)( p_demux );
p_sys->psz_data = NULL;
p_sys->i_data_len = -1;
p_sys->b_utf8 = VLC_FALSE;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -494,4 +484,4 @@ static int Demux( demux_t *p_demux ) ...@@ -494,4 +484,4 @@ static int Demux( demux_t *p_demux )
static int Control( demux_t *p_demux, int i_query, va_list args ) static int Control( demux_t *p_demux, int i_query, va_list args )
{ {
return VLC_EGENERIC; return VLC_EGENERIC;
} }
\ No newline at end of file
...@@ -24,14 +24,12 @@ ...@@ -24,14 +24,12 @@
/***************************************************************************** /*****************************************************************************
* Preamble * Preamble
*****************************************************************************/ *****************************************************************************/
#include <stdlib.h> /* malloc(), free() */
#include <ctype.h> /* isspace() */ #include <ctype.h> /* isspace() */
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <vlc/input.h> #include <vlc/input.h>
#include <vlc/intf.h> #include <vlc/intf.h>
#include <errno.h> /* ENOMEM */
#include "playlist.h" #include "playlist.h"
#include "vlc_xml.h" #include "vlc_xml.h"
...@@ -55,36 +53,11 @@ static int IsWhitespace( char *psz_string ); ...@@ -55,36 +53,11 @@ static int IsWhitespace( char *psz_string );
*****************************************************************************/ *****************************************************************************/
int E_(Import_B4S)( vlc_object_t *p_this ) int E_(Import_B4S)( vlc_object_t *p_this )
{ {
demux_t *p_demux = (demux_t *)p_this; DEMUX_BY_EXTENSION_OR_FORCED_MSG( ".b4s", "b4s-open",
demux_sys_t *p_sys; "using B4S playlist reader" );
p_demux->p_sys->psz_prefix = E_(FindPrefix)( p_demux );
char *psz_ext; p_demux->p_sys->p_xml = NULL;
p_demux->p_sys->p_xml_reader = NULL;
psz_ext = strrchr ( p_demux->psz_path, '.' );
if( ( psz_ext && !strcasecmp( psz_ext, ".b4s") ) ||
( p_demux->psz_demux && !strcmp(p_demux->psz_demux, "b4s-open") ) )
{
;
}
else
{
return VLC_EGENERIC;
}
msg_Dbg( p_demux, "using b4s playlist import");
p_demux->pf_control = Control;
p_demux->pf_demux = Demux;
p_demux->p_sys = p_sys = malloc( sizeof(demux_sys_t) );
if( p_sys == NULL )
{
msg_Err( p_demux, "out of memory" );
return VLC_ENOMEM;
}
p_sys->psz_prefix = E_(FindPrefix)( p_demux );
p_sys->p_xml = NULL;
p_sys->p_xml_reader = NULL;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
......
...@@ -24,8 +24,6 @@ ...@@ -24,8 +24,6 @@
/***************************************************************************** /*****************************************************************************
* Preamble * Preamble
*****************************************************************************/ *****************************************************************************/
#include <stdlib.h> /* malloc(), free() */
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <vlc/input.h> #include <vlc/input.h>
#include <vlc/intf.h> #include <vlc/intf.h>
...@@ -54,13 +52,10 @@ int E_(Import_DVB)( vlc_object_t *p_this ) ...@@ -54,13 +52,10 @@ int E_(Import_DVB)( vlc_object_t *p_this )
demux_t *p_demux = (demux_t *)p_this; demux_t *p_demux = (demux_t *)p_this;
uint8_t *p_peek; uint8_t *p_peek;
int i_peek; int i_peek;
char *psz_ext;
vlc_bool_t b_valid = VLC_FALSE; vlc_bool_t b_valid = VLC_FALSE;
psz_ext = strrchr ( p_demux->psz_path, '.' ); if( !isExtension( p_demux, ".conf" ) && !p_demux->b_force )
return VLC_EGENERIC;
if( !( psz_ext && !strncasecmp( psz_ext, ".conf", 5 ) ) &&
!p_demux->b_force ) return VLC_EGENERIC;
/* Check if this really is a channels file */ /* Check if this really is a channels file */
if( (i_peek = stream_Peek( p_demux->s, &p_peek, 1024 )) > 0 ) if( (i_peek = stream_Peek( p_demux->s, &p_peek, 1024 )) > 0 )
...@@ -81,7 +76,6 @@ int E_(Import_DVB)( vlc_object_t *p_this ) ...@@ -81,7 +76,6 @@ int E_(Import_DVB)( vlc_object_t *p_this )
if( !b_valid ) return VLC_EGENERIC; if( !b_valid ) return VLC_EGENERIC;
msg_Dbg( p_demux, "found valid DVB conf playlist file"); msg_Dbg( p_demux, "found valid DVB conf playlist file");
p_demux->pf_control = Control; p_demux->pf_control = Control;
p_demux->pf_demux = Demux; p_demux->pf_demux = Demux;
......
...@@ -37,8 +37,6 @@ ...@@ -37,8 +37,6 @@
/***************************************************************************** /*****************************************************************************
* Preamble * Preamble
*****************************************************************************/ *****************************************************************************/
#include <stdlib.h> /* malloc(), free() */
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <vlc/input.h> #include <vlc/input.h>
#include <vlc/intf.h> #include <vlc/intf.h>
...@@ -68,7 +66,6 @@ static int Control( demux_t *p_demux, int i_query, va_list args ); ...@@ -68,7 +66,6 @@ static int Control( demux_t *p_demux, int i_query, va_list args );
int E_(Import_GVP)( vlc_object_t *p_this ) int E_(Import_GVP)( vlc_object_t *p_this )
{ {
demux_t *p_demux = (demux_t *)p_this; demux_t *p_demux = (demux_t *)p_this;
demux_sys_t *p_sys;
int i_size; int i_size;
byte_t *p_peek; byte_t *p_peek;
...@@ -79,18 +76,11 @@ int E_(Import_GVP)( vlc_object_t *p_this ) ...@@ -79,18 +76,11 @@ int E_(Import_GVP)( vlc_object_t *p_this )
return VLC_EGENERIC; return VLC_EGENERIC;
} }
msg_Dbg( p_demux, "using Google Video Playlist (gvp) import"); STANDARD_DEMUX_INIT_MSG( "using Google Video Playlist (gvp) import" )
p_demux->pf_control = Control; p_demux->pf_control = Control;
p_demux->pf_demux = Demux; p_demux->pf_demux = Demux;
p_demux->p_sys = p_sys = malloc( sizeof(demux_sys_t) ); MALLOC_ERR( p_demux->p_sys, demux_sys_t );
if( p_sys == NULL ) p_demux->p_sys->p_playlist = NULL;
{
msg_Err( p_demux, "out of memory" );