]> git.sesse.net Git - vlc/blobdiff - src/input/item.c
input_item: compress two functions into one and rename "Add" into "Post" for clarity...
[vlc] / src / input / item.c
index 5fea1217d4d8338af2112f436593a6b29d628d53..e6f17015eeb5db0d3995d660bada00a7c00f6652 100644 (file)
@@ -262,26 +262,15 @@ static void notify_subitem_added(input_item_t *p_parent, input_item_t *p_child)
  * 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 )
@@ -1043,3 +1032,13 @@ void input_item_node_AppendNode( input_item_node_t *p_parent, input_item_node_t
                  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 );
+}