Commit d3081fff authored by Laurent Aimar's avatar Laurent Aimar

Force to specify options flags in input_item_New*.

It previously assumed TRUSTED.
No functionnal/security changes in this commit.
parent 3b2c8463
......@@ -177,9 +177,13 @@ VLC_EXPORT( char *, input_item_GetInfo, ( input_item_t *p_i, const char *psz_cat
VLC_EXPORT( int, input_item_AddInfo, ( input_item_t *p_i, const char *psz_cat, const char *psz_name, const char *psz_format, ... ) LIBVLC_FORMAT( 4, 5 ) );
VLC_EXPORT( int, input_item_DelInfo, ( input_item_t *p_i, const char *psz_cat, const char *psz_name ) );
#define input_item_New( a,b,c ) input_item_NewExt( a, b, c, 0, NULL, -1 )
#define input_item_NewExt(a,b,c,d,e,f) __input_item_NewExt( VLC_OBJECT(a),b,c,d,e,f)
VLC_EXPORT( input_item_t *, __input_item_NewExt, (vlc_object_t *, const char *, const char*, int, const char *const *, mtime_t i_duration ) );
VLC_EXPORT( input_item_t *, input_item_NewWithType, ( vlc_object_t *, const char *, const char *e, int, const char *const *, mtime_t i_duration, int ) );
#define input_item_New( a,b,c ) input_item_NewExt( a, b, c, 0, NULL, 0, -1 )
#define input_item_NewExt(a,b,c,d,e,f,g) __input_item_NewExt( VLC_OBJECT(a),b,c,d,e,f,g)
VLC_EXPORT( input_item_t *, __input_item_NewExt, (vlc_object_t *, const char *, const char*, int, const char *const *, unsigned, mtime_t i_duration ) );
/**
* This function creates a new input_item_t with the provided informations.
*/
VLC_EXPORT( input_item_t *, input_item_NewWithType, ( vlc_object_t *, const char *psz_uri, const char *psz_name, int i_options, const char *const *ppsz_options, unsigned i_option_flags, mtime_t i_duration, int i_type ) );
#endif
......@@ -437,7 +437,7 @@ static int GetTracks( access_t *p_access, input_item_t *p_current )
/* Create playlist items */
p_input_item = input_item_NewWithType( VLC_OBJECT( p_access ),
psz_uri, psz_name, 0, NULL, -1,
psz_uri, psz_name, 0, NULL, 0, -1,
ITEM_TYPE_DISC );
input_item_CopyOptions( p_current, p_input_item );
input_item_AddOption( p_input_item, psz_first, VLC_INPUT_OPTION_TRUSTED );
......
......@@ -417,7 +417,7 @@ static int Open( vlc_object_t * p_this )
}
msg_Dbg( p_demux, "adding ref = `%s'", psz_ref );
input_item_t *p_input = input_item_NewExt( p_demux, psz_ref
, NULL, 0, NULL, -1 );
, NULL, 0, NULL, 0, -1 );
input_item_CopyOptions( p_current, p_input );
input_item_AddSubItem( p_current, p_input );
vlc_gc_decref( p_input );
......
......@@ -528,7 +528,8 @@ static int Demux( demux_t *p_demux )
char *psz_current_input_name = input_item_GetName( p_current_input );
if( asprintf( &psz_name, "%d %s", i_entry_count, ( psz_title_entry ? psz_title_entry : psz_current_input_name ) ) != -1 )
{
p_entry = input_item_NewExt( p_demux, psz_href, psz_name, i_options, (const char * const *)ppsz_options, -1 );
p_entry = input_item_NewExt( p_demux, psz_href, psz_name,
i_options, (const char * const *)ppsz_options, VLC_INPUT_OPTION_TRUSTED, -1 );
free( psz_name );
input_item_CopyOptions( p_current_input, p_entry );
while( i_options )
......
......@@ -262,7 +262,7 @@ static int Demux( demux_t *p_demux )
if( !strcmp( psz_elname, "entry" ) )
{
p_input = input_item_NewExt( p_demux, psz_mrl, psz_name,
0, NULL, -1 );
0, NULL, 0, -1 );
if( psz_now )
input_item_SetNowPlaying( p_input, psz_now );
if( psz_genre )
......
......@@ -117,7 +117,7 @@ static int Demux( demux_t *p_demux )
EnsureUTF8( psz_name );
p_input = input_item_NewExt( p_demux, "dvb://", psz_name, 0, NULL, -1 );
p_input = input_item_NewExt( p_demux, "dvb://", psz_name, 0, NULL, 0, -1 );
for( i = 0; i< i_options; i++ )
{
EnsureUTF8( ppsz_options[i] );
......
......@@ -203,7 +203,7 @@ static int Demux( demux_t *p_demux )
else
{
p_input = input_item_NewExt( p_demux,
psz_url, psz_title, 0, NULL, -1 );
psz_url, psz_title, 0, NULL, 0, -1 );
#define SADD_INFO( type, field ) if( field ) { input_item_AddInfo( \
p_input, _("Google Video"), _(type), "%s", field ) ; }
SADD_INFO( "gvp_version", psz_version );
......
......@@ -95,7 +95,7 @@ static int Demux( demux_t *p_demux )
psz_url = (char *)malloc( len+1 );
snprintf( psz_url, len+1, "dvd://%s", p_demux->psz_path );
p_input = input_item_NewExt( p_demux, psz_url, psz_url, 0, NULL, -1 );
p_input = input_item_NewExt( p_demux, psz_url, psz_url, 0, NULL, 0, -1 );
input_item_AddSubItem( p_current_input, p_input );
vlc_gc_decref( p_input );
......
......@@ -381,7 +381,7 @@ static bool parse_track_dict COMPLEX_INTERFACE
msg_Info( p_demux, "Adding '%s'", psz_uri );
p_new_input = input_item_NewExt( p_demux, psz_uri,
NULL, 0, NULL, -1 );
NULL, 0, NULL, 0, -1 );
input_item_AddSubItem( p_input_item, p_new_input );
/* add meta info */
......
......@@ -218,7 +218,7 @@ static int Demux( demux_t *p_demux )
if( !psz_mrl ) goto error;
p_input = input_item_NewExt( p_demux, psz_mrl, psz_name,
0, NULL, i_duration );
0, NULL, 0, i_duration );
if ( psz_artist && *psz_artist )
input_item_SetArtist( p_input, psz_artist );
......
......@@ -160,7 +160,7 @@ static int Demux( demux_t *p_demux )
if( psz_mrl )
{
p_input = input_item_NewExt( p_demux, psz_mrl, psz_name,
0, NULL, -1 );
0, NULL, 0, -1 );
input_item_CopyOptions( p_current_input, p_input );
input_item_AddSubItem( p_current_input, p_input );
vlc_gc_decref( p_input );
......@@ -215,7 +215,7 @@ static int Demux( demux_t *p_demux )
/* Add last object */
if( psz_mrl )
{
p_input = input_item_NewExt( p_demux, psz_mrl, psz_name,0, NULL, -1 );
p_input = input_item_NewExt( p_demux, psz_mrl, psz_name,0, NULL, 0, -1 );
input_item_CopyOptions( p_current_input, p_input );
input_item_AddSubItem( p_current_input, p_input );
vlc_gc_decref( p_input );
......
......@@ -292,7 +292,7 @@ static int Demux( demux_t *p_demux )
return -1;
}
p_input = input_item_NewExt( p_demux, psz_item_mrl,
psz_item_name, 0, NULL, -1 );
psz_item_name, 0, NULL, 0, -1 );
if( p_input == NULL ) break;
#define ADD_INFO( info, field ) \
if( field ) { input_item_AddInfo( p_input, \
......
......@@ -350,7 +350,7 @@ static int Demux( demux_t *p_demux )
else
{
p_input = input_item_NewExt( p_demux,
psz_src, psz_moviename, 0, NULL, -1 );
psz_src, psz_moviename, 0, NULL, 0, -1 );
#define SADD_INFO( type, field ) if( field ) { input_item_AddInfo( \
p_input, "QuickTime Media Link", _(type), "%s", field ) ; }
SADD_INFO( "href", psz_href );
......@@ -360,7 +360,7 @@ static int Demux( demux_t *p_demux )
if( psz_qtnext )
{
p_input = input_item_NewExt( p_demux,
psz_qtnext, NULL, 0, NULL, -1 );
psz_qtnext, NULL, 0, NULL, 0, -1 );
input_item_AddSubItem( p_current_input, p_input );
vlc_gc_decref( p_input );
}
......
......@@ -378,7 +378,7 @@ static int Demux ( demux_t *p_demux )
p_child = input_item_NewWithType( VLC_OBJECT(p_demux), p_sys->psz_uri,
p_sys->psz_name ? p_sys->psz_name : p_sys->psz_uri,
0, NULL, p_sys->i_duration, ITEM_TYPE_NET );
0, NULL, 0, p_sys->i_duration, ITEM_TYPE_NET );
if( !p_child )
{
......
......@@ -229,7 +229,7 @@ static int DemuxGenre( demux_t *p_demux )
psz_name ) != -1 )
{
p_input = input_item_NewExt( p_demux, psz_mrl,
psz_name, 0, NULL, -1 );
psz_name, 0, NULL, 0, -1 );
input_item_CopyOptions( p_sys->p_current_input, p_input );
free( psz_mrl );
input_item_AddSubItem( p_sys->p_current_input, p_input );
......@@ -400,7 +400,7 @@ static int DemuxStation( demux_t *p_demux )
psz_mrl = NULL;
}
p_input = input_item_NewExt( p_demux, psz_mrl,
psz_name , 0, NULL, -1 );
psz_name , 0, NULL, 0, -1 );
free( psz_mrl );
input_item_CopyOptions( p_sys->p_current_input,
......
......@@ -416,7 +416,7 @@ static bool parse_track_node COMPLEX_INTERFACE
{NULL, UNKNOWN_CONTENT, {NULL} }
};
input_item_t *p_new_input = input_item_NewExt( p_demux, NULL, NULL, 0, NULL, -1 );
input_item_t *p_new_input = input_item_NewExt( p_demux, NULL, NULL, 0, NULL, 0, -1 );
if( !p_new_input )
{
......@@ -737,7 +737,7 @@ static bool parse_extension_node COMPLEX_INTERFACE
return false;
}
p_new_input = input_item_NewWithType( VLC_OBJECT( p_demux ),
"vlc://nop", psz_title, 0, NULL, -1,
"vlc://nop", psz_title, 0, NULL, 0, -1,
ITEM_TYPE_DIRECTORY );
if( p_new_input )
{
......
......@@ -438,7 +438,7 @@ static void openDirectory( intf_thread_t *p_intf, bool pl, bool go )
QString mrl = dir.endsWith( "VIDEO_TS", Qt::CaseInsensitive ) ?
"dvd://" : "directory://" + toNativeSeparators( dir );
input_item_t *p_input = input_item_NewExt( THEPL, qtu( mrl ),
NULL, 0, NULL, -1 );
NULL, 0, NULL, 0, -1 );
/* FIXME: playlist_AddInput() can fail */
playlist_AddInput( THEPL, p_input,
......
......@@ -436,6 +436,7 @@ int __vlclua_playlist_add_internal( vlc_object_t *p_this, lua_State *L,
p_input = input_item_NewExt( p_playlist, psz_path,
psz_name, i_options,
(const char **)ppsz_options,
VLC_INPUT_OPTION_TRUSTED,
i_duration );
lua_pop( L, 3 ); /* pop "path name item" */
/* playlist key item */
......
......@@ -175,7 +175,7 @@ static void resolve_callback(
if( psz_uri != NULL )
{
p_input = input_item_NewExt( p_sd, psz_uri, name, 0, NULL, -1 );
p_input = input_item_NewExt( p_sd, psz_uri, name, 0, NULL, 0, -1 );
free( (void *)psz_uri );
}
if( p_input != NULL )
......
......@@ -246,7 +246,7 @@ static void ParseUrls( services_discovery_t *p_sd, char *psz_urls )
INSERT_ELEM( p_sys->ppsz_urls, p_sys->i_urls, p_sys->i_urls,
strdup( psz_urls ) );
p_input = input_item_NewExt( p_sd, psz_urls,
psz_urls, 0, NULL, -1 );
psz_urls, 0, NULL, 0, -1 );
input_item_AddOption( p_input, "demux=podcast", VLC_INPUT_OPTION_TRUSTED );
services_discovery_AddItem( p_sd, p_input, NULL /* no cat */ );
vlc_gc_decref( p_input );
......
......@@ -867,7 +867,7 @@ sap_announce_t *CreateAnnounce( services_discovery_t *p_sd, uint16_t i_hash,
p_input = input_item_NewWithType( VLC_OBJECT(p_sd),
p_sap->p_sdp->psz_uri,
p_sdp->psz_sessionname,
0, NULL, -1, ITEM_TYPE_NET );
0, NULL, 0, -1, ITEM_TYPE_NET );
p_sap->p_item = p_input;
if( !p_input )
{
......
......@@ -188,7 +188,7 @@ static input_item_t * CreateInputItemFromShoutItem( services_discovery_t *p_sd,
/* Create the item */
input_item_t *p_input = input_item_NewExt( p_sd,
p_item->psz_url, _(p_item->psz_name),
0, NULL, -1 );
0, NULL, 0, -1 );
/* Copy options */
for( i = 0; p_item->ppsz_options[i] != NULL; i++ )
......
......@@ -223,7 +223,7 @@ libvlc_media_list_add_file_content( libvlc_media_list_t * p_mlist,
libvlc_media_t * p_md;
p_input_item = input_item_NewExt( p_mlist->p_libvlc_instance->p_libvlc_int, psz_uri,
_("Media Library"), 0, NULL, -1 );
_("Media Library"), 0, NULL, 0, -1 );
if( !p_input_item )
{
......
......@@ -627,10 +627,11 @@ input_item_t *__input_item_NewExt( vlc_object_t *p_obj, const char *psz_uri,
const char *psz_name,
int i_options,
const char *const *ppsz_options,
unsigned i_option_flags,
mtime_t i_duration )
{
return input_item_NewWithType( p_obj, psz_uri, psz_name,
i_options, ppsz_options,
i_options, ppsz_options, i_option_flags,
i_duration, ITEM_TYPE_UNKNOWN );
}
......@@ -639,6 +640,7 @@ input_item_t *input_item_NewWithType( vlc_object_t *p_obj, const char *psz_uri,
const char *psz_name,
int i_options,
const char *const *ppsz_options,
unsigned i_option_flags,
mtime_t i_duration,
int i_type )
{
......@@ -672,7 +674,7 @@ input_item_t *input_item_NewWithType( vlc_object_t *p_obj, const char *psz_uri,
p_input->i_duration = i_duration;
for( int i = 0; i < i_options; i++ )
input_item_AddOption( p_input, ppsz_options[i], VLC_INPUT_OPTION_TRUSTED );
input_item_AddOption( p_input, ppsz_options[i], i_option_flags );
return p_input;
}
......
......@@ -193,7 +193,8 @@ playlist_item_t * playlist_ItemNewWithType( playlist_t *p_playlist,
input_item_t *p_input;
if( psz_uri == NULL ) return NULL;
p_input = input_item_NewWithType( VLC_OBJECT(p_playlist), psz_uri,
psz_name, i_options, ppsz_options,
psz_name,
i_options, ppsz_options, VLC_INPUT_OPTION_TRUSTED,
i_duration, i_type );
return playlist_ItemNewFromInput( p_playlist, p_input );
}
......@@ -386,7 +387,7 @@ int playlist_AddExt( playlist_t *p_playlist, const char * psz_uri,
{
int i_ret;
input_item_t *p_input = input_item_NewExt( p_playlist, psz_uri, psz_name,
i_options, ppsz_options,
i_options, ppsz_options, VLC_INPUT_OPTION_TRUSTED,
i_duration );
i_ret = playlist_AddInput( p_playlist, p_input, i_mode, i_pos, b_playlist,
......
......@@ -102,7 +102,7 @@ int playlist_Import( playlist_t *p_playlist, const char *psz_file )
return VLC_EGENERIC;
p_input = input_item_NewExt( p_playlist, psz_uri, psz_file,
1, &psz_option, -1 );
1, &psz_option, VLC_INPUT_OPTION_TRUSTED, -1 );
free( psz_uri );
playlist_AddInput( p_playlist, p_input, PLAYLIST_APPEND, PLAYLIST_END,
......@@ -162,8 +162,8 @@ int playlist_MLLoad( playlist_t *p_playlist )
const char *const psz_option = "meta-file";
/* that option has to be cleaned in input_item_subitem_added() */
/* vlc_gc_decref() in the same function */
p_input = input_item_NewExt( p_playlist, psz_uri,
_("Media Library"), 1, &psz_option, -1 );
p_input = input_item_NewExt( p_playlist, psz_uri, _("Media Library"),
1, &psz_option, VLC_INPUT_OPTION_TRUSTED, -1 );
if( p_input == NULL )
goto error;
......
......@@ -67,7 +67,7 @@ playlist_item_t * playlist_NodeCreate( playlist_t *p_playlist,
if( !p_input )
p_new_input = input_item_NewWithType( VLC_OBJECT(p_playlist), NULL,
psz_name, 0, NULL, -1, ITEM_TYPE_NODE );
psz_name, 0, NULL, 0, -1, ITEM_TYPE_NODE );
p_item = playlist_ItemNewFromInput( p_playlist,
p_input ? p_input : p_new_input );
if( p_new_input )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment