[vlc-commits] skins2: use playlist_ViewPlay() instead of PLAYLIST_GO

Rémi Denis-Courmont git at videolan.org
Sun May 14 18:39:42 CEST 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun May 14 18:02:18 2017 +0300| [1c57da267a8f6f1a32e0558097c69bca9eec0c7c] | committer: Rémi Denis-Courmont

skins2: use playlist_ViewPlay() instead of PLAYLIST_GO

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

 modules/gui/skins2/vars/playtree.cpp | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/modules/gui/skins2/vars/playtree.cpp b/modules/gui/skins2/vars/playtree.cpp
index fcedca29c5..08f5a0d362 100644
--- a/modules/gui/skins2/vars/playtree.cpp
+++ b/modules/gui/skins2/vars/playtree.cpp
@@ -271,7 +271,7 @@ void Playtree::onUpdateSlider()
 
 void Playtree::insertItems( VarTree& elem, const std::list<std::string>& files, bool start )
 {
-    bool first = true;
+    bool first = start;
     VarTree* p_elem = &elem;
     playlist_item_t* p_node = NULL;
     int i_pos = -1;
@@ -319,9 +319,10 @@ void Playtree::insertItems( VarTree& elem, const std::list<std::string>& files,
         goto fin;
 
     for( std::list<std::string>::const_iterator it = files.begin();
-         it != files.end(); ++it, i_pos++, first = false )
+         it != files.end(); ++it, i_pos++ )
     {
         input_item_t *pItem;
+        playlist_item_t *pPlItem;
 
         if( strstr( it->c_str(), "://" ) )
             pItem = input_item_New( it->c_str(), NULL );
@@ -337,12 +338,13 @@ void Playtree::insertItems( VarTree& elem, const std::list<std::string>& files,
         if( pItem == NULL)
             continue;
 
-        int i_mode = 0;
-        if( first && start )
-            i_mode |= PLAYLIST_GO;
+        pPlItem = playlist_NodeAddInput( m_pPlaylist, pItem, p_node, 0, i_pos );
 
-        playlist_NodeAddInput( m_pPlaylist, pItem, p_node,
-                               i_mode, i_pos );
+        if( likely(pPlItem != NULL) && first )
+        {
+            first = false;
+            playlist_ViewPlay( m_pPlaylist, NULL, pPlItem );
+        }
     }
 
 fin:



More information about the vlc-commits mailing list