[vlc-devel] commit: skins2(playlist): fix current playing item still on when stopping an input (Erwan Tulou )

git version control git at videolan.org
Sun Feb 14 15:07:38 CET 2010


vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Sun Feb 14 14:46:29 2010 +0100| [1b20e18a2731582fbe1112e1ab3921f6956f1a50] | committer: Erwan Tulou 

skins2(playlist): fix current playing item still on when stopping an input

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

 modules/gui/skins2/src/vlcproc.cpp   |    4 ++-
 modules/gui/skins2/vars/playtree.cpp |   35 +++++++++++++++++++++------------
 modules/gui/skins2/vars/playtree.hpp |    2 +-
 3 files changed, 26 insertions(+), 15 deletions(-)

diff --git a/modules/gui/skins2/src/vlcproc.cpp b/modules/gui/skins2/src/vlcproc.cpp
index 59ad84a..76f2ca7 100644
--- a/modules/gui/skins2/src/vlcproc.cpp
+++ b/modules/gui/skins2/src/vlcproc.cpp
@@ -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()
diff --git a/modules/gui/skins2/vars/playtree.cpp b/modules/gui/skins2/vars/playtree.cpp
index 4e96808..8e0584c 100644
--- a/modules/gui/skins2/vars/playtree.cpp
+++ b/modules/gui/skins2/vars/playtree.cpp
@@ -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;
diff --git a/modules/gui/skins2/vars/playtree.hpp b/modules/gui/skins2/vars/playtree.hpp
index 0c1a2ad..147cbe4 100644
--- a/modules/gui/skins2/vars/playtree.hpp
+++ b/modules/gui/skins2/vars/playtree.hpp
@@ -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 * );




More information about the vlc-devel mailing list