struct vlc_input_item_subitem_added
{
input_item_t * p_new_child;
- vlc_bool_t b_node;
} input_item_subitem_added;
struct vlc_input_item_duration_changed
{
* It is not the input item's responsability to keep all the ref of
* the input item children. */
static inline void input_ItemAddSubItem( input_item_t *p_parent,
- input_item_t *p_child,
- vlc_bool_t b_node )
+ input_item_t *p_child )
{
vlc_event_t event;
/* Notify interested third parties */
event.type = vlc_InputItemSubItemAdded;
event.u.input_item_subitem_added.p_new_child = p_child;
- event.u.input_item_subitem_added.b_node = b_node;
vlc_event_send( &p_parent->event_manager, &event );
}
psz_string[i_strlen] = '\0';
p_input = input_ItemNew( p_playlist, psz_string, psz_title_asx );
input_ItemCopyOptions( p_current_input, p_input );
- input_ItemAddSubItem( p_current_input, p_input, VLC_FALSE );
+ input_ItemAddSubItem( p_current_input, p_input );
free( psz_string );
}
else continue;
if( psz_copyright_entry ) input_item_SetCopyright( p_entry, psz_copyright_entry );
if( psz_moreinfo_entry ) input_item_SetURL( p_entry, psz_moreinfo_entry );
if( psz_abstract_entry ) input_item_SetDescription( p_entry, psz_abstract_entry );
- input_ItemAddSubItem( p_current_input, p_entry, VLC_FALSE );
+ input_ItemAddSubItem( p_current_input, p_entry );
vlc_gc_decref( p_entry );
}
if( psz_bitrate )
msg_Err( p_playlist, "Unsupported meta bitrate" );
- input_ItemAddSubItem( p_current_input, p_input, VLC_FALSE );
+ input_ItemAddSubItem( p_current_input, p_input );
vlc_gc_decref( p_input );
FREENULL( psz_name );
FREENULL( psz_mrl );
EnsureUTF8( ppsz_options[i] );
input_ItemAddOption( p_input, ppsz_options[i] );
}
- input_ItemAddSubItem( p_current_input, p_input, VLC_FALSE );
+ input_ItemAddSubItem( p_current_input, p_input );
vlc_gc_decref( p_input );
while( i_options-- ) free( ppsz_options[i_options] );
if( ppsz_options ) free( ppsz_options );
SADD_INFO( "gvp_version", psz_version );
SADD_INFO( "docid", psz_docid );
SADD_INFO( "description", psz_description );
- input_ItemAddSubItem( p_current_input, p_input, VLC_FALSE );
+ input_ItemAddSubItem( p_current_input, p_input );
vlc_gc_decref( p_input );
}
snprintf( psz_url, len+1, "dvd://%s", p_demux->psz_path );
p_input = input_ItemNewExt( p_playlist, psz_url, psz_url, 0, NULL, -1 );
- input_ItemAddSubItem( p_current_input, p_input, VLC_FALSE );
+ input_ItemAddSubItem( p_current_input, p_input );
vlc_gc_decref( p_input );
HANDLE_PLAY_AND_RELEASE;
p_new_input = input_ItemNewExt( p_playlist, psz_uri,
NULL, 0, NULL, -1 );
- input_ItemAddSubItem( p_input_item, p_new_input, VLC_FALSE );
+ input_ItemAddSubItem( p_input_item, p_new_input );
/* add meta info */
add_meta( p_new_input, p_track );
if ( psz_artist && *psz_artist )
input_ItemAddInfo( p_input, _(VLC_META_INFO_CAT),
_(VLC_META_ARTIST), "%s", psz_artist );
- input_ItemAddSubItem( p_current_input, p_input, VLC_FALSE );
+ input_ItemAddSubItem( p_current_input, p_input );
vlc_gc_decref( p_input );
free( psz_mrl );
}
p_input = input_ItemNewExt( p_playlist, psz_mrl, psz_name,
0, NULL, -1 );
input_ItemCopyOptions( p_current_input, p_input );
- input_ItemAddSubItem( p_current_input, p_input, VLC_FALSE );
+ input_ItemAddSubItem( p_current_input, p_input );
vlc_gc_decref( p_input );
}
else
{
p_input = input_ItemNewExt( p_playlist, psz_mrl, psz_name,0, NULL, -1 );
input_ItemCopyOptions( p_current_input, p_input );
- input_ItemAddSubItem( p_current_input, p_input, VLC_FALSE );
+ input_ItemAddSubItem( p_current_input, p_input );
vlc_gc_decref( p_input );
free( psz_mrl_orig );
psz_mrl = NULL;
"%s bytes",
psz_item_size );
}
- input_ItemAddSubItem( p_current_input, p_input, VLC_FALSE );
+ input_ItemAddSubItem( p_current_input, p_input );
vlc_gc_decref( p_input );
FREENULL( psz_item_name );
FREENULL( psz_item_mrl );
p_input, "QuickTime Media Link", _(type), "%s", field ) ; }
SADD_INFO( "href", psz_href );
SADD_INFO( "mime type", psz_mimetype );
- input_ItemAddSubItem( p_current_input, p_input, VLC_FALSE );
+ input_ItemAddSubItem( p_current_input, p_input );
vlc_gc_decref( p_input );
if( psz_qtnext )
{
p_input = input_ItemNewExt( p_sys->p_playlist,
psz_qtnext, NULL, 0, NULL, -1 );
- input_ItemAddSubItem( p_current_input, p_input, VLC_FALSE );
+ input_ItemAddSubItem( p_current_input, p_input );
vlc_gc_decref( p_input );
}
}
free( psz_option );
}
- input_ItemAddSubItem( p_current_input, p_child, VLC_FALSE );
+ input_ItemAddSubItem( p_current_input, p_child );
vlc_gc_decref( p_child );
HANDLE_PLAY_AND_RELEASE
return 0; /* Needed for correct operation of go back */
input_ItemCopyOptions( p_sys->p_current_input,
p_input );
free( psz_mrl );
- input_ItemAddSubItem( p_sys->p_current_input, p_input, VLC_FALSE );
+ input_ItemAddSubItem( p_sys->p_current_input, p_input );
vlc_gc_decref( p_input );
FREENULL( psz_name );
}
input_item_SetNowPlaying( p_input, psz_ct );
if( psz_rt )
input_item_SetRating( p_input, psz_rt );
- input_ItemAddSubItem( p_sys->p_current_input, p_input, VLC_FALSE );
+ input_ItemAddSubItem( p_sys->p_current_input, p_input );
vlc_gc_decref( p_input );
FREENULL( psz_name );
FREENULL( psz_mt );
{
input_item_t *p_new_input = p_demux->p_sys->pp_tracklist[i];
if( p_new_input )
- input_ItemAddSubItem( p_current_input, p_new_input, VLC_FALSE );
- vlc_gc_decref( p_new_input );
+ {
+ input_ItemAddSubItem( p_current_input, p_new_input );
+ }
}
HANDLE_PLAY_AND_RELEASE;
if( !strcmp( psz_name, psz_element ) )
{
FREE_ATT();
- if( p_demux->p_sys->i_identifier == -1 ||
- p_demux->p_sys->i_identifier ==
+ if( p_demux->p_sys->i_identifier <
p_demux->p_sys->i_tracklist_entries )
+ {
+ p_demux->p_sys->pp_tracklist[
+ p_demux->p_sys->i_identifier ] = p_new_input;
+ }
+ else
{
if( p_demux->p_sys->i_identifier >
p_demux->p_sys->i_tracklist_entries )
p_demux->p_sys->i_tracklist_entries,
p_demux->p_sys->i_tracklist_entries,
p_new_input );
- p_demux->p_sys->i_identifier = -1;
- }
- else
- {
- msg_Err( p_demux, "Invalid identifier %d", p_demux->p_sys->i_identifier );
- p_demux->p_sys->i_identifier = -1;
- return VLC_FALSE;
}
return VLC_TRUE;
}
if( psz_uri )
{
- if( ( p_demux->p_sys->psz_base ||
- strrchr( p_demux->psz_path, DIR_SEP_CHAR ) ) &&
+ if( p_demux->p_sys->psz_base &&
!strstr( psz_uri, "://" ) )
{
- char *psz_baseref = p_demux->p_sys->psz_base;
- size_t i_baselen;
- if( psz_baseref )
- i_baselen = strlen( psz_baseref );
- else
- {
- psz_baseref = p_demux->psz_path;
- i_baselen = strrchr( psz_baseref, DIR_SEP_CHAR )
- - psz_baseref + 1;
- }
- char* psz_tmp = malloc( i_baselen +
- strlen( psz_uri ) + 1 );
+ char* psz_tmp = malloc(
+ strlen(p_demux->p_sys->psz_base) +
+ strlen(psz_uri) +1 );
if( !psz_tmp )
{
msg_Err( p_demux, "out of memory");
return VLC_FALSE;
}
- strncpy( psz_tmp, psz_baseref, i_baselen );
- strcpy( psz_tmp + i_baselen, psz_uri );
+ sprintf( psz_tmp, "%s%s",
+ p_demux->p_sys->psz_base, psz_uri );
free( psz_uri );
psz_uri = psz_tmp;
}
return VLC_FALSE;
}
}
- else if( !strcmp( p_handler->name, "identifier" ) &&
- *psz_value >= '0' && *psz_value <= '9' )
+ else if( !strcmp( p_handler->name, "identifier" ) )
{
p_demux->p_sys->i_identifier = atoi( psz_value );
}
msg_Warn( p_demux, "<node> requires \"title\" attribute" );
return VLC_FALSE;
}
- p_new_input = input_ItemNewWithType( VLC_OBJECT(p_playlist), "vlc:nop",
+ p_new_input = input_ItemNewWithType( VLC_OBJECT( p_playlist ), "vlc:skip",
psz_title, 0, NULL, -1, ITEM_TYPE_DIRECTORY );
if( p_new_input )
{
- input_ItemAddSubItem( p_input_item, p_new_input, VLC_TRUE );
+ input_ItemAddSubItem( p_input_item, p_new_input );
p_input_item = p_new_input;
}
free( psz_title );
p_new_input = p_demux->p_sys->pp_tracklist[ i_href ];
if( p_new_input )
{
- input_ItemAddSubItem( p_input_item, p_new_input, VLC_FALSE );
+ input_ItemAddSubItem( p_input_item, p_new_input );
p_demux->p_sys->pp_tracklist[i_href] = NULL;
- vlc_gc_decref( p_new_input );
}
/* kludge for #1293 - XTAG sends ENDELEM for self closing tag */
/* Append item to playlist */
if( p_parent ) /* Add to node */
- input_ItemAddSubItem( p_parent, p_input, VLC_FALSE );
+ input_ItemAddSubItem( p_parent, p_input );
else if( b_play ) /* Play */
playlist_AddInput( p_playlist, p_input,
PLAYLIST_APPEND | PLAYLIST_GO,
input_item_t * p_parent, * p_child;
playlist_item_t * p_child_in_category;
playlist_item_t * p_item_in_category;
- vlc_bool_t b_play, b_node;
+ vlc_bool_t b_play;
p_parent = p_event->p_obj;
p_child = p_event->u.input_item_subitem_added.p_new_child;
- b_node = p_event->u.input_item_subitem_added.b_node;
PL_LOCK;
b_play = var_CreateGetBool( p_playlist, "playlist-autostart" );
if( !p_child_in_category )
{
+ /* Then, transform to a node if needed */
p_item_in_category = playlist_ItemFindFromInputAndRoot(
p_playlist, p_parent->i_id,
p_playlist->p_root_category,
b_play = b_play && p_item_in_category == p_playlist->status.p_item;
- /* If you want to use vlc_input_item_subitem_added event,
- * you must explicitely create nodes */
- assert( p_item_in_category->i_children != -1 );
-
+ /* If this item is already a node don't transform it */
+ if( p_item_in_category->i_children == -1 )
+ {
+ p_item_in_category = playlist_ItemToNode( p_playlist,
+ p_item_in_category, VLC_TRUE );
+ p_item_in_category->p_input->i_type = ITEM_TYPE_PLAYLIST;
+ }
+
playlist_BothAddInput( p_playlist, p_child, p_item_in_category,
PLAYLIST_APPEND | PLAYLIST_SPREPARSE , PLAYLIST_END,
NULL, NULL, VLC_TRUE );
- if( b_node )
- {
- playlist_item_t *p_pl_item, *p_new_pl_item;
- p_pl_item = playlist_ItemFindFromInputAndRoot( p_playlist,
- p_child->i_id, p_playlist->p_root_category, VLC_FALSE );
- p_new_pl_item = playlist_ItemToNode( p_playlist, p_pl_item,
- VLC_TRUE );
- p_new_pl_item->p_input->i_type = ITEM_TYPE_NODE;
- }
-
if( b_play )
{
playlist_Control( p_playlist, PLAYLIST_VIEWPLAY,
/**
* Transform an item to a node. Return the node in the category tree, or NULL
* if not found there
+ * This function must be entered without the playlist lock
*/
playlist_item_t *playlist_ItemToNode( playlist_t *p_playlist,
playlist_item_t *p_item,
{
playlist_t *p_playlist = user_data;
input_item_t *p_item = p_event->u.input_item_subitem_added.p_new_child;
- vlc_bool_t b_node = p_event->u.input_item_subitem_added.b_node;
/* The media library input has one and only one option: "meta-file"
* So we remove that unneeded option. */
playlist_AddInput( p_playlist, p_item, PLAYLIST_APPEND, PLAYLIST_END,
VLC_FALSE, VLC_FALSE );
-
- if( b_node )
- {
- playlist_item_t *p_pl_item, *p_new_pl_item;
- p_pl_item = playlist_ItemFindFromInputAndRoot( p_playlist, p_item->i_id,
- p_playlist->p_root_category, VLC_FALSE );
- p_new_pl_item = playlist_ItemToNode( p_playlist, p_pl_item, VLC_FALSE );
- p_new_pl_item->p_input->i_type = ITEM_TYPE_NODE;
- }
}
int playlist_MLLoad( playlist_t *p_playlist )