]> git.sesse.net Git - vlc/commitdiff
macosx: set the correct node when we add items and play them at once.
authorDerk-Jan Hartman <hartman@videolan.org>
Sun, 24 Aug 2008 12:09:06 +0000 (14:09 +0200)
committerDerk-Jan Hartman <hartman@videolan.org>
Sun, 24 Aug 2008 12:09:06 +0000 (14:09 +0200)
This fixes #1807
For Mac OS X that is. We might want to consider changing the default behaviour of playlist_Control( PLAYLIST_VIEWPLAY )

modules/gui/macosx/playlist.m

index 5dad4232cebfdd276e66f79fca47ce0d4d0ac883..a03cbd1c60f0ce4fb24aaf72252bb5212443f84d 100644 (file)
 
         if( i_item == 0 && !b_enqueue )
         {
-            playlist_item_t *p_item;
+            playlist_item_t *p_item = NULL;
+            playlist_item_t *p_node = NULL;
             p_item = playlist_ItemGetByInput( p_playlist, p_input, pl_Locked );
-            playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, pl_Locked, NULL, p_item );
+            if( p_item )
+            {
+                if( p_item->i_children == -1 )
+                    p_node = p_item->p_parent;
+                else
+                {
+                    p_node = p_item;
+                    if( p_node->i_children > 0 && p_node->pp_children[0]->i_children == -1 )
+                        p_item = p_node->pp_children[0];
+                    else
+                        p_item = NULL;
+                }
+                playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, pl_Locked, p_node, p_item );
+            }
         }
         vlc_gc_decref( p_input );
     }
         {
             playlist_item_t *p_item;
             p_item = playlist_ItemGetByInput( p_playlist, p_input, pl_Locked );
-            playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, pl_Locked, NULL, p_item );
+            playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, pl_Locked, p_node, p_item );
         }
         PL_UNLOCK;
         vlc_gc_decref( p_input );