Commit b4feb9f9 authored by Laurent Aimar's avatar Laurent Aimar

Use input_item_New when applicable.

parent d3081fff
...@@ -416,8 +416,7 @@ static int Open( vlc_object_t * p_this ) ...@@ -416,8 +416,7 @@ static int Open( vlc_object_t * p_this )
free( psz_path ); free( psz_path );
} }
msg_Dbg( p_demux, "adding ref = `%s'", psz_ref ); msg_Dbg( p_demux, "adding ref = `%s'", psz_ref );
input_item_t *p_input = input_item_NewExt( p_demux, psz_ref input_item_t *p_input = input_item_New( p_demux, psz_ref, NULL );
, NULL, 0, NULL, 0, -1 );
input_item_CopyOptions( p_current, p_input ); input_item_CopyOptions( p_current, p_input );
input_item_AddSubItem( p_current, p_input ); input_item_AddSubItem( p_current, p_input );
vlc_gc_decref( p_input ); vlc_gc_decref( p_input );
......
...@@ -261,8 +261,7 @@ static int Demux( demux_t *p_demux ) ...@@ -261,8 +261,7 @@ static int Demux( demux_t *p_demux )
if( !psz_elname ) return -1; if( !psz_elname ) return -1;
if( !strcmp( psz_elname, "entry" ) ) if( !strcmp( psz_elname, "entry" ) )
{ {
p_input = input_item_NewExt( p_demux, psz_mrl, psz_name, p_input = input_item_New( p_demux, psz_mrl, psz_name );
0, NULL, 0, -1 );
if( psz_now ) if( psz_now )
input_item_SetNowPlaying( p_input, psz_now ); input_item_SetNowPlaying( p_input, psz_now );
if( psz_genre ) if( psz_genre )
......
...@@ -106,7 +106,7 @@ static int Demux( demux_t *p_demux ) ...@@ -106,7 +106,7 @@ static int Demux( demux_t *p_demux )
while( (psz_line = stream_ReadLine( p_demux->s )) ) while( (psz_line = stream_ReadLine( p_demux->s )) )
{ {
char **ppsz_options = NULL; char **ppsz_options = NULL;
int i, i_options = 0; int i_options = 0;
char *psz_name = NULL; char *psz_name = NULL;
if( !ParseLine( psz_line, &psz_name, &ppsz_options, &i_options ) ) if( !ParseLine( psz_line, &psz_name, &ppsz_options, &i_options ) )
...@@ -116,16 +116,16 @@ static int Demux( demux_t *p_demux ) ...@@ -116,16 +116,16 @@ static int Demux( demux_t *p_demux )
} }
EnsureUTF8( psz_name ); EnsureUTF8( psz_name );
for( int i = 0; i< i_options; i++ )
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] ); EnsureUTF8( ppsz_options[i] );
input_item_AddOption( p_input, ppsz_options[i], VLC_INPUT_OPTION_TRUSTED );
} p_input = input_item_NewExt( p_demux, "dvb://", psz_name,
i_options, (const char**)ppsz_options, VLC_INPUT_OPTION_TRUSTED, -1 );
input_item_AddSubItem( p_current_input, p_input ); input_item_AddSubItem( p_current_input, p_input );
vlc_gc_decref( p_input ); vlc_gc_decref( p_input );
while( i_options-- ) free( ppsz_options[i_options] );
while( i_options-- )
free( ppsz_options[i_options] );
free( ppsz_options ); free( ppsz_options );
free( psz_line ); free( psz_line );
......
...@@ -202,8 +202,7 @@ static int Demux( demux_t *p_demux ) ...@@ -202,8 +202,7 @@ static int Demux( demux_t *p_demux )
} }
else else
{ {
p_input = input_item_NewExt( p_demux, p_input = input_item_New( p_demux, psz_url, psz_title );
psz_url, psz_title, 0, NULL, 0, -1 );
#define SADD_INFO( type, field ) if( field ) { input_item_AddInfo( \ #define SADD_INFO( type, field ) if( field ) { input_item_AddInfo( \
p_input, _("Google Video"), _(type), "%s", field ) ; } p_input, _("Google Video"), _(type), "%s", field ) ; }
SADD_INFO( "gvp_version", psz_version ); SADD_INFO( "gvp_version", psz_version );
......
...@@ -95,7 +95,7 @@ static int Demux( demux_t *p_demux ) ...@@ -95,7 +95,7 @@ static int Demux( demux_t *p_demux )
psz_url = (char *)malloc( len+1 ); psz_url = (char *)malloc( len+1 );
snprintf( psz_url, len+1, "dvd://%s", p_demux->psz_path ); snprintf( psz_url, len+1, "dvd://%s", p_demux->psz_path );
p_input = input_item_NewExt( p_demux, psz_url, psz_url, 0, NULL, 0, -1 ); p_input = input_item_New( p_demux, psz_url, psz_url );
input_item_AddSubItem( p_current_input, p_input ); input_item_AddSubItem( p_current_input, p_input );
vlc_gc_decref( p_input ); vlc_gc_decref( p_input );
......
...@@ -380,8 +380,7 @@ static bool parse_track_dict COMPLEX_INTERFACE ...@@ -380,8 +380,7 @@ static bool parse_track_dict COMPLEX_INTERFACE
memmove( psz_uri + 7, psz_uri + 17, strlen( psz_uri ) - 9 ); memmove( psz_uri + 7, psz_uri + 17, strlen( psz_uri ) - 9 );
msg_Info( p_demux, "Adding '%s'", psz_uri ); msg_Info( p_demux, "Adding '%s'", psz_uri );
p_new_input = input_item_NewExt( p_demux, psz_uri, p_new_input = input_item_New( p_demux, psz_uri, NULL );
NULL, 0, NULL, 0, -1 );
input_item_AddSubItem( p_input_item, p_new_input ); input_item_AddSubItem( p_input_item, p_new_input );
/* add meta info */ /* add meta info */
......
...@@ -218,14 +218,12 @@ static int Demux( demux_t *p_demux ) ...@@ -218,14 +218,12 @@ static int Demux( demux_t *p_demux )
if( !psz_mrl ) goto error; if( !psz_mrl ) goto error;
p_input = input_item_NewExt( p_demux, psz_mrl, psz_name, p_input = input_item_NewExt( p_demux, psz_mrl, psz_name,
0, NULL, 0, i_duration ); i_options, ppsz_options, 0, i_duration );
if ( psz_artist && *psz_artist ) if ( psz_artist && *psz_artist )
input_item_SetArtist( p_input, psz_artist ); input_item_SetArtist( p_input, psz_artist );
input_item_AddSubItem( p_current_input, p_input ); input_item_AddSubItem( p_current_input, p_input );
for( int i = 0; i < i_options; i++ )
input_item_AddOption( p_input, ppsz_options[i], 0 );
vlc_gc_decref( p_input ); vlc_gc_decref( p_input );
free( psz_mrl ); free( psz_mrl );
} }
......
...@@ -159,8 +159,7 @@ static int Demux( demux_t *p_demux ) ...@@ -159,8 +159,7 @@ static int Demux( demux_t *p_demux )
{ {
if( psz_mrl ) if( psz_mrl )
{ {
p_input = input_item_NewExt( p_demux, psz_mrl, psz_name, p_input = input_item_New( p_demux, psz_mrl, psz_name );
0, NULL, 0, -1 );
input_item_CopyOptions( p_current_input, p_input ); input_item_CopyOptions( p_current_input, p_input );
input_item_AddSubItem( p_current_input, p_input ); input_item_AddSubItem( p_current_input, p_input );
vlc_gc_decref( p_input ); vlc_gc_decref( p_input );
...@@ -215,7 +214,7 @@ static int Demux( demux_t *p_demux ) ...@@ -215,7 +214,7 @@ static int Demux( demux_t *p_demux )
/* Add last object */ /* Add last object */
if( psz_mrl ) if( psz_mrl )
{ {
p_input = input_item_NewExt( p_demux, psz_mrl, psz_name,0, NULL, 0, -1 ); p_input = input_item_New( p_demux, psz_mrl, psz_name );
input_item_CopyOptions( p_current_input, p_input ); input_item_CopyOptions( p_current_input, p_input );
input_item_AddSubItem( p_current_input, p_input ); input_item_AddSubItem( p_current_input, p_input );
vlc_gc_decref( p_input ); vlc_gc_decref( p_input );
......
...@@ -291,8 +291,7 @@ static int Demux( demux_t *p_demux ) ...@@ -291,8 +291,7 @@ static int Demux( demux_t *p_demux )
free( psz_elname ); free( psz_elname );
return -1; return -1;
} }
p_input = input_item_NewExt( p_demux, psz_item_mrl, p_input = input_item_New( p_demux, psz_item_mrl, psz_item_name );
psz_item_name, 0, NULL, 0, -1 );
if( p_input == NULL ) break; if( p_input == NULL ) break;
#define ADD_INFO( info, field ) \ #define ADD_INFO( info, field ) \
if( field ) { input_item_AddInfo( p_input, \ if( field ) { input_item_AddInfo( p_input, \
......
...@@ -349,8 +349,7 @@ static int Demux( demux_t *p_demux ) ...@@ -349,8 +349,7 @@ static int Demux( demux_t *p_demux )
} }
else else
{ {
p_input = input_item_NewExt( p_demux, p_input = input_item_New( p_demux, psz_src, psz_moviename );
psz_src, psz_moviename, 0, NULL, 0, -1 );
#define SADD_INFO( type, field ) if( field ) { input_item_AddInfo( \ #define SADD_INFO( type, field ) if( field ) { input_item_AddInfo( \
p_input, "QuickTime Media Link", _(type), "%s", field ) ; } p_input, "QuickTime Media Link", _(type), "%s", field ) ; }
SADD_INFO( "href", psz_href ); SADD_INFO( "href", psz_href );
...@@ -359,8 +358,7 @@ static int Demux( demux_t *p_demux ) ...@@ -359,8 +358,7 @@ static int Demux( demux_t *p_demux )
vlc_gc_decref( p_input ); vlc_gc_decref( p_input );
if( psz_qtnext ) if( psz_qtnext )
{ {
p_input = input_item_NewExt( p_demux, p_input = input_item_New( p_demux, psz_qtnext, NULL );
psz_qtnext, NULL, 0, NULL, 0, -1 );
input_item_AddSubItem( p_current_input, p_input ); input_item_AddSubItem( p_current_input, p_input );
vlc_gc_decref( p_input ); vlc_gc_decref( p_input );
} }
......
...@@ -228,8 +228,7 @@ static int DemuxGenre( demux_t *p_demux ) ...@@ -228,8 +228,7 @@ static int DemuxGenre( demux_t *p_demux )
if( asprintf( &psz_mrl, SHOUTCAST_BASE_URL "?genre=%s", if( asprintf( &psz_mrl, SHOUTCAST_BASE_URL "?genre=%s",
psz_name ) != -1 ) psz_name ) != -1 )
{ {
p_input = input_item_NewExt( p_demux, psz_mrl, p_input = input_item_New( p_demux, psz_mrl, psz_name );
psz_name, 0, NULL, 0, -1 );
input_item_CopyOptions( p_sys->p_current_input, p_input ); input_item_CopyOptions( p_sys->p_current_input, p_input );
free( psz_mrl ); free( psz_mrl );
input_item_AddSubItem( p_sys->p_current_input, p_input ); input_item_AddSubItem( p_sys->p_current_input, p_input );
...@@ -399,13 +398,10 @@ static int DemuxStation( demux_t *p_demux ) ...@@ -399,13 +398,10 @@ static int DemuxStation( demux_t *p_demux )
psz_base, psz_id ) == -1 ) psz_base, psz_id ) == -1 )
psz_mrl = NULL; psz_mrl = NULL;
} }
p_input = input_item_NewExt( p_demux, psz_mrl, p_input = input_item_New( p_demux, psz_mrl, psz_name );
psz_name , 0, NULL, 0, -1 ); input_item_CopyOptions( p_sys->p_current_input, p_input );
free( psz_mrl ); free( psz_mrl );
input_item_CopyOptions( p_sys->p_current_input,
p_input );
#define SADD_INFO( type, field ) if( field ) { input_item_AddInfo( \ #define SADD_INFO( type, field ) if( field ) { input_item_AddInfo( \
p_input, _("Shoutcast"), _(type), "%s", field ) ; } p_input, _("Shoutcast"), _(type), "%s", field ) ; }
SADD_INFO( "Mime type", psz_mt ); SADD_INFO( "Mime type", psz_mt );
......
...@@ -416,11 +416,11 @@ static bool parse_track_node COMPLEX_INTERFACE ...@@ -416,11 +416,11 @@ static bool parse_track_node COMPLEX_INTERFACE
{NULL, UNKNOWN_CONTENT, {NULL} } {NULL, UNKNOWN_CONTENT, {NULL} }
}; };
input_item_t *p_new_input = input_item_NewExt( p_demux, NULL, NULL, 0, NULL, 0, -1 ); input_item_t *p_new_input = input_item_New( p_demux, NULL, NULL );
if( !p_new_input ) if( !p_new_input )
{ {
/* malloc has failed for input_item_NewExt, so bailout early */ /* malloc has failed for input_item_New, so bailout early */
return false; return false;
} }
......
...@@ -437,8 +437,7 @@ static void openDirectory( intf_thread_t *p_intf, bool pl, bool go ) ...@@ -437,8 +437,7 @@ static void openDirectory( intf_thread_t *p_intf, bool pl, bool go )
{ {
QString mrl = dir.endsWith( "VIDEO_TS", Qt::CaseInsensitive ) ? QString mrl = dir.endsWith( "VIDEO_TS", Qt::CaseInsensitive ) ?
"dvd://" : "directory://" + toNativeSeparators( dir ); "dvd://" : "directory://" + toNativeSeparators( dir );
input_item_t *p_input = input_item_NewExt( THEPL, qtu( mrl ), input_item_t *p_input = input_item_New( THEPL, qtu( mrl ), NULL );
NULL, 0, NULL, 0, -1 );
/* FIXME: playlist_AddInput() can fail */ /* FIXME: playlist_AddInput() can fail */
playlist_AddInput( THEPL, p_input, playlist_AddInput( THEPL, p_input,
......
...@@ -175,7 +175,7 @@ static void resolve_callback( ...@@ -175,7 +175,7 @@ static void resolve_callback(
if( psz_uri != NULL ) if( psz_uri != NULL )
{ {
p_input = input_item_NewExt( p_sd, psz_uri, name, 0, NULL, 0, -1 ); p_input = input_item_New( p_sd, psz_uri, name );
free( (void *)psz_uri ); free( (void *)psz_uri );
} }
if( p_input != NULL ) if( p_input != NULL )
......
...@@ -245,8 +245,7 @@ static void ParseUrls( services_discovery_t *p_sd, char *psz_urls ) ...@@ -245,8 +245,7 @@ static void ParseUrls( services_discovery_t *p_sd, char *psz_urls )
input_item_t *p_input; input_item_t *p_input;
INSERT_ELEM( p_sys->ppsz_urls, p_sys->i_urls, p_sys->i_urls, INSERT_ELEM( p_sys->ppsz_urls, p_sys->i_urls, p_sys->i_urls,
strdup( psz_urls ) ); strdup( psz_urls ) );
p_input = input_item_NewExt( p_sd, psz_urls, p_input = input_item_New( p_sd, psz_urls, psz_urls );
psz_urls, 0, NULL, 0, -1 );
input_item_AddOption( p_input, "demux=podcast", VLC_INPUT_OPTION_TRUSTED ); input_item_AddOption( p_input, "demux=podcast", VLC_INPUT_OPTION_TRUSTED );
services_discovery_AddItem( p_sd, p_input, NULL /* no cat */ ); services_discovery_AddItem( p_sd, p_input, NULL /* no cat */ );
vlc_gc_decref( p_input ); vlc_gc_decref( p_input );
......
...@@ -186,9 +186,7 @@ static input_item_t * CreateInputItemFromShoutItem( services_discovery_t *p_sd, ...@@ -186,9 +186,7 @@ static input_item_t * CreateInputItemFromShoutItem( services_discovery_t *p_sd,
{ {
int i; int i;
/* Create the item */ /* Create the item */
input_item_t *p_input = input_item_NewExt( p_sd, input_item_t *p_input = input_item_New( p_sd, p_item->psz_url, _(p_item->psz_name) );
p_item->psz_url, _(p_item->psz_name),
0, NULL, 0, -1 );
/* Copy options */ /* Copy options */
for( i = 0; p_item->ppsz_options[i] != NULL; i++ ) for( i = 0; p_item->ppsz_options[i] != NULL; i++ )
......
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