* 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 ) );
+VLC_EXPORT( void, input_item_PostSubItem, ( input_item_t *p_parent, input_item_t *p_child ) );
/**
- * Start adding multiple subitems at once.
+ * Start adding multiple subitems.
*
- * 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.
+ * Create a root node to hold a tree of subitems for given item
*/
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 ) );
-
/**
* Add a subitem to this input_item and to this input_item_node.
*
- * An input_item_subitem_added event will be sent right away.
+ * A vlc_InputItemSubItemAdded 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
+ * A vlc_InputItemSubItemAdded 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().
+ * Delete a node created with input_item_node_Create() and all its children.
*/
VLC_EXPORT( void, input_item_node_Delete, ( input_item_node_t *p_node ) );
-
+/**
+ * End adding multiple subitems.
+ *
+ * Send a notification that the item pointed to by the given root node
+ * has created new subitems that are pointed to by all the children of the node.
+ * Then delete the node and all its children.
+ *
+ * A vlc_InputItemSubItemTreeAdded event will be sent.
+ */
+VLC_EXPORT( void, input_item_node_PostAndDelete, ( input_item_node_t *p_node ) );
/**
#undef ON_EMPTY
#undef NONEMPTY
- input_item_AddSubItemTree( p_root );
- input_item_node_Delete( p_root );
+ input_item_node_PostAndDelete( p_root );
/* */
for( int i = 0; i < i_cd_text; i++ )
/** \bug we do not autodelete here */
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_PostSubItem( p_item, p_new_loc );
vlc_gc_decref( p_new_loc );
vlc_object_release( p_input );
msg_Dbg( p_demux, "adding ref = `%s'", psz_ref );
input_item_t *p_input = input_item_New( p_demux, psz_ref, NULL );
input_item_CopyOptions( p_current, p_input );
- input_item_AddSubItem( p_current, p_input );
input_item_node_AppendItem( p_subitems, p_input );
vlc_gc_decref( p_input );
}
}
free( psz_ref );
}
- input_item_AddSubItemTree( p_subitems );
- input_item_node_Delete( p_subitems );
+ input_item_node_PostAndDelete( p_subitems );
vlc_object_release( p_input );
}
#endif
}
- input_item_AddSubItemTree( p_subitems );
- input_item_node_Delete( p_subitems );
+ input_item_node_PostAndDelete( p_subitems );
vlc_gc_decref(p_current_input);
return 0; /* Needed for correct operation of go back */
free( psz_elname );
if( p_subitems )
- {
- input_item_AddSubItemTree( p_subitems );
- input_item_node_Delete( p_subitems );
- }
+ input_item_node_PostAndDelete( p_subitems );
vlc_gc_decref( p_current_input );
if( p_xml_reader )
free( psz_line );
}
- input_item_AddSubItemTree( p_subitems );
- input_item_node_Delete( p_subitems );
+ input_item_node_PostAndDelete( p_subitems );
vlc_gc_decref(p_current_input);
return 0; /* Needed for correct operation of go back */
vlc_gc_decref( p_input );
}
- input_item_AddSubItemTree( p_subitems );
- input_item_node_Delete( p_subitems );
+ input_item_node_PostAndDelete( p_subitems );
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_PostSubItem( 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_PostSubItem( p_current_input, p_input );
vlc_gc_decref( p_input );
{ {"dict", COMPLEX_CONTENT, {.cmplx = parse_plist_dict} } };
parse_plist_node( p_demux, p_subitems, NULL, p_xml_reader, "plist",
pl_elements );
- input_item_AddSubItemTree( p_subitems );
- input_item_node_Delete( p_subitems );
+ input_item_node_PostAndDelete( p_subitems );
vlc_gc_decref(p_current_input);
b_cleanup = false;
}
}
- input_item_AddSubItemTree( p_subitems );
- input_item_node_Delete( p_subitems );
+ input_item_node_PostAndDelete( p_subitems );
vlc_gc_decref(p_current_input);
var_Destroy( p_demux, "m3u-extvlcopt" );
return 0; /* Needed for correct operation of go back */
free( psz_name );
psz_name = NULL;
- input_item_AddSubItemTree( p_subitems );
- input_item_node_Delete( p_subitems );
+ input_item_node_PostAndDelete( p_subitems );
vlc_gc_decref(p_current_input);
return 0; /* Needed for correct operation of go back */
xml_ReaderDelete( p_xml, p_xml_reader );
xml_Delete( p_xml );
- input_item_AddSubItemTree( p_subitems );
- input_item_node_Delete( p_subitems );
+ input_item_node_PostAndDelete( p_subitems );
vlc_gc_decref(p_current_input);
return 0; /* Needed for correct operation of go back */
if( p_xml )
xml_Delete( p_xml );
if( p_subitems )
- {
input_item_node_Delete( p_subitems );
- }
vlc_gc_decref(p_current_input);
return -1;
input_item_node_AppendItem( p_subitems, p_input );
vlc_gc_decref( p_input );
}
- input_item_AddSubItemTree( p_subitems );
- input_item_node_Delete( p_subitems );
+ input_item_node_PostAndDelete( p_subitems );
}
i_ret = 0; /* Needed for correct operation of go back */
b_cleanup = false;
}
}
- input_item_AddSubItemTree( p_subitems );
- input_item_node_Delete( p_subitems );
+ input_item_node_PostAndDelete( p_subitems );
vlc_gc_decref(p_current_input);
var_Destroy( p_demux, "m3u-extvlcopt" );
return 0; /* Needed for correct operation of go back */
if( !p_sys->psz_mcast_ip && p_sys->b_rtsp_kasenna )
input_item_AddOption( p_child, "rtsp-kasenna", VLC_INPUT_OPTION_TRUSTED );
- input_item_AddSubItem( p_current_input, p_child );
+ input_item_PostSubItem( 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 */
goto error;
}
- input_item_AddSubItemTree( p_input_node );
+ input_item_node_PostAndDelete( p_input_node );
+ p_input_node = NULL;
i_ret = 0; /* Needed for correct operation of go back */
if( p_xml )
xml_Delete( p_xml );
free( psz_eltname );
- input_item_node_Delete( p_input_node );
+ if( p_input_node ) input_item_node_Delete( p_input_node );
vlc_gc_decref(p_current_input);
return i_ret;
}
}
- input_item_AddSubItemTree( p_subitems );
- input_item_node_Delete( p_subitems );
+ input_item_node_PostAndDelete( p_subitems );
vlc_gc_decref(p_current_input);
var_Destroy( p_demux, "wpl-extvlcopt" );
}
}
- input_item_AddSubItemTree( p_subitems );
- input_item_node_Delete( p_subitems );
+ input_item_node_PostAndDelete( p_subitems );
end:
vlc_gc_decref(p_current_input);
/* create the input item */
input_item_t *p_input = input_item_NewExt( p_demux, psz_mrl,
psz_title, 0, NULL, 0, i_duration );
- input_item_AddSubItem( p_current_input, p_input );
input_item_node_AppendItem( p_subitems, p_input );
FREENULL( psz_mrl );
FREENULL( psz_title );
psz_line = stream_ReadLine( p_demux->s );
}
- input_item_AddSubItemTree( p_subitems );
- input_item_node_Delete( p_subitems );
+ input_item_node_PostAndDelete( p_subitems );
vlc_gc_decref(p_current_input);
var_Destroy( p_demux, "zpl-extvlcopt" );
/* Append item to playlist */
if( p_parent ) /* Add to node */
{
- input_item_AddSubItem( p_parent, p_input );
+ input_item_PostSubItem( p_parent, p_input );
}
else /* Play or Enqueue (preparse) */
/* FIXME: playlist_AddInput() can fail */
}
if( send )
- {
- input_item_node_Delete( p_input_node );
- }
+ input_item_node_PostAndDelete( p_input_node );
}
void MediaServer::setInputItem( input_item_t* p_input_item )
* 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. */
-void input_item_AddSubItem( input_item_t *p_parent, input_item_t *p_child )
+void input_item_PostSubItem( 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_subitem_added(p_parent, 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 );
-}
-
-void input_item_AddSubItemTree ( input_item_node_t *p_root )
-{
- vlc_event_t event;
- event.type = vlc_InputItemSubItemTreeAdded;
- event.u.input_item_subitem_tree_added.p_root = p_root;
- vlc_event_send( &p_root->p_item->event_manager, &event );
+ input_item_node_PostAndDelete( p_node );
}
bool input_item_HasErrorWhenReading( input_item_t *p_item )
p_child );
p_child->p_parent = p_parent;
}
+
+void input_item_node_PostAndDelete( input_item_node_t *p_root )
+{
+ vlc_event_t event;
+ event.type = vlc_InputItemSubItemTreeAdded;
+ event.u.input_item_subitem_tree_added.p_root = p_root;
+ vlc_event_send( &p_root->p_item->event_manager, &event );
+
+ input_item_node_Delete( p_root );
+}
input_GetItem
input_item_AddInfo
input_item_AddOption
-input_item_AddSubItem
-input_item_AddSubItemTree
input_item_CopyOptions
input_item_DelInfo
input_item_GetDuration
input_item_node_AppendNode
input_item_node_Create
input_item_node_Delete
+input_item_node_PostAndDelete
+input_item_PostSubItem
input_item_SetDuration
input_item_SetMeta
input_item_SetName