Commit e49ee59a authored by Thomas Guillem's avatar Thomas Guillem

input/item: factor input_item_t New*() functions

Remove "int options, const char *const *options, unsigned option_flags"
arguments from every New() functions since these args are mainly unused. You
now have to call input_item_AddOptions after input item creation to add
options.

Add input_item_net_type enum in order to avoid confusion between 2 int
arguments: i_duration and i_net that could both be -1, 0 or > 0.

Replace input_item_NewWithType and input_item_NewWithTypeExt with
input_item_NewExt.

Add input_item_NewCard, input_item_NewDisc, input_item_NewStream,
input_item_NewDirectory, input_item_NewFile MACRO. These MACROS avoid to use
useless arguments for an item type (for example, it's useless to specify a
duration for a directory type).
parent a6fa6686
......@@ -116,6 +116,13 @@ enum input_item_type_e
ITEM_TYPE_NUMBER
};
enum input_item_net_type
{
ITEM_NET_UNKNOWN,
ITEM_NET,
ITEM_LOCAL
};
typedef int (*input_item_compar_cb)( input_item_t *, input_item_t * );
struct input_item_node_t
......@@ -281,34 +288,30 @@ VLC_API void input_item_MergeInfos( input_item_t *, info_category_t * );
/**
* This function creates a new input_item_t with the provided information.
*
* XXX You may also use input_item_New or input_item_NewExt as they need
* less arguments.
* XXX You may also use input_item_New, as they need less arguments.
*/
VLC_API input_item_t * input_item_NewWithType( 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 ) VLC_USED;
VLC_API input_item_t * input_item_NewExt( const char *psz_uri,
const char *psz_name,
mtime_t i_duration, int i_type,
enum input_item_net_type i_net ) VLC_USED;
/**
* This function creates a new input_item_t with the provided information.
*
* \param i_net 1/0: force b_net to true/false, -1: default (guess it)
*
* XXX You may also use input_item_New, input_item_NewExt, or
* input_item_NewWithType as they need less arguments.
*/
VLC_API input_item_t * input_item_NewWithTypeExt( 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, int i_net ) VLC_USED;
#define input_item_New( psz_uri, psz_name ) \
input_item_NewExt( psz_uri, psz_name, -1, ITEM_TYPE_UNKNOWN, ITEM_NET_UNKNOWN )
/**
* This function creates a new input_item_t with the provided information.
*
* Provided for convenience.
*/
VLC_API input_item_t * input_item_NewExt( const char *psz_uri, const char *psz_name, int i_options, const char *const *ppsz_options, unsigned i_option_flags, mtime_t i_duration ) VLC_USED;
#define input_item_NewCard( psz_uri, psz_name ) \
input_item_NewExt( psz_uri, psz_name, -1, ITEM_TYPE_CARD, ITEM_LOCAL )
/**
* This function creates a new input_item_t with the provided information.
*
* Provided for convenience.
*/
#define input_item_New( a,b ) input_item_NewExt( a, b, 0, NULL, 0, -1 )
#define input_item_NewDisc( psz_uri, psz_name, i_duration ) \
input_item_NewExt( psz_uri, psz_name, i_duration, ITEM_TYPE_DISC, ITEM_LOCAL )
#define input_item_NewStream( psz_uri, psz_name, i_duration ) \
input_item_NewExt( psz_uri, psz_name, i_duration, ITEM_TYPE_STREAM, ITEM_NET )
#define input_item_NewDirectory( psz_uri, psz_name, i_net ) \
input_item_NewExt( psz_uri, psz_name, -1, ITEM_TYPE_DIRECTORY, i_net )
#define input_item_NewFile( psz_uri, psz_name, i_duration, i_net ) \
input_item_NewExt( psz_uri, psz_name, i_duration, ITEM_TYPE_FILE, i_net )
/**
* This function creates a new input_item_t as a copy of another.
......
......@@ -244,8 +244,7 @@ libvlc_media_list_add_file_content( libvlc_media_list_t * p_mlist,
input_item_t * p_input_item;
libvlc_media_t * p_md;
p_input_item = input_item_NewExt( psz_uri,
_("Media Library"), 0, NULL, 0, -1 );
p_input_item = input_item_New( psz_uri, _("Media Library") );
if( !p_input_item )
{
......
......@@ -484,10 +484,8 @@ static int GetTracks( access_t *p_access, input_item_t *p_current )
const mtime_t i_duration = (int64_t)( p_sys->p_sectors[i+1] - p_sys->p_sectors[i] ) *
CDDA_DATA_SIZE * 1000000 / 44100 / 2 / 2;
input_item_t *p_item = input_item_NewWithType( p_access->psz_url,
psz_name, 0, NULL, 0,
i_duration,
ITEM_TYPE_DISC );
input_item_t *p_item = input_item_NewDisc( p_access->psz_url,
psz_name, i_duration );
if( likely(psz_name != p_access->psz_url) )
free( psz_name );
......
......@@ -174,8 +174,8 @@ input_item_t *DirRead(access_t *access)
if (unlikely(uri == NULL))
continue;
input_item_t *item = input_item_NewWithType(uri, entry, 0, NULL, 0, 0,
type);
input_item_t *item = input_item_NewExt(uri, entry, -1, type,
ITEM_NET_UNKNOWN);
free(uri);
if (likely(item != NULL))
return item;
......
......@@ -541,8 +541,7 @@ static input_item_t *new_item( access_t *p_access, const char *psz_name,
if( i_ret == -1 )
return NULL;
p_item = input_item_NewWithTypeExt( psz_uri, psz_name, 0, NULL, 0, -1,
i_type, 1 );
p_item = input_item_NewExt( psz_uri, psz_name, -1, i_type, ITEM_NET );
free( psz_uri );
if( p_item == NULL )
return NULL;
......
......@@ -120,8 +120,7 @@ static void netbios_ns_discover_on_entry_added( void *p_opaque,
if( asprintf(&psz_mrl, "smb://%s", name) < 0 )
return;
p_item = input_item_NewWithTypeExt( psz_mrl, name, 0, NULL,
0, -1, ITEM_TYPE_DIRECTORY, 1 );
p_item = input_item_NewDirectory( psz_mrl, name, ITEM_NET );
msg_Dbg( p_sd, "Adding item %s", psz_mrl );
free(psz_mrl);
......
......@@ -902,8 +902,8 @@ static input_item_t* DirRead( access_t *p_access )
p_sys->url.psz_path ? p_sys->url.psz_path : "",
psz_line ) != -1 )
{
p_item = input_item_NewWithTypeExt( psz_uri, psz_line, 0, NULL,
0, -1, ITEM_TYPE_UNKNOWN, 1 );
p_item = input_item_NewExt( psz_uri, psz_line, -1, ITEM_TYPE_UNKNOWN,
ITEM_NET );
free( psz_uri );
}
free( psz_line );
......
......@@ -348,8 +348,8 @@ DirRead(access_t *p_access)
default:
i_type = ITEM_TYPE_UNKNOWN;
}
p_item = input_item_NewWithTypeExt(psz_url, p_nfsdirent->name,
0, NULL, 0, -1, i_type, 1);
p_item = input_item_NewExt(psz_url, p_nfsdirent->name, -1, i_type,
ITEM_NET);
free(psz_url);
return p_item;
}
......@@ -373,9 +373,7 @@ MountRead(access_t *p_access)
if (psz_url == NULL)
return NULL;
input_item_t *p_item = input_item_NewWithTypeExt(psz_url, psz_name, 0,
NULL, 0, -1,
ITEM_TYPE_DIRECTORY, 1);
input_item_t *p_item = input_item_NewDirectory(psz_url, psz_name, ITEM_NET);
free(psz_url);
return p_item;
}
......
......@@ -520,8 +520,7 @@ static input_item_t* DirRead( access_t *p_access )
free( psz_uri );
int i_type = LIBSSH2_SFTP_S_ISDIR( attrs.permissions ) ? ITEM_TYPE_DIRECTORY : ITEM_TYPE_FILE;
p_item = input_item_NewWithTypeExt( psz_full_uri, psz_file,
0, NULL, 0, 0, i_type, 1 );
p_item = input_item_NewExt( psz_full_uri, psz_file, -1, i_type, ITEM_NET );
free( psz_full_uri );
if( p_item == NULL )
......
......@@ -392,8 +392,8 @@ static input_item_t* DirRead (access_t *p_access )
}
free(psz_encoded_name);
p_item = input_item_NewWithTypeExt( psz_uri, p_entry->name, 0, NULL,
0, -1, i_type, 1 );
p_item = input_item_NewExt( psz_uri, p_entry->name, -1, i_type,
ITEM_NET );
free( psz_uri );
if( !p_item )
return NULL;
......
......@@ -265,8 +265,11 @@ static void ProcessEntry( int *pi_n_entry, xml_reader_t *p_xml_reader,
}
/* Create the input item */
p_entry = input_item_NewExt( psz_mrl, psz_name, i_options,
(const char* const*) ppsz_options, VLC_INPUT_OPTION_TRUSTED, i_duration );
p_entry = input_item_NewExt( psz_mrl, psz_name, i_duration,
ITEM_TYPE_UNKNOWN, ITEM_NET_UNKNOWN );
input_item_AddOptions( p_entry, i_options,
(const char **)ppsz_options,
VLC_INPUT_OPTION_TRUSTED );
input_item_CopyOptions( p_entry, p_current_input );
/* Add the metadata */
......
......@@ -336,10 +336,9 @@ static input_item_t *ParseLine(char *line)
char sid_opt[sizeof("program=65535")];
snprintf(sid_opt, sizeof(sid_opt), "program=%lu", sid);
const char *opts[] = { sid_opt };
input_item_t *item = input_item_NewWithType(mrl, name, 1, opts, 0, -1,
ITEM_TYPE_CARD);
input_item_t *item = input_item_NewCard(mrl, name);
free(mrl);
if (item != NULL)
input_item_AddOption(item, sid_opt, 0);
return item;
}
......@@ -255,8 +255,9 @@ static int Demux( demux_t *p_demux )
goto error;
}
p_input = input_item_NewExt( psz_mrl, psz_name,
i_options, ppsz_options, 0, i_duration );
p_input = input_item_NewExt( psz_mrl, psz_name, i_duration,
ITEM_TYPE_UNKNOWN, ITEM_NET_UNKNOWN );
input_item_AddOptions( p_input, i_options, ppsz_options, 0 );
free( psz_parse );
free( psz_mrl );
......
......@@ -337,7 +337,9 @@ static int Demux( demux_t *p_demux )
}
/* Create the input item and pump in all the options into playlist item */
p_input = input_item_NewExt( psz_mrl, psz_title, i_options, ppsz_options, 0, i_duration );
p_input = input_item_NewExt( psz_mrl, psz_title, i_duration,
ITEM_TYPE_UNKNOWN, ITEM_NET_UNKNOWN );
input_item_AddOptions( p_input, i_options, ppsz_options, 0 );
if( !EMPTY_STR( psz_artist ) ) input_item_SetArtist( p_input, psz_artist );
if( !EMPTY_STR( psz_author ) ) input_item_SetPublisher( p_input, psz_author );
......
......@@ -373,9 +373,9 @@ static int Demux ( demux_t *p_demux )
p_sys->psz_uri = uri;
}
p_child = input_item_NewWithType( p_sys->psz_uri,
p_child = input_item_NewStream( p_sys->psz_uri,
p_sys->psz_name ? p_sys->psz_name : p_sys->psz_uri,
0, NULL, 0, p_sys->i_duration, ITEM_TYPE_STREAM );
p_sys->i_duration );
if( !p_child )
{
......
......@@ -114,7 +114,7 @@ static void read_body( demux_t* p_demux, input_item_node_t* p_node )
char* mrl = ProcessMRL( psz_val, p_sys->psz_prefix );
if ( unlikely( !mrl ) )
return;
input_item_t* p_item = input_item_NewExt( mrl, NULL, 0, NULL, 0, -1 );
input_item_t* p_item = input_item_New( mrl, NULL );
if ( likely( p_item ) )
{
input_item_node_AppendItem( p_node, p_item );
......
......@@ -631,9 +631,8 @@ static bool parse_extension_node COMPLEX_INTERFACE
msg_Warn(p_demux, "<vlc:node> requires \"title\" attribute");
return false;
}
p_new_input = input_item_NewWithType("vlc://nop", psz_title,
0, NULL, 0, -1,
ITEM_TYPE_DIRECTORY);
p_new_input = input_item_NewDirectory("vlc://nop", psz_title,
ITEM_NET_UNKNOWN);
if (p_new_input)
{
p_input_node =
......
......@@ -181,9 +181,9 @@ static int vlclua_sd_add_node( lua_State *L )
if( lua_isstring( L, -1 ) )
{
const char *psz_name = lua_tostring( L, -1 );
input_item_t *p_input = input_item_NewWithType( "vlc://nop",
psz_name, 0, NULL, 0,
-1, ITEM_TYPE_NODE );
input_item_t *p_input = input_item_NewExt( "vlc://nop",
psz_name, -1,
ITEM_TYPE_NODE, ITEM_NET_UNKNOWN );
lua_pop( L, 1 );
if( p_input )
......@@ -244,14 +244,14 @@ static int vlclua_sd_add_item( lua_State *L )
lua_pushvalue( L, -3 );
vlclua_read_options( p_sd, L, &i_options, &ppsz_options );
input_item_t *p_input = input_item_NewExt( psz_path, psz_title,
i_options,
(const char **)ppsz_options,
VLC_INPUT_OPTION_TRUSTED, -1 );
input_item_t *p_input = input_item_New( psz_path, psz_title );
lua_pop( L, 3 );
if( p_input )
{
input_item_AddOptions( p_input, i_options,
(const char **)ppsz_options,
VLC_INPUT_OPTION_TRUSTED );
vlclua_read_meta_data( p_sd, L, p_input );
/* This one is to be tested... */
vlclua_read_custom_meta_data( p_sd, L, p_input );
......@@ -371,14 +371,14 @@ static int vlclua_node_add_subitem( lua_State *L )
lua_pushvalue( L, -2 );
vlclua_read_options( p_sd, L, &i_options, &ppsz_options );
input_item_t *p_input = input_item_NewExt( psz_path,
psz_path, i_options,
(const char **)ppsz_options,
VLC_INPUT_OPTION_TRUSTED, -1 );
input_item_t *p_input = input_item_New( psz_path, psz_path );
lua_pop( L, 2 );
if( p_input )
{
input_item_AddOptions( p_input, i_options,
(const char **)ppsz_options,
VLC_INPUT_OPTION_TRUSTED );
input_item_node_t *p_input_node = input_item_node_Create( *pp_node );
vlclua_read_meta_data( p_sd, L, p_input );
......@@ -431,9 +431,9 @@ static int vlclua_node_add_subnode( lua_State *L )
if( lua_isstring( L, -1 ) )
{
const char *psz_name = lua_tostring( L, -1 );
input_item_t *p_input = input_item_NewWithType( "vlc://nop",
psz_name, 0, NULL, 0,
-1, ITEM_TYPE_NODE );
input_item_t *p_input = input_item_NewExt( "vlc://nop",
psz_name, -1,
ITEM_TYPE_NODE, ITEM_NET_UNKNOWN );
lua_pop( L, 1 );
if( p_input )
......
......@@ -541,10 +541,11 @@ int vlclua_playlist_add_internal( vlc_object_t *p_this, lua_State *L,
vlclua_read_options( p_this, L, &i_options, &ppsz_options );
/* Create input item */
p_input = input_item_NewExt( psz_path, psz_name, i_options,
(const char **)ppsz_options,
VLC_INPUT_OPTION_TRUSTED,
i_duration );
p_input = input_item_NewExt( psz_path, psz_name, i_duration,
ITEM_TYPE_UNKNOWN, ITEM_NET_UNKNOWN );
input_item_AddOptions( p_input, i_options,
(const char **)ppsz_options,
VLC_INPUT_OPTION_TRUSTED );
lua_pop( L, 3 ); /* pop "path name item" */
/* playlist key item */
......
......@@ -194,10 +194,9 @@ struct services_discovery_sys_t
aNetService.hostName,
aNetService.port];
input_item_t *p_input_item = input_item_NewWithTypeExt([uri UTF8String],
[aNetService.name UTF8String],
0, NULL, 0, -1,
ITEM_TYPE_DIRECTORY, true );
input_item_t *p_input_item = input_item_NewDirectory([uri UTF8String],
[aNetService.name UTF8String],
ITEM_NET );
if (p_input_item != NULL) {
services_discovery_AddItem(self.p_sd, p_input_item, NULL);
......
......@@ -139,8 +139,7 @@ items_add_input( services_discovery_t *p_sd, char *psz_uri,
}
input_item_t *p_input_item =
input_item_NewWithTypeExt( psz_uri, psz_name, 0, NULL, 0, -1,
ITEM_TYPE_DIRECTORY, true );
input_item_NewDirectory( psz_uri, psz_name, ITEM_NET );
if( p_input_item == NULL )
{
free( psz_uri );
......
......@@ -88,7 +88,7 @@ static int Open (vlc_object_t *obj)
letter = 'A' + drive;
mrl[8] = name[0] = letter;
item = input_item_NewWithType (mrl, name, 0, NULL, 0, -1, ITEM_TYPE_DISC);
item = input_item_NewDisc (mrl, name, -1);
msg_Dbg (sd, "adding %s (%s)", mrl, name);
if (item == NULL)
break;
......
......@@ -148,9 +148,7 @@ static int AddSource (services_discovery_t *sd, const pa_source_info *info)
if (unlikely(asprintf (&mrl, "pulse://%s", info->name) == -1))
return -1;
input_item_t *item = input_item_NewWithType (mrl, info->description,
0, NULL, 0, -1,
ITEM_TYPE_CARD);
input_item_t *item = input_item_NewCard (mrl, info->description);
free (mrl);
if (unlikely(item == NULL))
return -1;
......
......@@ -852,9 +852,8 @@ sap_announce_t *CreateAnnounce( services_discovery_t *p_sd, uint32_t *i_source,
p_sap->p_sdp = p_sdp;
/* Released in RemoveAnnounce */
p_input = input_item_NewWithType( p_sap->p_sdp->psz_uri,
p_sdp->psz_sessionname,
0, NULL, 0, -1, ITEM_TYPE_STREAM );
p_input = input_item_NewStream( p_sap->p_sdp->psz_uri, p_sdp->psz_sessionname,
-1 );
if( unlikely(p_input == NULL) )
{
free( p_sap );
......
......@@ -168,9 +168,8 @@ static int AddDevice (services_discovery_t *sd, struct udev_device *dev)
if (mrl == NULL)
return 0; /* don't know if it was an error... */
char *name = p_sys->subsys->get_name (dev);
input_item_t *item = input_item_NewWithType (mrl, name ? name : mrl,
0, NULL, 0, -1,
p_sys->subsys->item_type);
input_item_t *item = input_item_NewExt (mrl, name ? name : mrl, -1,
p_sys->subsys->item_type, ITEM_LOCAL);
msg_Dbg (sd, "adding %s (%s)", mrl, name);
free (name);
free (mrl);
......
......@@ -320,15 +320,17 @@ bool MediaServerList::addServer( MediaServerDesc* desc )
if ( desc->isSatIp )
{
p_input_item = input_item_NewWithTypeExt( desc->location.c_str(), desc->friendlyName.c_str(), 0,
NULL, 0, -1, ITEM_TYPE_DIRECTORY, 1);
p_input_item = input_item_NewDirectory( desc->location.c_str(),
desc->friendlyName.c_str(),
ITEM_NET );
} else {
char* psz_mrl;
if( asprintf(&psz_mrl, "upnp://%s?ObjectID=0", desc->location.c_str() ) < 0 )
return false;
p_input_item = input_item_NewWithTypeExt( psz_mrl, desc->friendlyName.c_str(), 0,
NULL, 0, -1, ITEM_TYPE_DIRECTORY, 1);
p_input_item = input_item_NewDirectory( psz_mrl,
desc->friendlyName.c_str(),
ITEM_NET );
free( psz_mrl );
}
if ( !p_input_item )
......@@ -790,8 +792,7 @@ input_item_t* MediaServer::newItem( const char *objectID, const char *title )
if( asprintf( &psz_url, "upnp://%s?ObjectID=%s", psz_root_, objectID ) < 0 )
return NULL;
input_item_t* p_item = input_item_NewWithTypeExt( psz_url, title, 0, NULL,
0, -1, ITEM_TYPE_DIRECTORY, 1 );
input_item_t* p_item = input_item_NewDirectory( psz_url, title, ITEM_NET );
free( psz_url);
return p_item;
}
......@@ -799,8 +800,7 @@ input_item_t* MediaServer::newItem( const char *objectID, const char *title )
input_item_t* MediaServer::newItem(const char* title, const char*,
mtime_t duration, const char* psz_url)
{
return input_item_NewWithTypeExt( psz_url, title, 0, NULL, 0,
duration, ITEM_TYPE_FILE, 1 );
return input_item_NewFile( psz_url, title, duration, ITEM_NET );
}
int MediaServer::sendActionCb( Upnp_EventType eventType,
......
......@@ -74,8 +74,7 @@ static int Open (vlc_object_t *obj)
continue;
mrl[8] = name[0] = letter;
item = input_item_NewWithType (mrl, name,
0, NULL, 0, -1, ITEM_TYPE_DISC);
item = input_item_NewDisc (mrl, name, -1);
msg_Dbg (sd, "adding %s (%s)", mrl, name);
if (item == NULL)
break;
......
......@@ -255,9 +255,7 @@ static struct app *AddApp (services_discovery_t *sd, xcb_window_t xid)
else
name = NULL;
input_item_t *item = input_item_NewWithType (mrl, name ? name : mrl,
0, NULL, 0, -1,
ITEM_TYPE_CARD /* FIXME */);
input_item_t *item = input_item_NewCard (mrl, name ? name : mrl); /* FIXME */
free (mrl);
free (name);
if (item == NULL)
......@@ -348,8 +346,7 @@ static void AddDesktop(services_discovery_t *sd)
{
input_item_t *item;
item = input_item_NewWithType ("screen://", _("Desktop"),
0, NULL, 0, -1, ITEM_TYPE_CARD);
item = input_item_NewCard ("screen://", _("Desktop"));
if (item == NULL)
return;
......
......@@ -913,24 +913,9 @@ void input_item_SetEpgOffline( input_item_t *p_item )
vlc_event_send( &p_item->event_manager, &event );
}
input_item_t *input_item_NewExt( 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( psz_uri, psz_name,
i_options, ppsz_options, i_option_flags,
i_duration, ITEM_TYPE_UNKNOWN );
}
input_item_t *
input_item_NewWithTypeExt( const char *psz_uri, const char *psz_name,
int i_options, const char *const *ppsz_options,
unsigned flags, mtime_t duration, int type,
int i_net )
input_item_NewExt( const char *psz_uri, const char *psz_name,
mtime_t duration, int type, enum input_item_net_type i_net )
{
static atomic_uint last_input_id = ATOMIC_VAR_INIT(0);
......@@ -962,8 +947,6 @@ input_item_NewWithTypeExt( const char *psz_uri, const char *psz_name,
TAB_INIT( p_input->i_options, p_input->ppsz_options );
p_input->optflagc = 0;
p_input->optflagv = NULL;
for( int i = 0; i < i_options; i++ )
input_item_AddOption( p_input, ppsz_options[i], flags );
p_input->opaques = NULL;
p_input->i_duration = duration;
......@@ -988,42 +971,35 @@ input_item_NewWithTypeExt( const char *psz_uri, const char *psz_name,
p_input->i_type = type;
p_input->b_error_when_reading = false;
if( i_net != -1 )
p_input->b_net = !!i_net;
if( i_net != ITEM_NET_UNKNOWN )
p_input->b_net = i_net == ITEM_NET;
return p_input;
}
input_item_t *
input_item_NewWithType( const char *psz_uri, const char *psz_name,
int i_options, const char *const *ppsz_options,
unsigned flags, mtime_t duration, int type )
{
return input_item_NewWithTypeExt( psz_uri, psz_name, i_options,
ppsz_options, flags, duration, type,
-1 );
}
input_item_t *input_item_Copy( input_item_t *p_input )
{
vlc_meta_t *meta = NULL;
input_item_t *item;
bool b_net;
vlc_mutex_lock( &p_input->lock );
item = input_item_NewWithType( p_input->psz_uri, p_input->psz_name,
0, NULL, 0, p_input->i_duration,
p_input->i_type );
item = input_item_NewExt( p_input->psz_uri, p_input->psz_name,
p_input->i_duration, p_input->i_type,
ITEM_NET_UNKNOWN );
if( likely(item != NULL) && p_input->p_meta != NULL )
{
meta = vlc_meta_New();
vlc_meta_Merge( meta, p_input->p_meta );
}
b_net = p_input->b_net;
vlc_mutex_unlock( &p_input->lock );
if( likely(item != NULL) )
{ /* No need to lock; no other thread has seen this new item yet. */
input_item_CopyOptions( item, p_input );
item->p_meta = meta;
item->b_net = b_net;
}
return item;
......
......@@ -191,8 +191,6 @@ input_item_IsPreparsed
input_item_MetaMatch
input_item_MergeInfos
input_item_NewExt
input_item_NewWithType
input_item_NewWithTypeExt
input_item_Hold
input_item_Release
input_item_node_AppendItem
......
......@@ -436,11 +436,11 @@ int playlist_AddExt( playlist_t *p_playlist, const char * psz_uri,
int i_ret;
input_item_t *p_input;
p_input = input_item_NewExt( psz_uri, psz_name,
i_options, ppsz_options, i_option_flags,
i_duration );
p_input = input_item_NewExt( psz_uri, psz_name, i_duration,
ITEM_TYPE_UNKNOWN, ITEM_NET_UNKNOWN );
if( p_input == NULL )
return VLC_ENOMEM;
input_item_AddOptions( p_input, i_options, ppsz_options, i_option_flags );
i_ret = playlist_AddInput( p_playlist, p_input, i_mode, i_pos, b_playlist,
b_locked );
vlc_gc_decref( p_input );
......
......@@ -96,7 +96,7 @@ int playlist_Import( playlist_t *p_playlist, const char *psz_file )
if( psz_uri == NULL )
return VLC_EGENERIC;
p_input = input_item_NewExt( psz_uri, psz_file, 0, NULL, 0, -1 );
p_input = input_item_New( psz_uri, psz_file );
free( psz_uri );
playlist_AddInput( p_playlist, p_input, PLAYLIST_APPEND, PLAYLIST_END,
......@@ -158,7 +158,7 @@ int playlist_MLLoad( playlist_t *p_playlist )
if( psz_uri == NULL )
return VLC_ENOMEM;
p_input = input_item_NewExt( psz_uri, _("Media Library"), 0, NULL, 0, -1 );
p_input = input_item_New( psz_uri, _("Media Library") );
free( psz_uri );
if( p_input == NULL )
return VLC_EGENERIC;
......
......@@ -67,8 +67,8 @@ playlist_item_t * playlist_NodeCreate( playlist_t *p_playlist,
if( !psz_name ) psz_name = _("Undefined");
if( !p_input )
p_new_input = input_item_NewWithType( NULL, psz_name, 0, NULL, 0, -1,
ITEM_TYPE_NODE );
p_new_input = input_item_NewExt( NULL, psz_name, -1, ITEM_TYPE_NODE,
ITEM_NET_UNKNOWN );
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