This means that we don't need input_item_AddSubItem if there is an input_item_node_Append*().
input_item_AddSubItem now send the subitem_tree_added event as well.
VLC_EXPORT( void, input_item_CopyOptions, ( input_item_t *p_parent, input_item_t *p_child ) );
VLC_EXPORT( void, input_item_SetName, ( input_item_t *p_item, const char *psz_name ) );
-/* This won't hold the item, but can tell to interested third parties
+/**
+ * Add one subitem to this item
+ *
+ * This won't hold the item, but can tell to interested third parties
* Like the playlist, that there is a new sub item. With this design
* It is not the input item's responsability to keep all the ref of
* the input item children. */
VLC_EXPORT( void, input_item_AddSubItem, ( input_item_t *p_parent, input_item_t *p_child ) );
+
+/**
+ * Start adding multiple subitems at once.
+ *
+ * This is a hint for the client that he should probably wait for
+ * input_item_AddSubItemTree()'s input_item_subitemtree_added event before
+ * processing any added subitem.
+ */
+VLC_EXPORT( input_item_node_t *, input_item_node_Create, ( input_item_t *p_input ) );
+
+/**
+ * Notify that we are done adding subitems to this tree.
+ *
+ * This send a input_item_subitemtree_added event.
+ */
VLC_EXPORT( void, input_item_AddSubItemTree, ( input_item_node_t *p_root ) );
-/* Will send vlc_InputItemSubItemTreeAdded event, just as input_item_AddSubItemTree */
-VLC_EXPORT( void, input_item_AddSubItem2, ( input_item_t *p_parent, input_item_t *p_child ) );
+/**
+ * Add a subitem to this input_item and to this input_item_node.
+ *
+ * An input_item_subitem_added event will be sent right away.
+ */
+VLC_EXPORT( input_item_node_t *, input_item_node_AppendItem, ( input_item_node_t *p_node, input_item_t *p_item ) );
+
+/**
+ * Add a subitem to this input_item and to this input_item_node.
+ *
+ * An input_item_subitem_added event will be sent right away for the subitem
+ * pointed by input_item_node_t.
+ */
+VLC_EXPORT( void, input_item_node_AppendNode, ( input_item_node_t *p_node, input_item_node_t *p_item ) );
+
+/**
+ * Delete the result of input_item_node_Create().
+ */
+VLC_EXPORT( void, input_item_node_Delete, ( input_item_node_t *p_node ) );
+
+
/**
*/
#define input_item_New( a,b,c ) input_item_NewExt( a, b, c, 0, NULL, 0, -1 )
-VLC_EXPORT( input_item_node_t *, input_item_node_Create, ( input_item_t *p_input ) );
-
-VLC_EXPORT( void, input_item_node_Delete, ( input_item_node_t *p_node ) );
-
-VLC_EXPORT( input_item_node_t *, input_item_node_AppendItem, ( input_item_node_t *p_node, input_item_t *p_item ) );
-
-VLC_EXPORT( void, input_item_node_AppendNode, ( input_item_node_t *p_node, input_item_node_t *p_item ) );
-
/******************
* Input stats
******************/
snprintf( psz_num, sizeof(psz_num), "%d", 1+i );
input_item_SetTrackNum( p_input_item, psz_num );
- input_item_AddSubItem( p_current, p_input_item );
input_item_node_AppendItem( p_root, p_input_item );
vlc_gc_decref( p_input_item );
free( psz_uri ); free( psz_opt ); free( psz_name );
p_new_loc = input_item_New( p_access, psz_location, psz_location );
input_item_t *p_item = input_GetItem( p_input );
input_item_AddSubItem( p_item, p_new_loc );
- input_item_AddSubItem2( p_item, p_new_loc );
vlc_gc_decref( p_new_loc );
vlc_object_release( p_input );
input_item_t *p_input;
p_input = input_item_New( p_demux, psz_string, psz_title_asx );
input_item_CopyOptions( p_current_input, p_input );
- input_item_AddSubItem( p_current_input, p_input );
input_item_node_AppendItem( p_subitems, p_input );
vlc_gc_decref( p_input );
free( psz_string );
uniq_entry_ad_backup = NULL;
vlc_gc_decref( uniq_entry_ad_backup );
}
- input_item_AddSubItem( p_current_input, p_entry );
input_item_node_AppendItem( p_subitems, p_entry );
vlc_gc_decref( p_entry );
}
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_item_AddSubItem( p_current_input, p_entry );
input_item_node_AppendItem( p_subitems, p_entry );
vlc_gc_decref( p_entry );
}
{
msg_Dbg( p_demux, "added unique entry even if ad");
/* If ASX contains a unique entry, we add it, it is probably not an ad */
- input_item_AddSubItem( p_current_input, uniq_entry_ad_backup );
input_item_node_AppendItem( p_subitems, uniq_entry_ad_backup );
vlc_gc_decref( uniq_entry_ad_backup);
}
if( psz_bitrate )
msg_Err( p_demux, "Unsupported meta bitrate" );
- input_item_AddSubItem( p_current_input, p_input );
input_item_node_AppendItem( p_subitems, p_input );
vlc_gc_decref( p_input );
FREENULL( psz_title );
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_node_AppendItem( p_subitems, p_input );
vlc_gc_decref( p_input );
SADD_INFO( "gvp_version", psz_version );
SADD_INFO( "docid", psz_docid );
SADD_INFO( "description", psz_description );
- input_item_AddSubItem( p_current_input, p_input );
input_item_node_AppendItem( p_subitems, p_input );
vlc_gc_decref( p_input );
}
input_item_t *p_current_input = GetCurrentItem(p_demux);
input_item_t *p_input = input_item_New( p_demux, psz_url, psz_url );
input_item_AddSubItem( p_current_input, p_input );
- input_item_AddSubItem2( p_current_input, p_input );
vlc_gc_decref( p_input );
vlc_gc_decref(p_current_input);
input_item_t *p_current_input = GetCurrentItem(p_demux);
input_item_t *p_input = input_item_New( p_demux, psz_url, psz_url );
input_item_AddSubItem( p_current_input, p_input );
- input_item_AddSubItem2( p_current_input, p_input );
vlc_gc_decref( p_input );
msg_Info( p_demux, "Adding '%s'", psz_uri );
p_new_input = input_item_New( p_demux, psz_uri, NULL );
- input_item_AddSubItem( p_input_node->p_item, p_new_input );
input_item_node_AppendItem( p_input_node, p_new_input );
/* add meta info */
input_item_SetArtist( p_input, psz_artist );
if( psz_name ) input_item_SetTitle( p_input, psz_name );
- input_item_AddSubItem( p_current_input, p_input );
input_item_node_AppendItem( p_subitems, p_input );
vlc_gc_decref( p_input );
}
{
p_input = input_item_New( p_demux, psz_mrl, psz_name );
input_item_CopyOptions( p_current_input, p_input );
- input_item_AddSubItem( p_current_input, p_input );
input_item_node_AppendItem( p_subitems, p_input );
vlc_gc_decref( p_input );
}
{
p_input = input_item_New( p_demux, psz_mrl, psz_name );
input_item_CopyOptions( p_current_input, p_input );
- input_item_AddSubItem( p_current_input, p_input );
input_item_node_AppendItem( p_subitems, p_input );
vlc_gc_decref( p_input );
free( psz_mrl_orig );
"%s bytes",
psz_item_size );
}
- input_item_AddSubItem( p_current_input, p_input );
input_item_node_AppendItem( p_subitems, p_input );
vlc_gc_decref( p_input );
FREENULL( psz_item_name );
xml_Delete( p_xml );
if( p_subitems )
{
- input_item_AddSubItemTree( p_subitems );
input_item_node_Delete( p_subitems );
}
p_input, "QuickTime Media Link", type, "%s", field ) ; }
SADD_INFO( "href", psz_href );
SADD_INFO( _("Mime"), psz_mimetype );
- input_item_AddSubItem( p_current_input, p_input );
input_item_node_AppendItem( p_subitems, p_input );
vlc_gc_decref( p_input );
if( psz_qtnext )
{
p_input = input_item_New( p_demux, psz_qtnext, NULL );
- input_item_AddSubItem( p_current_input, p_input );
input_item_node_AppendItem( p_subitems, p_input );
vlc_gc_decref( p_input );
}
if( !EMPTY_STR( psz_cdnum ) ) input_item_SetTrackNum( p_input, psz_cdnum );
if( !EMPTY_STR( psz_comments ) ) input_item_SetDescription( p_input, psz_comments );
- input_item_AddSubItem( p_current_input, p_input );
input_item_node_AppendItem( p_subitems, p_input );
vlc_gc_decref( p_input );
free( psz_mrl );
p_demux->p_sys->i_sid = 0;
p_demux->p_sys->b_rtsp_kasenna = false;
p_demux->p_sys->b_concert = false;
-
+
return VLC_SUCCESS;
}
}
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, 0, p_sys->i_duration, ITEM_TYPE_NET );
-
+
if( !p_child )
{
msg_Err( p_demux, "A valid playlistitem could not be created" );
input_item_AddOption( p_child, "rtsp-kasenna", VLC_INPUT_OPTION_TRUSTED );
input_item_AddSubItem( p_current_input, p_child );
- input_item_AddSubItem2( p_current_input, p_child );
vlc_gc_decref( p_child );
vlc_gc_decref(p_current_input);
return 0; /* Needed for correct operation of go back */
p_input = input_item_New( p_demux, psz_mrl, psz_name );
input_item_CopyOptions( p_input_node->p_item, p_input );
free( psz_mrl );
- input_item_AddSubItem( p_input_node->p_item, p_input );
input_item_node_AppendItem( p_input_node, p_input );
vlc_gc_decref( p_input );
}
input_item_SetNowPlaying( p_input, psz_ct );
if( psz_rt )
input_item_SetRating( p_input, psz_rt );
- input_item_AddSubItem( p_input_node->p_item, p_input );
input_item_node_AppendItem( p_input_node, p_input );
vlc_gc_decref( p_input );
FREENULL( psz_base );
psz_uri = ProcessMRL( psz_uri, p_demux->p_sys->psz_prefix );
p_input = input_item_NewExt( p_demux, psz_uri, psz_uri,
0, NULL, 0, -1 );
- input_item_AddSubItem( p_current_input, p_input );
input_item_node_AppendItem( p_subitems, p_input );
vlc_gc_decref( p_input );
}
input_item_t *p_new_input = p_demux->p_sys->pp_tracklist[i];
if( p_new_input )
{
- input_item_AddSubItem( p_current_input, p_new_input );
input_item_node_AppendItem( p_subitems, p_new_input );
}
}
if( p_sys->i_track_id < 0 )
{
- input_item_AddSubItem( p_input_item, p_new_input );
input_item_node_AppendNode( p_input_node, p_new_node );
vlc_gc_decref( p_new_input );
return true;
ITEM_TYPE_DIRECTORY );
if( p_new_input )
{
- input_item_AddSubItem( p_input_item, p_new_input );
p_input_node =
input_item_node_AppendItem( p_input_node, p_new_input );
p_input_item = p_new_input;
p_new_input = p_demux->p_sys->pp_tracklist[ i_tid ];
if( p_new_input )
{
- input_item_AddSubItem( p_input_node->p_item, p_new_input );
input_item_node_AppendItem( p_input_node, p_new_input );
vlc_gc_decref( p_new_input );
p_demux->p_sys->pp_tracklist[i_tid] = NULL;
if( p_parent ) /* Add to node */
{
input_item_AddSubItem( p_parent, p_input );
- input_item_AddSubItem2( p_parent, p_input );
}
else /* Play or Enqueue (preparse) */
/* FIXME: playlist_AddInput() can fail */
{
Container* container = parent->getContainer( i );
- input_item_t* p_input_item = input_item_New( _p_sd, "vlc://nop", parent->getTitle() );
- input_item_AddSubItem( parent->getInputItem(), p_input_item );
+ input_item_t* p_input_item = input_item_New( _p_sd, "vlc://nop", parent->getTitle() );
input_item_node_t *p_new_node =
input_item_node_AppendItem( p_input_node, p_input_item );
item->getResource(),
item->getTitle() );
assert( p_input_item );
- input_item_AddSubItem( parent->getInputItem(), p_input_item );
input_item_node_AppendItem( p_input_node, p_input_item );
item->setInputItem( p_input_item );
}
if( send )
{
- input_item_AddSubItemTree( p_input_node );
input_item_node_Delete( p_input_node );
}
}
p_i->p_meta = vlc_meta_New();
int status = vlc_meta_GetStatus(p_i->p_meta);
-
+
if( b_not_found )
status |= ITEM_ART_NOTFOUND;
else
status &= ~ITEM_ART_NOTFOUND;
-
+
vlc_meta_SetStatus(p_i->p_meta, status);
-
+
vlc_mutex_unlock( &p_i->lock );
}
p_i->p_meta = vlc_meta_New();
int status = vlc_meta_GetStatus(p_i->p_meta);
-
+
if( b_art_fetched )
status |= ITEM_ART_FETCHED;
else
vlc_event_send( &p_i->event_manager, &event );
}
-/* FIXME GRRRRRRRRRR args should be in the reverse order to be
+/* FIXME GRRRRRRRRRR args should be in the reverse order to be
* consistant with (nearly?) all or copy funcs */
void input_item_CopyOptions( input_item_t *p_parent,
input_item_t *p_child )
vlc_mutex_unlock( &p_parent->lock );
}
+static void notify_subitem_added(input_item_t *p_parent, input_item_t *p_child)
+{
+ /* Notify interested third parties */
+ vlc_event_t event;
+ event.type = vlc_InputItemSubItemAdded;
+ event.u.input_item_subitem_added.p_new_child = p_child;
+ vlc_event_send( &p_parent->event_manager, &event );
+}
+
/* This won't hold the item, but can tell to interested third parties
* Like the playlist, that there is a new sub item. With this design
* It is not the input item's responsability to keep all the ref of
void input_item_AddSubItem( input_item_t *p_parent, input_item_t *p_child )
{
vlc_mutex_lock( &p_parent->lock );
-
p_parent->i_type = ITEM_TYPE_PLAYLIST;
-
vlc_mutex_unlock( &p_parent->lock );
- /* Notify interested third parties */
- vlc_event_t event;
+ notify_subitem_added(p_parent, p_child);
- event.type = vlc_InputItemSubItemAdded;
- event.u.input_item_subitem_added.p_new_child = p_child;
- vlc_event_send( &p_parent->event_manager, &event );
+ input_item_node_t *p_node = input_item_node_Create( p_parent );
+ input_item_node_AppendItem( p_node, p_child );
+ input_item_AddSubItemTree( p_node );
+ input_item_node_Delete( p_node );
}
void input_item_AddSubItemTree ( input_item_node_t *p_root )
vlc_event_send( &p_root->p_item->event_manager, &event );
}
-void input_item_AddSubItem2 ( input_item_t *p_parent, input_item_t *p_child )
-{
- input_item_node_t *p_node = input_item_node_Create( p_parent );
- input_item_node_AppendItem( p_node, p_child );
- input_item_AddSubItemTree( p_node );
- input_item_node_Delete( p_node );
-}
-
bool input_item_HasErrorWhenReading( input_item_t *p_item )
{
vlc_mutex_lock( &p_item->lock );
void input_item_node_AppendNode( input_item_node_t *p_parent, input_item_node_t *p_child )
{
+ notify_subitem_added(p_parent->p_item, p_child->p_item);
+
assert( p_parent && p_child && p_child->p_parent == NULL );
INSERT_ELEM( p_parent->pp_children,
p_parent->i_children,
input_item_AddInfo
input_item_AddOption
input_item_AddSubItem
-input_item_AddSubItem2
input_item_AddSubItemTree
input_item_CopyOptions
input_item_DelInfo