From 3f07af6acdd8a0b0ddbd2c33b79039bf8ec8a822 Mon Sep 17 00:00:00 2001 From: Laurent Aimar Date: Sun, 30 Sep 2007 15:40:34 +0000 Subject: [PATCH] =?utf8?q?Added=20const=20wheen=20needed=20for=20stream=5F?= =?utf8?q?Peek=20(demuxer/access)=20Made=20demux2=5FIsPathExtension=20case?= =?utf8?q?=20insensitive.=20Used=20demux2=5FIsPathExtension/p=5Fdemux->b?= =?utf8?q?=5Fforce=20when=20appropriate=20Fixed=20a=20regression=20in=20fl?= =?utf8?q?ac=20demuxer=20(segfault=20when=20reading=20meta=20data)=20Added?= =?utf8?q?=20a=20VLC=5FUNUSED(x)=20macro=20to=20avoid=20seeing=20ugly=20(v?= =?utf8?q?oid)x=20around=20the=20code.=20Improved=20a=20bit=20a=20few=20vl?= =?utf8?q?c=5Fcommon.h=20macro=20(do=20{}=C2=A0while(0))?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- include/vlc_common.h | 25 ++++++++++++++----------- include/vlc_demux.h | 28 +++++++++++----------------- modules/access/dvdnav.c | 2 +- modules/access/dvdread.c | 2 +- modules/access/fake.c | 2 +- modules/demux/a52.c | 6 ++---- modules/demux/aiff.c | 4 ++-- modules/demux/au.c | 2 +- modules/demux/avi/avi.c | 4 ++-- modules/demux/avi/libavi.c | 8 ++++---- modules/demux/cdg.c | 4 +--- modules/demux/demuxdump.c | 2 +- modules/demux/dts.c | 7 +++---- modules/demux/flac.c | 3 +-- modules/demux/gme.cpp | 2 +- modules/demux/mjpeg.c | 10 ++++------ modules/demux/mod.c | 6 +++--- modules/demux/mp4/libmp4.c | 12 ++++++------ modules/demux/mpc.c | 16 +++++----------- modules/demux/mpeg/h264.c | 2 +- modules/demux/mpeg/m4a.c | 15 +++------------ modules/demux/mpeg/m4v.c | 2 +- modules/demux/mpeg/mpga.c | 16 +++++----------- modules/demux/mpeg/mpgv.c | 6 ++---- modules/demux/nsc.c | 2 +- modules/demux/nsv.c | 4 +--- modules/demux/nuv.c | 2 +- modules/demux/ogg.c | 2 +- modules/demux/playlist/asx.c | 18 +++++++++--------- modules/demux/playlist/dvb.c | 2 +- modules/demux/playlist/gvp.c | 4 ++-- modules/demux/playlist/ifo.c | 2 +- modules/demux/playlist/m3u.c | 2 +- modules/demux/playlist/pls.c | 2 +- modules/demux/playlist/sgimb.c | 2 +- modules/demux/playlist/shoutcast.c | 14 +++++++------- modules/demux/ps.c | 6 +++--- modules/demux/ps.h | 2 +- modules/demux/pva.c | 10 ++++------ modules/demux/rawdv.c | 7 +------ modules/demux/rawvid.c | 4 +--- modules/demux/subtitle.c | 2 +- modules/demux/ts.c | 5 +++-- modules/demux/tta.c | 2 +- modules/demux/ty.c | 6 +++--- modules/demux/vc1.c | 2 +- modules/demux/xa.c | 2 +- src/input/meta.c | 2 +- src/input/var.c | 22 +++++++++++----------- 49 files changed, 135 insertions(+), 179 deletions(-) diff --git a/include/vlc_common.h b/include/vlc_common.h index 2953193036..923586de31 100644 --- a/include/vlc_common.h +++ b/include/vlc_common.h @@ -668,23 +668,23 @@ static inline uint8_t clip_uint8_vlc( int32_t 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 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) @@ -814,6 +814,9 @@ static inline void _SetQWBE( uint8_t *p, uint64_t i_qw ) # 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 diff --git a/include/vlc_demux.h b/include/vlc_demux.h index b5a834d756..6176013fd3 100644 --- a/include/vlc_demux.h +++ b/include/vlc_demux.h @@ -128,7 +128,7 @@ VLC_EXPORT( int, demux2_vaControlHelper, ( stream_t *, int64_t i_start, in 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; } @@ -140,24 +140,21 @@ static inline vlc_bool_t demux2_IsForced( demux_t *p_demux, const char *psz_name 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; \ @@ -169,7 +166,7 @@ static inline vlc_bool_t demux2_IsForced( demux_t *p_demux, const char *psz_name 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; \ @@ -185,10 +182,7 @@ static inline vlc_bool_t demux2_IsForced( demux_t *p_demux, const char *psz_name 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 ); \ diff --git a/modules/access/dvdnav.c b/modules/access/dvdnav.c index 6e47a99948..03daa723ec 100644 --- a/modules/access/dvdnav.c +++ b/modules/access/dvdnav.c @@ -209,7 +209,7 @@ static int Open( vlc_object_t *p_this ) 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 ); diff --git a/modules/access/dvdread.c b/modules/access/dvdread.c index f34ad43e2b..7307216388 100644 --- a/modules/access/dvdread.c +++ b/modules/access/dvdread.c @@ -247,7 +247,7 @@ static int Open( vlc_object_t *p_this ) 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; diff --git a/modules/access/fake.c b/modules/access/fake.c index 34532b31f4..2e29b7d550 100644 --- a/modules/access/fake.c +++ b/modules/access/fake.c @@ -97,7 +97,7 @@ static int Open( vlc_object_t *p_this ) 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; diff --git a/modules/demux/a52.c b/modules/demux/a52.c index c19831d671..b05bd4f7f2 100644 --- a/modules/demux/a52.c +++ b/modules/demux/a52.c @@ -129,10 +129,8 @@ static int Open( vlc_object_t * p_this ) 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, " @@ -140,7 +138,7 @@ static int Open( vlc_object_t * p_this ) } /* 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; diff --git a/modules/demux/aiff.c b/modules/demux/aiff.c index 3dfcb76ae3..d1871a08d2 100644 --- a/modules/demux/aiff.c +++ b/modules/demux/aiff.c @@ -74,7 +74,7 @@ static int Demux ( demux_t *p_demux ); 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]; @@ -112,7 +112,7 @@ static int Open( vlc_object_t *p_this ) 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; diff --git a/modules/demux/au.c b/modules/demux/au.c index 187825cd2a..36f38ef7b0 100644 --- a/modules/demux/au.c +++ b/modules/demux/au.c @@ -127,7 +127,7 @@ static int Open( vlc_object_t *p_this ) 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] ); diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c index 02c31f7527..ff4092bc8c 100644 --- a/modules/demux/avi/avi.c +++ b/modules/demux/avi/avi.c @@ -225,7 +225,7 @@ static int Open( vlc_object_t * p_this ) 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; @@ -1898,7 +1898,7 @@ static void AVI_ParseStreamHeader( vlc_fourcc_t i_id, ****************************************************************************/ 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 ) { diff --git a/modules/demux/avi/libavi.c b/modules/demux/avi/libavi.c index 678e060277..8ef4115638 100644 --- a/modules/demux/avi/libavi.c +++ b/modules/demux/avi/libavi.c @@ -31,7 +31,7 @@ #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] ); } @@ -46,7 +46,7 @@ void _AVI_ChunkFree( stream_t *, avi_chunk_t *p_chk ); ****************************************************************************/ 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 ) ); @@ -111,7 +111,7 @@ static int AVI_NextChunk( stream_t *s, avi_chunk_t *p_chk ) 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 ) @@ -471,7 +471,7 @@ static void AVI_ChunkFree_idx1( avi_chunk_t *p_chk ) { p_chk->idx1.i_entry_count = 0; p_chk->idx1.i_entry_max = 0; - FREENULL( p_chk->idx1.entry ) + FREENULL( p_chk->idx1.entry ); } diff --git a/modules/demux/cdg.c b/modules/demux/cdg.c index f9e2e77769..de685a5192 100644 --- a/modules/demux/cdg.c +++ b/modules/demux/cdg.c @@ -73,9 +73,7 @@ static int Open( vlc_object_t * p_this ) /* 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 diff --git a/modules/demux/demuxdump.c b/modules/demux/demuxdump.c index 80efc3a079..7023ffbd9a 100644 --- a/modules/demux/demuxdump.c +++ b/modules/demux/demuxdump.c @@ -91,7 +91,7 @@ static int Open( vlc_object_t * p_this ) 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 ); diff --git a/modules/demux/dts.c b/modules/demux/dts.c index c4ea299cdd..d448e07a1c 100644 --- a/modules/demux/dts.c +++ b/modules/demux/dts.c @@ -140,16 +140,15 @@ static int Open( vlc_object_t * p_this ) 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" ); diff --git a/modules/demux/flac.c b/modules/demux/flac.c index 173fb8103c..bb17b7ba67 100644 --- a/modules/demux/flac.c +++ b/modules/demux/flac.c @@ -620,7 +620,7 @@ static void ParseComment( demux_t *p_demux, const uint8_t *p_data, int i_data ) #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; \ @@ -630,7 +630,6 @@ static void ParseComment( demux_t *p_demux, const uint8_t *p_data, int i_data ) } \ 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 ) diff --git a/modules/demux/gme.cpp b/modules/demux/gme.cpp index 15f33c1825..ddd86b8724 100644 --- a/modules/demux/gme.cpp +++ b/modules/demux/gme.cpp @@ -114,7 +114,7 @@ static int Open( vlc_object_t *p_this ) 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; diff --git a/modules/demux/mjpeg.c b/modules/demux/mjpeg.c index ed3deba3c4..ec5e5c038e 100644 --- a/modules/demux/mjpeg.c +++ b/modules/demux/mjpeg.c @@ -74,7 +74,7 @@ struct demux_sys_t 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; }; @@ -117,7 +117,7 @@ static vlc_bool_t Peek( demux_t *p_demux, vlc_bool_t b_first ) 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; @@ -300,7 +300,6 @@ static int Open( vlc_object_t * p_this ) 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 ) ); @@ -342,9 +341,8 @@ static int Open( vlc_object_t * p_this ) /* 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) diff --git a/modules/demux/mod.c b/modules/demux/mod.c index be77604b24..813294d01e 100644 --- a/modules/demux/mod.c +++ b/modules/demux/mod.c @@ -129,14 +129,14 @@ static int Open( vlc_object_t *p_this ) { 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; diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c index d1a35bd88b..68b33247f2 100644 --- a/modules/demux/mp4/libmp4.c +++ b/modules/demux/mp4/libmp4.c @@ -703,7 +703,7 @@ static int MP4_ReadBox_url( stream_t *p_stream, MP4_Box_t *p_box ) 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 ) @@ -1552,7 +1552,7 @@ static int MP4_ReadBox_stss( 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 ) @@ -1589,8 +1589,8 @@ 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 ); } @@ -1621,7 +1621,7 @@ static int MP4_ReadBox_stdp( stream_t *p_stream, MP4_Box_t *p_box ) 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 ) @@ -1970,7 +1970,7 @@ static int MP4_ReadBox_rdrf( 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 ); } diff --git a/modules/demux/mpc.c b/modules/demux/mpc.c index d359cb74a1..d34ddba908 100644 --- a/modules/demux/mpc.c +++ b/modules/demux/mpc.c @@ -97,7 +97,7 @@ static int Open( vlc_object_t * p_this ) 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 ) @@ -111,18 +111,12 @@ static int Open( vlc_object_t * p_this ) 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; } } diff --git a/modules/demux/mpeg/h264.c b/modules/demux/mpeg/h264.c index 788156f085..414addfa9e 100644 --- a/modules/demux/mpeg/h264.c +++ b/modules/demux/mpeg/h264.c @@ -74,7 +74,7 @@ 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; vlc_value_t val; if( stream_Peek( p_demux->s, &p_peek, 5 ) < 5 ) return VLC_EGENERIC; diff --git a/modules/demux/mpeg/m4a.c b/modules/demux/mpeg/m4a.c index f7c7d09cd4..049e9a8782 100644 --- a/modules/demux/mpeg/m4a.c +++ b/modules/demux/mpeg/m4a.c @@ -78,23 +78,14 @@ static int Open( vlc_object_t * p_this ) 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 ) diff --git a/modules/demux/mpeg/m4v.c b/modules/demux/mpeg/m4v.c index 12e12bb5f5..b86a5f7175 100644 --- a/modules/demux/mpeg/m4v.c +++ b/modules/demux/mpeg/m4v.c @@ -74,7 +74,7 @@ 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; vlc_value_t val; if( stream_Peek( p_demux->s, &p_peek, 4 ) < 4 ) return VLC_EGENERIC; diff --git a/modules/demux/mpeg/mpga.c b/modules/demux/mpeg/mpga.c index bbe5d44353..a7c9f57536 100644 --- a/modules/demux/mpeg/mpga.c +++ b/modules/demux/mpeg/mpga.c @@ -120,18 +120,12 @@ static int Open( vlc_object_t * p_this ) 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; @@ -156,7 +150,7 @@ static int Open( vlc_object_t * p_this ) 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; @@ -171,7 +165,7 @@ static int Open( vlc_object_t * p_this ) 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 */ diff --git a/modules/demux/mpeg/mpgv.c b/modules/demux/mpeg/mpgv.c index 0757bf0b50..204307fe5f 100644 --- a/modules/demux/mpeg/mpgv.c +++ b/modules/demux/mpeg/mpgv.c @@ -70,7 +70,7 @@ static int Open( vlc_object_t * p_this ) 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; @@ -80,10 +80,8 @@ static int Open( vlc_object_t * p_this ) 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 ) { diff --git a/modules/demux/nsc.c b/modules/demux/nsc.c index 9a78cd3ed0..509728c4e1 100644 --- a/modules/demux/nsc.c +++ b/modules/demux/nsc.c @@ -264,7 +264,7 @@ static char *nscdec( vlc_object_t *p_demux, char* p_encoded ) 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 */ diff --git a/modules/demux/nsv.c b/modules/demux/nsv.c index d864b83062..236332ac93 100644 --- a/modules/demux/nsv.c +++ b/modules/demux/nsv.c @@ -93,10 +93,8 @@ static int Open( vlc_object_t *p_this ) 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 */ diff --git a/modules/demux/nuv.c b/modules/demux/nuv.c index cfadb583b7..bdc02a3401 100644 --- a/modules/demux/nuv.c +++ b/modules/demux/nuv.c @@ -192,7 +192,7 @@ 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; frame_header_t fh; vlc_bool_t b_extended; diff --git a/modules/demux/ogg.c b/modules/demux/ogg.c index fb82d01fe3..83271d0517 100644 --- a/modules/demux/ogg.c +++ b/modules/demux/ogg.c @@ -186,7 +186,7 @@ static int Open( vlc_object_t * p_this ) /* 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; } diff --git a/modules/demux/playlist/asx.c b/modules/demux/playlist/asx.c index 40ddbfbe4b..4e76dba18a 100644 --- a/modules/demux/playlist/asx.c +++ b/modules/demux/playlist/asx.c @@ -184,7 +184,7 @@ static int ParseTime(char *s, size_t i_strlen) 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 @@ -529,14 +529,14 @@ static int Demux( demux_t *p_demux ) 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, "s, &p_peek, MAX_LINE ); @@ -90,7 +90,7 @@ int E_(Import_GVP)( vlc_object_t *p_this ) 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 ); diff --git a/modules/demux/playlist/ifo.c b/modules/demux/playlist/ifo.c index 88be49c38f..9c8ab79bb9 100644 --- a/modules/demux/playlist/ifo.c +++ b/modules/demux/playlist/ifo.c @@ -54,7 +54,7 @@ int E_(Import_IFO)( vlc_object_t *p_this ) && !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 ) ) diff --git a/modules/demux/playlist/m3u.c b/modules/demux/playlist/m3u.c index 93230183cb..7d2a436b9f 100644 --- a/modules/demux/playlist/m3u.c +++ b/modules/demux/playlist/m3u.c @@ -50,7 +50,7 @@ static void parseEXTINF( char *psz_string, char **ppsz_artist, char **ppsz_name, 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 ) || diff --git a/modules/demux/playlist/pls.c b/modules/demux/playlist/pls.c index d499db0bad..caf5c36655 100644 --- a/modules/demux/playlist/pls.c +++ b/modules/demux/playlist/pls.c @@ -47,7 +47,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args ); 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 ) || diff --git a/modules/demux/playlist/sgimb.c b/modules/demux/playlist/sgimb.c index 50f654062e..4e284e2edb 100644 --- a/modules/demux/playlist/sgimb.c +++ b/modules/demux/playlist/sgimb.c @@ -134,7 +134,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args ); 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 */ diff --git a/modules/demux/playlist/shoutcast.c b/modules/demux/playlist/shoutcast.c index 616fc33e2b..e54202ce41 100644 --- a/modules/demux/playlist/shoutcast.c +++ b/modules/demux/playlist/shoutcast.c @@ -425,13 +425,13 @@ static int DemuxStation( demux_t *p_demux ) 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; diff --git a/modules/demux/ps.c b/modules/demux/ps.c index 94e78256ff..7e50a49e70 100644 --- a/modules/demux/ps.c +++ b/modules/demux/ps.c @@ -98,7 +98,7 @@ static int OpenCommon( vlc_object_t *p_this, vlc_bool_t b_force ) 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 ) { @@ -502,7 +502,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) */ 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; @@ -545,7 +545,7 @@ static int ps_pkt_resynch( stream_t *s, uint32_t *pi_code ) 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 ); diff --git a/modules/demux/ps.h b/modules/demux/ps.h index 6dfd96b1af..b997f7acf8 100644 --- a/modules/demux/ps.h +++ b/modules/demux/ps.h @@ -246,7 +246,7 @@ static inline int ps_pkt_id( block_t *p_pkt ) /* 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 ) { diff --git a/modules/demux/pva.c b/modules/demux/pva.c index bc255fef9a..c09ecdadc7 100644 --- a/modules/demux/pva.c +++ b/modules/demux/pva.c @@ -77,16 +77,14 @@ static int Open( vlc_object_t *p_this ) 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 */ @@ -133,7 +131,7 @@ static int Demux( demux_t *p_demux ) { 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; @@ -337,7 +335,7 @@ 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; diff --git a/modules/demux/rawdv.c b/modules/demux/rawdv.c index 648772c886..f08ea420d4 100644 --- a/modules/demux/rawdv.c +++ b/modules/demux/rawdv.c @@ -134,7 +134,6 @@ static int Open( vlc_object_t * p_this ) 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 @@ -142,12 +141,8 @@ static int Open( vlc_object_t * p_this ) * 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 ) diff --git a/modules/demux/rawvid.c b/modules/demux/rawvid.c index 7186b984d6..fcd8c6d8d0 100644 --- a/modules/demux/rawvid.c +++ b/modules/demux/rawvid.c @@ -154,10 +154,8 @@ static int Open( vlc_object_t * p_this ) 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; diff --git a/modules/demux/subtitle.c b/modules/demux/subtitle.c index 4dc0b299c6..31fed302ca 100644 --- a/modules/demux/subtitle.c +++ b/modules/demux/subtitle.c @@ -182,7 +182,7 @@ static int Open ( vlc_object_t *p_this ) 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; diff --git a/modules/demux/ts.c b/modules/demux/ts.c index 9653b57a6d..3c37288757 100644 --- a/modules/demux/ts.c +++ b/modules/demux/ts.c @@ -412,7 +412,8 @@ static int Open( vlc_object_t *p_this ) } 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" ); } @@ -450,7 +451,7 @@ static int Open( vlc_object_t *p_this ) { 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; } diff --git a/modules/demux/tta.c b/modules/demux/tta.c index bbf0898537..20d7d7e829 100644 --- a/modules/demux/tta.c +++ b/modules/demux/tta.c @@ -79,7 +79,7 @@ static int Open( vlc_object_t * p_this ) 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; diff --git a/modules/demux/ty.c b/modules/demux/ty.c index f1fa72bb4b..77d90b429c 100644 --- a/modules/demux/ty.c +++ b/modules/demux/ty.c @@ -151,7 +151,7 @@ static int TyOpen(vlc_object_t *p_this) 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 */ @@ -165,8 +165,8 @@ static int TyOpen(vlc_object_t *p_this) /* 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..." ); } diff --git a/modules/demux/vc1.c b/modules/demux/vc1.c index d5e1a3d2ed..b96b58e1aa 100644 --- a/modules/demux/vc1.c +++ b/modules/demux/vc1.c @@ -73,7 +73,7 @@ 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; vlc_value_t val; if( stream_Peek( p_demux->s, &p_peek, 5 ) < 5 ) return VLC_EGENERIC; diff --git a/modules/demux/xa.c b/modules/demux/xa.c index 107b0abb29..f41eef0fc1 100644 --- a/modules/demux/xa.c +++ b/modules/demux/xa.c @@ -83,7 +83,7 @@ static int Open( vlc_object_t * p_this ) 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 ) ) diff --git a/src/input/meta.c b/src/input/meta.c index 6b2de374ca..cfe0125ce3 100644 --- a/src/input/meta.c +++ b/src/input/meta.c @@ -70,7 +70,7 @@ static int __input_FindArtInCache( vlc_object_t *, input_item_t *p_item ); 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 ); diff --git a/src/input/var.c b/src/input/var.c index 2cff5be138..e03e60047c 100644 --- a/src/input/var.c +++ b/src/input/var.c @@ -476,7 +476,7 @@ static int StateCallback( vlc_object_t *p_this, char const *psz_cmd, 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 ) { @@ -491,7 +491,7 @@ static int RateCallback( vlc_object_t *p_this, char const *psz_cmd, 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" ) ) @@ -516,7 +516,7 @@ static int PositionCallback( vlc_object_t *p_this, char const *psz_cmd, { 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" ) ) { @@ -549,7 +549,7 @@ static int TimeCallback( vlc_object_t *p_this, char const *psz_cmd, { 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" ) ) { @@ -581,7 +581,7 @@ static int ProgramCallback( vlc_object_t *p_this, char const *psz_cmd, 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 ); @@ -594,7 +594,7 @@ static int TitleCallback( vlc_object_t *p_this, char const *psz_cmd, { 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" ) ) { @@ -627,7 +627,7 @@ static int SeekpointCallback( vlc_object_t *p_this, char const *psz_cmd, { 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" ) ) { @@ -660,7 +660,7 @@ static int NavigationCallback( vlc_object_t *p_this, char const *psz_cmd, { 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; @@ -680,7 +680,7 @@ static int ESCallback( vlc_object_t *p_this, char const *psz_cmd, 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 ) { @@ -709,7 +709,7 @@ static int EsDelayCallback ( vlc_object_t *p_this, char const *psz_cmd, 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" ) ) { @@ -730,7 +730,7 @@ static int BookmarkCallback( vlc_object_t *p_this, char const *psz_cmd, 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 ); -- 2.39.2