[vlc-devel] commit: playlist: fix first subitem added as last and refactor ( Jakob Leben )

git version control git at videolan.org
Wed Feb 17 01:03:39 CET 2010


vlc | branch: master | Jakob Leben <jleben at videolan.org> | Wed Feb 17 00:24:36 2010 +0100| [d46336c648b03523d46c49673f2f81648d496e5f] | committer: Jakob Leben 

playlist: fix first subitem added as last and refactor

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

 src/playlist/item.c |   29 ++++++++++++++++-------------
 1 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/playlist/item.c b/src/playlist/item.c
index a234ffb..3b639de 100644
--- a/src/playlist/item.c
+++ b/src/playlist/item.c
@@ -63,9 +63,9 @@ static void input_item_add_subitem_tree ( const vlc_event_t * p_event,
     playlist_item_t *p_parent = p_item->p_parent;
     assert( p_parent != NULL );
 
-    bool b_play = var_CreateGetBool( p_playlist, "playlist-autostart" ) &&
-                  get_current_status_item( p_playlist ) == p_item;
-    bool b_stop = b_play && p_item->i_flags & PLAYLIST_SUBITEM_STOP_FLAG;
+    bool b_current = get_current_status_item( p_playlist ) == p_item;
+    bool b_autostart = var_CreateGetBool( p_playlist, "playlist-autostart" );
+    bool b_stop = p_item->i_flags & PLAYLIST_SUBITEM_STOP_FLAG;
     p_item->i_flags &= ~PLAYLIST_SUBITEM_STOP_FLAG;
 
     int pos = 0;
@@ -98,20 +98,23 @@ static void input_item_add_subitem_tree ( const vlc_event_t * p_event,
     }
     else
         p_item = playlist_InsertInputItemTree( p_playlist, p_item,
-                                               p_new_root, p_item->i_children, false );
+                                               p_new_root, PLAYLIST_END, false );
 
     if( !b_flat ) var_SetAddress( p_playlist, "leaf-to-parent", p_input );
 
-    if( b_stop && !b_flat )
+    if( b_current )
     {
-        PL_UNLOCK;
-        playlist_Stop( p_playlist );
-        return;
-    }
-    else if( b_play )
-    {
-        playlist_Control( p_playlist, PLAYLIST_VIEWPLAY,
-                          pl_Locked, get_current_status_node( p_playlist ), p_item );
+        if( b_stop || !b_autostart )
+        {
+            PL_UNLOCK;
+            playlist_Stop( p_playlist );
+            return;
+        }
+        else
+        {
+            playlist_Control( p_playlist, PLAYLIST_VIEWPLAY,
+                pl_Locked, get_current_status_node( p_playlist ), p_item );
+        }
     }
 
     PL_UNLOCK;




More information about the vlc-devel mailing list