]> git.sesse.net Git - vlc/commitdiff
Don't restart playlist after converting current item to node
authorPrzemyslaw Fiala <bl4@playker.info>
Tue, 19 Aug 2008 19:47:57 +0000 (21:47 +0200)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Wed, 20 Aug 2008 00:04:20 +0000 (02:04 +0200)
Signed-off-by: Pierre d'Herbemont <pdherbemont@videolan.org>
src/playlist/item.c

index d982632334bebe98c3a5f9515d24ec199332f5b1..70924e44428482932826de8a7bc669405e46d8f4 100644 (file)
@@ -609,6 +609,26 @@ playlist_item_t *playlist_ItemToNode( playlist_t *p_playlist,
             ChangeToNode( p_playlist, p_item_in_one );
         else
         {
+            playlist_item_t *p_status_item = get_current_status_item( p_playlist );
+            playlist_item_t *p_status_node = get_current_status_node( p_playlist );
+            if( p_item_in_one == p_status_item )
+            {
+                /* We're deleting the current playlist item. Update
+                 * the playlist object to point at the previous item
+                 * so the playlist won't be restarted */
+                playlist_item_t *p_prev_status_item = NULL;
+                int i = 0;
+                while( i < p_status_node->i_children &&
+                       p_status_node->pp_children[i] != p_status_item )
+                {
+                    p_prev_status_item = p_status_node->pp_children[i];
+                    i++;
+                }
+                if( i == p_status_node->i_children )
+                    p_prev_status_item = NULL;
+                if( p_prev_status_item )
+                    set_current_status_item( p_playlist, p_prev_status_item );
+            }
             DeleteFromInput( p_playlist, p_item_in_one->p_input->i_id,
                              p_playlist->p_root_onelevel, false );
         }