{
// Get the VLC playlist object
m_pPlaylist = pIntf->p_sys->p_playlist;
+ m_playingIt = end();
i_items_to_append = 0;
playlist_item_t* pNode = (playlist_item_t*)(it->m_pData);
UString *pName = new UString( getIntf(), pNode->p_input->psz_name );
it->m_cString = UStringPtr( pName );
- playlist_Lock( m_pPlaylist );
- it->m_playing = playlist_CurrentPlayingItem( m_pPlaylist ) == pNode;
- playlist_Unlock( m_pPlaylist );
- if( it->m_playing ) descr.b_active_item = true;
}
else
{
notify( &descr );
}
+
+void Playtree::onUpdateCurrent()
+{
+ playlist_Lock( 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;
+ if( m_playingIt != end() )
+ m_playingIt->m_playing = false;
+ m_playingIt = it;
+
+ playlist_Unlock( m_pPlaylist );
+
+ tree_update descr;
+ descr.b_active_item = true;
+ descr.i_type = 0;
+ notify( &descr );
+}
+
+
/// \todo keep a list of "recently removed" to avoid looking up if we
// already removed it
void Playtree::onDelete( int i_id )
/// Function called to notify playlist item update
void onUpdateItem( int id );
+ /// Function called to notify about current playing item
+ void onUpdateCurrent( );
+
/// Function called to notify playlist item append
void onAppend( playlist_add_t * );
/// Update Node's children
void buildNode( playlist_item_t *p_node, VarTree &m_pNode );
+
+ /// keep track of item being played
+ Iterator m_playingIt;
};
#endif