Made demux2_IsPathExtension case insensitive.
Used demux2_IsPathExtension/p_demux->b_force when appropriate
Fixed a regression in flac demuxer (segfault when reading meta data)
Added a VLC_UNUSED(x) macro to avoid seeing ugly (void)x around the code.
Improved a bit a few vlc_common.h macro (do {} while(0))
}
/* 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 MALLOC_VOID( var, type ) do { var = (type*)malloc( sizeof( type) ); \
+ if( !var ) return; } while(0)
+#define MALLOC_NULL( var, type ) do { var = (type*)malloc( sizeof( type) ); \
+ if( !var ) return NULL; } while(0)
+#define MALLOC_ERR( var, type ) do { var = (type*)malloc( sizeof( type) ); \
+ if( !var ) return VLC_ENOMEM; } while(0)
+#define MALLOC_GOTOERR( var, type ) do { var = (type*)malloc( sizeof( type) ); \
+ if( !var ) goto error; } while(0)
#define DECMALLOC_VOID( var, type ) type* var = (type*)malloc( sizeof(type) );\
if( !var ) return;
-#define DECMALLOC_ERR( var, type ) type* var = (type*)malloc( sizeof(type) );\
+#define DECMALLOC_ERR( var, type ) type* var = (type*)malloc( sizeof(type) );\
if( !var ) return VLC_ENOMEM;
#define DECMALLOC_NULL( var, type ) type* var = (type*)malloc( sizeof(type) );\
if( !var ) return NULL;
-#define FREENULL(a) if( a ) { free( a ); a = NULL; }
-#define FREE(a) if( a ) { free( a ); }
+#define FREENULL(a) do { if( a ) { free( a ); a = NULL; } } while(0)
+#define FREE(a) do { if( a ) { free( a ); } } while(0)
#define EMPTY_STR(str) (!str || !*str)
# define ATTR_ALIGN(align)
#endif
+/* */
+#define VLC_UNUSED(x) (void)(x)
+
/* Alignment of critical dynamic data structure
*
* Not all platforms support memalign so we provide a vlc_memalign wrapper
static inline vlc_bool_t demux2_IsPathExtension( demux_t *p_demux, const char *psz_extension )
{
const char *psz_ext = strrchr ( p_demux->psz_path, '.' );
- if( !psz_ext || strcmp( psz_ext, psz_extension ) )
+ if( !psz_ext || strcasecmp( psz_ext, psz_extension ) )
return VLC_FALSE;
return VLC_TRUE;
}
return VLC_TRUE;
}
-#define STANDARD_DEMUX_INIT \
- p_demux->pf_control = Control; \
- p_demux->pf_demux = Demux; \
+#define DEMUX_INIT_COMMON() do { \
+ p_demux->pf_control = Control; \
+ p_demux->pf_demux = Demux; \
MALLOC_ERR( p_demux->p_sys, demux_sys_t ); \
- memset( p_demux->p_sys, 0, sizeof( demux_sys_t ) );
+ memset( p_demux->p_sys, 0, sizeof( demux_sys_t ) ); } while(0)
-#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 ); \
- memset( p_demux->p_sys, 0, sizeof( demux_sys_t ) ); \
- msg_Dbg( p_demux, msg ); \
+#define STANDARD_DEMUX_INIT_MSG( msg ) do { \
+ DEMUX_INIT_COMMON(); \
+ msg_Dbg( p_demux, msg ); } while(0)
#define DEMUX_BY_EXTENSION( ext ) \
demux_t *p_demux = (demux_t *)p_this; \
if( !demux2_IsPathExtension( p_demux, ext ) ) \
return VLC_EGENERIC; \
- STANDARD_DEMUX_INIT;
+ DEMUX_INIT_COMMON();
#define DEMUX_BY_EXTENSION_MSG( ext, msg ) \
demux_t *p_demux = (demux_t *)p_this; \
demux_t *p_demux = (demux_t *)p_this; \
if( !demux2_IsPathExtension( p_demux, ext ) && !demux2_IsForced( p_demux, module ) ) \
return VLC_EGENERIC; \
- STANDARD_DEMUX_INIT;
+ DEMUX_INIT_COMMON();
#define DEMUX_BY_EXTENSION_OR_FORCED_MSG( ext, module, msg ) \
demux_t *p_demux = (demux_t *)p_this; \
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 POKE( peek, stuff, size ) (strncasecmp( (const char *)peek, stuff, size )==0)
#define COMMON_INIT_PACKETIZER( location ) \
location = vlc_object_create( p_demux, VLC_OBJECT_PACKETIZER ); \
free( psz_name );
/* Fill p_demux field */
- STANDARD_DEMUX_INIT; p_sys = p_demux->p_sys;
+ DEMUX_INIT_COMMON(); p_sys = p_demux->p_sys;
p_sys->dvdnav = p_dvdnav;
ps_track_init( p_sys->tk );
msg_Dbg( p_demux, "VMG opened" );
/* Fill p_demux field */
- STANDARD_DEMUX_INIT; p_sys = p_demux->p_sys;
+ DEMUX_INIT_COMMON(); p_sys = p_demux->p_sys;
ps_track_init( p_sys->tk );
p_sys->i_aspect = -1;
return VLC_EGENERIC;
/* Set up p_demux */
- STANDARD_DEMUX_INIT; p_sys = p_demux->p_sys;
+ DEMUX_INIT_COMMON(); p_sys = p_demux->p_sys;
p_demux->info.i_update = 0;
p_demux->info.i_title = 0;
p_demux->info.i_seekpoint = 0;
if( CheckSync( p_peek + i_peek, &b_big_endian ) != VLC_SUCCESS )
{
- if( strncmp( p_demux->psz_demux, "a52", 3 ) )
- {
+ if( !p_demux->b_force )
return VLC_EGENERIC;
- }
/* User forced */
msg_Err( p_demux, "this doesn't look like a A52 audio stream, "
}
/* Fill p_demux fields */
- STANDARD_DEMUX_INIT; p_sys = p_demux->p_sys;
+ DEMUX_INIT_COMMON(); p_sys = p_demux->p_sys;
p_sys->b_start = VLC_TRUE;
p_sys->i_mux_rate = 0;
p_sys->b_big_endian = b_big_endian;
static int Control( demux_t *p_demux, int i_query, va_list args );
/* GetF80BE: read a 80 bits float in big endian */
-static unsigned int GetF80BE( uint8_t p[10] )
+static unsigned int GetF80BE( const uint8_t p[10] )
{
unsigned int i_mantissa = GetDWBE( &p[2] );
int i_exp = 30 - p[1];
stream_Read( p_demux->s, NULL, 12 );
/* Fill p_demux field */
- STANDARD_DEMUX_INIT; p_sys = p_demux->p_sys;
+ DEMUX_INIT_COMMON(); p_sys = p_demux->p_sys;
es_format_Init( &p_sys->fmt, UNKNOWN_ES, 0 );
p_sys->i_time = 1;
p_sys->i_ssnd_pos = -1;
return VLC_EGENERIC;
}
- STANDARD_DEMUX_INIT; p_sys = p_demux->p_sys;
+ DEMUX_INIT_COMMON(); p_sys = p_demux->p_sys;
p_sys->i_time = 1;
p_sys->i_header_size = GetDWBE( &hdr[0] );
unsigned int i_track;
unsigned int i, i_peeker;
- uint8_t *p_peek;
+ const uint8_t *p_peek;
/* Is it an avi file ? */
if( stream_Peek( p_demux->s, &p_peek, 200 ) < 200 ) return VLC_EGENERIC;
****************************************************************************/
static int AVI_PacketGetHeader( demux_t *p_demux, avi_packet_t *p_pk )
{
- uint8_t *p_peek;
+ const uint8_t *p_peek;
if( stream_Peek( p_demux->s, &p_peek, 16 ) < 16 )
{
#define __EVEN( x ) ( (x)&0x01 ? (x)+1 : (x) )
-static vlc_fourcc_t GetFOURCC( byte_t *p_buff )
+static vlc_fourcc_t GetFOURCC( const byte_t *p_buff )
{
return VLC_FOURCC( p_buff[0], p_buff[1], p_buff[2], p_buff[3] );
}
****************************************************************************/
static int AVI_ChunkReadCommon( stream_t *s, avi_chunk_t *p_chk )
{
- uint8_t *p_peek;
+ const uint8_t *p_peek;
int i_peek;
memset( p_chk, 0, sizeof( avi_chunk_t ) );
static int AVI_ChunkRead_list( stream_t *s, avi_chunk_t *p_container )
{
avi_chunk_t *p_chk;
- uint8_t *p_peek;
+ const uint8_t *p_peek;
vlc_bool_t b_seekable;
if( p_container->common.i_chunk_size > 0 && p_container->common.i_chunk_size < 8 )
{
p_chk->idx1.i_entry_count = 0;
p_chk->idx1.i_entry_max = 0;
- FREENULL( p_chk->idx1.entry )
+ FREENULL( p_chk->idx1.entry );
}
/* Identify cdg file by extension, as there is no simple way to
* detect it */
- if( !demux2_IsPathExtension( p_demux, ".cdg" ) &&
- !demux2_IsPathExtension( p_demux, ".CDG" ) &&
- !demux2_IsForced( p_demux, "cdg" ) )
+ if( !demux2_IsPathExtension( p_demux, ".cdg" ) && !p_demux->b_force )
return VLC_EGENERIC;
/* CDG file size has to be multiple of CDG_FRAME_SIZE (it works even
vlc_bool_t b_append;
/* Accept only if forced */
- if( strcasecmp( p_demux->psz_demux, "dump" ) )
+ if( !p_demux->b_force )
return VLC_EGENERIC;
var_Create( p_demux, "demuxdump-append", VLC_VAR_BOOL|VLC_VAR_DOINHERIT );
if( CheckSync( p_peek + i_peek ) != VLC_SUCCESS )
{
- if( strncmp( p_demux->psz_demux, "dts", 3 ) )
- {
+ if( !p_demux->b_force )
return VLC_EGENERIC;
- }
+
/* User forced */
msg_Err( p_demux, "this doesn't look like a DTS audio stream, "
"continuing anyway" );
}
- STANDARD_DEMUX_INIT; p_sys = p_demux->p_sys;
+ DEMUX_INIT_COMMON(); p_sys = p_demux->p_sys;
INIT_APACKETIZER( p_sys->p_packetizer, 'd','t','s',' ' );
LOAD_PACKETIZER_OR_FAIL( p_sys->p_packetizer, "DTS" );
#define IF_EXTRACT(txt,var) \
if( !strncasecmp(psz, txt, strlen(txt)) ) \
{ \
- char * oldval = vlc_meta_Get( p_sys->p_meta, vlc_meta_ ## var ); \
+ const char *oldval = vlc_meta_Get( p_sys->p_meta, vlc_meta_ ## var ); \
if( oldval ) \
{ \
char * newval; \
} \
else \
vlc_meta_Set( p_sys->p_meta, vlc_meta_ ## var, &psz[strlen(txt)] ); \
- free( oldval ); \
}
IF_EXTRACT("TITLE=", Title )
else IF_EXTRACT("ALBUM=", Album )
vlc_value_t val;
/* We accept file based on extention match */
- if( strcasecmp( p_demux->psz_demux, "gme" ) )
+ if( !p_demux->b_force )
{
if( ( ext = strrchr( p_demux->psz_path, '.' ) ) == NULL ||
stream_Size( p_demux->s ) == 0 ) return VLC_EGENERIC;
mtime_t i_frame_length;
char *psz_separator;
int i_frame_size_estimate;
- uint8_t *p_peek;
+ const uint8_t *p_peek;
int i_data_peeked;
};
static char* GetLine( demux_t *p_demux, int *p_pos )
{
demux_sys_t *p_sys = p_demux->p_sys;
- uint8_t *p_buf;
+ const uint8_t *p_buf;
int i_size;
int i;
char *p_line;
int i_size;
int b_matched = VLC_FALSE;
vlc_value_t val;
- char *psz_ext;
p_demux->pf_control = Control;
p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
/* Check for jpeg file extension */
p_sys->b_still = VLC_FALSE;
p_sys->i_still_end = 0;
- psz_ext = strrchr( p_demux->psz_path, '.' );
- if( psz_ext && ( !strcasecmp( psz_ext, ".jpeg" ) ||
- !strcasecmp( psz_ext, ".jpg" ) ) )
+ if( demux2_IsPathExtension( p_demux, ".jpeg" ) ||
+ demux2_IsPathExtension( p_demux, ".jpg" ) )
{
p_sys->b_still = VLC_TRUE;
if( val.f_float)
{
demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys;
- char *ext;
- int i;
ModPlug_Settings settings;
vlc_value_t val;
/* We accept file based on extension match */
- if( strcasecmp( p_demux->psz_demux, "mod" ) )
+ if( !p_demux->b_force )
{
+ char *ext;
+ int i;
if( ( ext = strrchr( p_demux->psz_path, '.' ) ) == NULL ||
stream_Size( p_demux->s ) == 0 ) return VLC_EGENERIC;
static void MP4_FreeBox_url( MP4_Box_t *p_box )
{
- FREENULL( p_box->data.p_url->psz_location )
+ FREENULL( p_box->data.p_url->psz_location );
}
static int MP4_ReadBox_urn( stream_t *p_stream, MP4_Box_t *p_box )
static void MP4_FreeBox_stss( MP4_Box_t *p_box )
{
- FREENULL( p_box->data.p_stss->i_sample_number )
+ FREENULL( p_box->data.p_stss->i_sample_number );
}
static int MP4_ReadBox_stsh( stream_t *p_stream, MP4_Box_t *p_box )
static void MP4_FreeBox_stsh( MP4_Box_t *p_box )
{
- FREENULL( p_box->data.p_stsh->i_shadowed_sample_number )
- FREENULL( p_box->data.p_stsh->i_sync_sample_number )
+ FREENULL( p_box->data.p_stsh->i_shadowed_sample_number );
+ FREENULL( p_box->data.p_stsh->i_sync_sample_number );
}
static void MP4_FreeBox_stdp( MP4_Box_t *p_box )
{
- FREENULL( p_box->data.p_stdp->i_priority )
+ FREENULL( p_box->data.p_stdp->i_priority );
}
static int MP4_ReadBox_padb( stream_t *p_stream, MP4_Box_t *p_box )
static void MP4_FreeBox_rdrf( MP4_Box_t *p_box )
{
- FREENULL( p_box->data.p_rdrf->psz_ref )
+ FREENULL( p_box->data.p_rdrf->psz_ref );
}
demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys;
es_format_t fmt;
- uint8_t *p_peek;
+ const uint8_t *p_peek;
module_t *p_id3;
if( stream_Peek( p_demux->s, &p_peek, 4 ) < 4 )
if( i_version < 4 || i_version > 6 )
return VLC_EGENERIC;
- if( !p_demux->psz_demux || strcmp( p_demux->psz_demux, "mpc" ) )
+ if( !p_demux->b_force )
{
/* Check file name extension */
- int i_len;
- if( !p_demux->psz_path )
- return VLC_EGENERIC;
-
- i_len = strlen( p_demux->psz_path );
- if( i_len < 4 ||
- ( strcasecmp( &p_demux->psz_path[i_len-4], ".mpc" ) &&
- strcasecmp( &p_demux->psz_path[i_len-4], ".mp+" ) &&
- strcasecmp( &p_demux->psz_path[i_len-4], ".mpp" ) ) )
+ if( !demux2_IsPathExtension( p_demux, ".mpc" ) &&
+ !demux2_IsPathExtension( p_demux, ".mp+" ) &&
+ !demux2_IsPathExtension( p_demux, ".mpp" ) )
return VLC_EGENERIC;
}
}
{
demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys;
- uint8_t *p_peek;
+ const uint8_t *p_peek;
vlc_value_t val;
if( stream_Peek( p_demux->s, &p_peek, 5 ) < 5 ) return VLC_EGENERIC;
demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys;
module_t *p_id3;
- uint8_t *p_peek;
+ const uint8_t *p_peek;
int b_forced = VLC_FALSE;
- if( p_demux->psz_path )
- {
- int i_len = strlen( p_demux->psz_path );
-
- if( i_len > 4 && !strcasecmp( &p_demux->psz_path[i_len - 4], ".aac" ) )
- {
- b_forced = VLC_TRUE;
- }
- }
+ if( demux2_IsPathExtension( p_demux, ".aac" ) )
+ b_forced = VLC_TRUE;
if( !p_demux->b_force && !b_forced )
- {
return VLC_EGENERIC;
- }
/* peek the begining (10 is for adts header) */
if( stream_Peek( p_demux->s, &p_peek, 10 ) < 10 )
{
demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys;
- uint8_t *p_peek;
+ const uint8_t *p_peek;
vlc_value_t val;
if( stream_Peek( p_demux->s, &p_peek, 4 ) < 4 ) return VLC_EGENERIC;
vlc_bool_t b_forced = VLC_FALSE;
uint32_t header;
- uint8_t *p_peek;
+ const uint8_t *p_peek;
module_t *p_id3;
block_t *p_block_in, *p_block_out;
- if( p_demux->psz_path )
- {
- int i_len = strlen( p_demux->psz_path );
- if( i_len > 4 && !strcasecmp( &p_demux->psz_path[i_len - 4], ".mp3" ) )
- {
- b_forced = VLC_TRUE;
- }
- }
+ if( demux2_IsPathExtension( p_demux, ".mp3" ) )
+ b_forced = VLC_TRUE;
if( stream_Peek( p_demux->s, &p_peek, 4 ) < 4 ) return VLC_EGENERIC;
if( !b_ok && !p_demux->b_force ) return VLC_EGENERIC;
}
- STANDARD_DEMUX_INIT; p_sys = p_demux->p_sys;
+ DEMUX_INIT_COMMON(); p_sys = p_demux->p_sys;
memset( p_sys, 0, sizeof( demux_sys_t ) );
p_sys->p_es = 0;
p_sys->b_start = VLC_TRUE;
if( HeaderCheck( header ) )
{
int i_xing, i_skip;
- uint8_t *p_xing;
+ const uint8_t *p_xing;
if( ( i_xing = stream_Peek( p_demux->s, &p_xing, 1024 ) ) < 21 )
return VLC_SUCCESS; /* No header */
demux_sys_t *p_sys;
vlc_bool_t b_forced = VLC_FALSE;
- uint8_t *p_peek;
+ const uint8_t *p_peek;
es_format_t fmt;
return VLC_EGENERIC;
}
- if( !strncmp( p_demux->psz_demux, "mpgv", 4 ) )
- {
+ if( p_demux->b_force )
b_forced = VLC_TRUE;
- }
if( p_peek[0] != 0x00 || p_peek[1] != 0x00 || p_peek[2] != 0x01 )
{
static int DemuxOpen( vlc_object_t * p_this )
{
demux_t *p_demux = (demux_t *)p_this;
- byte_t *p_peek;
+ const byte_t *p_peek;
int i_size;
/* Lets check the content to see if this is a NSC file */
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_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys;
- uint8_t *p_peek;
+ const uint8_t *p_peek;
frame_header_t fh;
vlc_bool_t b_extended;
/* Check if we are dealing with an ogg stream */
if( stream_Peek( p_demux->s, &p_peek, 4 ) < 4 ) return VLC_EGENERIC;
- if( strcmp( p_demux->psz_demux, "ogg" ) && memcmp( p_peek, "OggS", 4 ) )
+ if( !p_demux->b_force && memcmp( p_peek, "OggS", 4 ) )
{
return VLC_EGENERIC;
}
int E_(Import_ASX)( vlc_object_t *p_this )
{
demux_t *p_demux = (demux_t *)p_this;
- uint8_t *p_peek;
+ const uint8_t *p_peek;
CHECK_PEEK( p_peek, 10 );
// skip over possible leading empty lines and empty spaces
input_ItemAddSubItem( p_current_input, p_entry );
}
- /* cleanup entry */
- FREENULL( psz_href )
- FREENULL( psz_title_entry )
- FREENULL( psz_base_entry )
- FREENULL( psz_artist_entry )
- FREENULL( psz_copyright_entry )
- FREENULL( psz_moreinfo_entry )
- FREENULL( psz_abstract_entry )
+ /* cleanup entry */;
+ FREENULL( psz_href );
+ FREENULL( psz_title_entry );
+ FREENULL( psz_base_entry );
+ FREENULL( psz_artist_entry );
+ FREENULL( psz_copyright_entry );
+ FREENULL( psz_moreinfo_entry );
+ FREENULL( psz_abstract_entry );
b_entry = VLC_FALSE;
}
else if( !strncasecmp( psz_parse, "<Entry", 6 ) )
int E_(Import_DVB)( vlc_object_t *p_this )
{
demux_t *p_demux = (demux_t *)p_this;
- uint8_t *p_peek;
+ const uint8_t *p_peek;
int i_peek;
vlc_bool_t b_valid = VLC_FALSE;
{
demux_t *p_demux = (demux_t *)p_this;
int i_peek, i, b_found = VLC_FALSE;
- byte_t *p_peek;
+ const byte_t *p_peek;
i_peek = stream_Peek( p_demux->s, &p_peek, MAX_LINE );
if( !b_found ) return VLC_EGENERIC;
- STANDARD_DEMUX_INIT_MSG( "using Google Video Playlist (gvp) import" )
+ STANDARD_DEMUX_INIT_MSG( "using Google Video Playlist (gvp) import" );
p_demux->pf_control = Control;
p_demux->pf_demux = Demux;
MALLOC_ERR( p_demux->p_sys, demux_sys_t );
&& !strcasecmp( psz_file + strlen( "VTS_00_0" ) , ".IFO" ) ) ) )
{
int i_peek;
- byte_t *p_peek;
+ const byte_t *p_peek;
i_peek = stream_Peek( p_demux->s, &p_peek, 8 );
if( strncmp( p_peek, "DVDVIDEO", 8 ) )
int E_(Import_M3U)( vlc_object_t *p_this )
{
demux_t *p_demux = (demux_t *)p_this;
- uint8_t *p_peek;
+ const uint8_t *p_peek;
CHECK_PEEK( p_peek, 8 );
if(! ( POKE( p_peek, "#EXTM3U", 7 ) || POKE( p_peek, "RTSPtext", 8 ) ||
int E_(Import_PLS)( vlc_object_t *p_this )
{
demux_t *p_demux = (demux_t *)p_this;
- uint8_t *p_peek;
+ const uint8_t *p_peek;
CHECK_PEEK( p_peek, 10 );
if( POKE( p_peek, "[playlist]", 10 ) || POKE( p_peek, "[Reference]", 10 ) ||
int E_(Import_SGIMB)( vlc_object_t * p_this )
{
demux_t *p_demux = (demux_t *)p_this;
- byte_t *p_peek;
+ const byte_t *p_peek;
int i_size;
/* Lets check the content to see if this is a sgi mediabase file */
input_ItemAddSubItem( p_sys->p_current_input, p_input );
FREENULL( psz_name );
- FREENULL( psz_mt )
- FREENULL( psz_id )
- FREENULL( psz_br )
- FREENULL( psz_genre )
- FREENULL( psz_ct )
- FREENULL( psz_lc )
- FREENULL( psz_rt )
+ FREENULL( psz_mt );
+ FREENULL( psz_id );
+ FREENULL( psz_br );
+ FREENULL( psz_genre );
+ FREENULL( psz_ct );
+ FREENULL( psz_lc );
+ FREENULL( psz_rt );
}
free( psz_eltname );
break;
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, 4 ) < 4 )
{
*/
static int ps_pkt_resynch( stream_t *s, uint32_t *pi_code )
{
- uint8_t *p_peek;
+ const uint8_t *p_peek;
int i_peek;
int i_skip;
static block_t *ps_pkt_read( stream_t *s, uint32_t i_code )
{
- uint8_t *p_peek;
+ const uint8_t *p_peek;
int i_peek = stream_Peek( s, &p_peek, 14 );
int i_size = ps_pkt_size( p_peek, i_peek );
/* return the size of the next packet
* XXX you need to give him at least 14 bytes (and it need to start as a
* valid packet) */
-static inline int ps_pkt_size( uint8_t *p, int i_peek )
+static inline int ps_pkt_size( const uint8_t *p, int i_peek )
{
if( p[3] == 0xb9 && i_peek >= 4 )
{
demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys;
es_format_t fmt;
- uint8_t *p_peek;
+ const uint8_t *p_peek;
if( stream_Peek( p_demux->s, &p_peek, 5 ) < 5 ) return VLC_EGENERIC;
if( p_peek[0] != 'A' || p_peek[1] != 'V' || p_peek[4] != 0x55 )
{
/* In case we had forced this demuxer we try to resynch */
- if( strcasecmp( p_demux->psz_demux, "pva" ) || 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 *p_peek;
+ const uint8_t *p_peek;
int i_size;
block_t *p_frame;
int64_t i_pts;
*****************************************************************************/
static int ReSynch( demux_t *p_demux )
{
- uint8_t *p_peek;
+ const uint8_t *p_peek;
int i_skip;
int i_peek;
uint32_t i_dword;
dv_header_t dv_header;
dv_id_t dv_id;
- char *psz_ext;
/* It isn't easy to recognize a raw DV stream. The chances that we'll
* mistake a stream from another type for a raw DV stream are too high, so
* it is possible to force this demux. */
/* Check for DV file extension */
- psz_ext = strrchr( p_demux->psz_path, '.' );
- if( ( !psz_ext || strcasecmp( psz_ext, ".dv") ) &&
- strcmp(p_demux->psz_demux, "rawdv") )
- {
+ if( !demux2_IsPathExtension( p_demux, ".dv" ) && !p_demux->b_force )
return VLC_EGENERIC;
- }
if( stream_Peek( p_demux->s, &p_peek, DV_PAL_FRAME_SIZE ) <
DV_NTSC_FRAME_SIZE )
break;
}
}
- if( ( !b_valid ) && strcmp(p_demux->psz_demux, "rawvid") )
- {
+ if( !b_valid && !p_demux->b_force )
return VLC_EGENERIC;
- }
/* Set p_input field */
p_demux->pf_demux = Demux;
int (*pf_read)( demux_t *, subtitle_t* );
int i, i_max;
- if( strcmp( p_demux->psz_demux, "subtitle" ) )
+ if( !p_demux->b_force )
{
msg_Dbg( p_demux, "subtitle demux discarded" );
return VLC_EGENERIC;
}
if( i_sync >= TS_PACKET_SIZE_MAX && !b_topfield )
{
- if( strcmp( p_demux->psz_demux, "ts" ) ) return VLC_EGENERIC;
+ if( !p_demux->b_force )
+ return VLC_EGENERIC;
msg_Warn( p_demux, "this does not look like a TS stream, continuing" );
}
{
i_packet_size = TS_PACKET_SIZE_204;
}
- else if( !strcmp( p_demux->psz_demux, "ts" ) )
+ else if( p_demux->b_force )
{
i_packet_size = TS_PACKET_SIZE_188;
}
demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys;
es_format_t fmt;
- uint8_t *p_peek;
+ const uint8_t *p_peek;
uint8_t p_header[22];
uint8_t *p_seektable;
int i_seektable_size = 0, i;
demux_t *p_demux = (demux_t *)p_this;
demux_sys_t *p_sys;
es_format_t fmt;
- uint8_t *p_peek;
+ const uint8_t *p_peek;
/* peek at the first 12 bytes. */
/* for TY streams, they're always the same */
/* doesn't look like a TY file... */
char *psz_ext = strrchr(p_demux->psz_path, '.');
- if( !p_demux->b_force &&
- (!psz_ext || strcasecmp(psz_ext, ".ty")) ) return VLC_EGENERIC;
+ if( !p_demux->b_force && !demux2_IsPathExtension( p_demux, ".ty" ) )
+ return VLC_EGENERIC;
msg_Warn( p_demux, "this does not look like a TY file, "
"continuing anyway..." );
}
{
demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys;
- uint8_t *p_peek;
+ const uint8_t *p_peek;
vlc_value_t val;
if( stream_Peek( p_demux->s, &p_peek, 5 ) < 5 ) return VLC_EGENERIC;
demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys;
xa_header_t p_xa;
- uint8_t *p_buf;
+ const uint8_t *p_buf;
/* XA file heuristic */
if( stream_Peek( p_demux->s, &p_buf, sizeof( p_xa ) )
vlc_bool_t input_MetaSatisfied( playlist_t *p_playlist, input_item_t *p_item,
uint32_t *pi_mandatory, uint32_t *pi_optional )
{
- (void)p_playlist;
+ VLC_UNUSED(p_playlist);
*pi_mandatory = VLC_META_ENGINE_TITLE | VLC_META_ENGINE_ARTIST;
uint32_t i_meta = input_CurrentMetaFlags( p_item->p_meta );
void *p_data )
{
input_thread_t *p_input = (input_thread_t*)p_this;
- (void)psz_cmd; (void)oldval; (void)p_data;
+ VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval); VLC_UNUSED(p_data);
if( newval.i_int == PLAYING_S || newval.i_int == PAUSE_S )
{
vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
input_thread_t *p_input = (input_thread_t*)p_this;
- (void)oldval; (void)p_data;
+ VLC_UNUSED(oldval); VLC_UNUSED(p_data);
/* Problem with this way: the "rate" variable is update after the input thread do the change */
if( !strcmp( psz_cmd, "rate-slower" ) )
{
input_thread_t *p_input = (input_thread_t*)p_this;
vlc_value_t val, length;
- (void)oldval; (void)p_data;
+ VLC_UNUSED(oldval); VLC_UNUSED(p_data);
if( !strcmp( psz_cmd, "position-offset" ) )
{
{
input_thread_t *p_input = (input_thread_t*)p_this;
vlc_value_t val, length;
- (void)oldval; (void)p_data;
+ VLC_UNUSED(oldval); VLC_UNUSED(p_data);
if( !strcmp( psz_cmd, "time-offset" ) )
{
void *p_data )
{
input_thread_t *p_input = (input_thread_t*)p_this;
- (void)psz_cmd; (void)oldval; (void)p_data;
+ VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval); VLC_UNUSED(p_data);
input_ControlPush( p_input, INPUT_CONTROL_SET_PROGRAM, &newval );
{
input_thread_t *p_input = (input_thread_t*)p_this;
vlc_value_t val, count;
- (void)oldval; (void)p_data;
+ VLC_UNUSED(oldval); VLC_UNUSED(p_data);
if( !strcmp( psz_cmd, "next-title" ) )
{
{
input_thread_t *p_input = (input_thread_t*)p_this;
vlc_value_t val, count;
- (void)oldval; (void)p_data;
+ VLC_UNUSED(oldval); VLC_UNUSED(p_data);
if( !strcmp( psz_cmd, "next-chapter" ) )
{
{
input_thread_t *p_input = (input_thread_t*)p_this;
vlc_value_t val;
- (void)psz_cmd; (void)oldval;
+ VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval);
/* Issue a title change */
val.i_int = (intptr_t)p_data;
vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
input_thread_t *p_input = (input_thread_t*)p_this;
- (void)oldval; (void)p_data;
+ VLC_UNUSED(oldval); VLC_UNUSED(p_data);
if( newval.i_int < 0 )
{
vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
input_thread_t *p_input = (input_thread_t*)p_this;
- (void)oldval; (void)p_data;
+ VLC_UNUSED(oldval); VLC_UNUSED(p_data);
if( !strcmp( psz_cmd, "audio-delay" ) )
{
void *p_data )
{
input_thread_t *p_input = (input_thread_t*)p_this;
- (void)psz_cmd; (void)oldval; (void)p_data;
+ VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval); VLC_UNUSED(p_data);
input_ControlPush( p_input, INPUT_CONTROL_SET_BOOKMARK, &newval );