]> git.sesse.net Git - vlc/commitdiff
skins2(playlist): fix current playing item still on when stopping an input
authorErwan Tulou <erwan10@videolan.org>
Sun, 14 Feb 2010 13:46:29 +0000 (14:46 +0100)
committerErwan Tulou <erwan10@videolan.org>
Sun, 14 Feb 2010 14:05:24 +0000 (15:05 +0100)
modules/gui/skins2/src/vlcproc.cpp
modules/gui/skins2/vars/playtree.cpp
modules/gui/skins2/vars/playtree.hpp

index 59ad84a7016ed2386961fe951108d7680969566a..76f2ca7924454c79140062c0ea7e65c6798ca729 100644 (file)
@@ -450,7 +450,7 @@ void VlcProc::on_item_current_changed( vlc_object_t* p_obj, vlc_value_t newVal )
     free( psz_uri );
 
     // Update playtree
-    getPlaytreeVar().onUpdateCurrent();
+    getPlaytreeVar().onUpdateCurrent( true );
 }
 
 void VlcProc::on_intf_event_changed( vlc_object_t* p_obj, vlc_value_t newVal )
@@ -727,6 +727,8 @@ void VlcProc::reset_input()
     SET_TEXT( m_cVarStreamURI, UString( getIntf(), "") );
     SET_TEXT( m_cVarStreamBitRate, UString( getIntf(), "") );
     SET_TEXT( m_cVarStreamSampleRate, UString( getIntf(), "") );
+
+    getPlaytreeVar().onUpdateCurrent( false );
 }
 
 void VlcProc::init_variables()
index 4e9680833ff5a0dea0c937b91625d1bb857abc77..8e0584c2f7375be8abfde4aa7877a554fa523cb5 100644 (file)
@@ -144,24 +144,33 @@ void Playtree::onUpdateItem( int id )
 }
 
 
-void Playtree::onUpdateCurrent()
+void Playtree::onUpdateCurrent( bool b_active )
 {
-    playlist_Lock( m_pPlaylist );
-
-    playlist_item_t* current = playlist_CurrentPlayingItem( m_pPlaylist );
-    if( !current )
+    if( !b_active )
     {
-        playlist_Unlock( m_pPlaylist );
-        return;
-    }
+        if( m_playingIt == end() )
+            return;
 
-    Iterator it = findById( current->i_id );
-    it->m_playing = true;
-    if( m_playingIt != end() )
         m_playingIt->m_playing = false;
-    m_playingIt = it;
+        m_playingIt = end();
+    }
+    else
+    {
+        playlist_Lock( m_pPlaylist );
 
-    playlist_Unlock( m_pPlaylist );
+        playlist_item_t* current = playlist_CurrentPlayingItem( m_pPlaylist );
+        if( !current )
+        {
+            playlist_Unlock( m_pPlaylist );
+            return;
+        }
+
+        Iterator it = findById( current->i_id );
+        it->m_playing = true;
+        m_playingIt = it;
+
+        playlist_Unlock( m_pPlaylist );
+    }
 
     tree_update descr;
     descr.b_active_item = true;
index 0c1a2ad742e0d929875a0203e1c4210974e7e6b6..147cbe474075ba455fa4fea04289115168dcf4b4 100644 (file)
@@ -47,7 +47,7 @@ public:
     void onUpdateItem( int id );
 
     /// Function called to notify about current playing item
-    void onUpdateCurrent( );
+    void onUpdateCurrent( bool b_active );
 
     /// Function called to notify playlist item append
     void onAppend( playlist_add_t * );