[vlc-devel] commit: playlist: consistently change input item type when subitems are added (Jakob Leben )

git version control git at videolan.org
Tue Feb 23 12:44:22 CET 2010


vlc | branch: master | Jakob Leben <jleben at videolan.org> | Tue Feb 23 12:39:41 2010 +0100| [abc84401cd082ccd70a8bb07f9d96c3cff12b122] | committer: Jakob Leben 

playlist: consistently change input item type when subitems are added

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=abc84401cd082ccd70a8bb07f9d96c3cff12b122
---

 src/input/item.c    |    4 ----
 src/playlist/item.c |   12 ++++++++++--
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/input/item.c b/src/input/item.c
index 9872e99..416ec19 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -254,10 +254,6 @@ static void post_subitems( input_item_node_t *p_node )
  * the input item children. */
 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 );
-
     input_item_node_t *p_node = input_item_node_Create( p_parent );
     input_item_node_AppendItem( p_node, p_child );
     input_item_node_PostAndDelete( p_node );
diff --git a/src/playlist/item.c b/src/playlist/item.c
index 686f0f4..f3cf196 100644
--- a/src/playlist/item.c
+++ b/src/playlist/item.c
@@ -755,8 +755,16 @@ static void AddItem( playlist_t *p_playlist, playlist_item_t *p_item,
 static void ChangeToNode( playlist_t *p_playlist, playlist_item_t *p_item )
 {
     int i;
-    if( p_item->i_children == -1 )
-        p_item->i_children = 0;
+    if( p_item->i_children != -1 ) return;
+
+    p_item->i_children = 0;
+
+    input_item_t *p_input = p_item->p_input;
+    vlc_mutex_lock( &p_input->lock );
+    p_input->i_type = ITEM_TYPE_NODE;
+    vlc_mutex_unlock( &p_input->lock );
+
+    var_SetAddress( p_playlist, "item-change", p_item->p_input );
 
     /* Remove it from the array of available items */
     ARRAY_BSEARCH( p_playlist->items,->i_id, int, p_item->i_id, i );




More information about the vlc-devel mailing list