* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
-#include <vlc/vlc.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
#include "playtree.hpp"
#include <vlc_playlist.h>
void Playtree::delSelected()
{
Iterator it = begin();
- vlc_mutex_lock( &getIntf()->p_sys->p_playlist->object_lock );
+ playlist_Lock( getIntf()->p_sys->p_playlist );
for( it = begin(); it != end(); it = getNextVisibleItem( it ) )
{
if( (*it).m_selected && !(*it).isReadonly() )
if( p_item->i_children == -1 )
{
playlist_DeleteFromInput( getIntf()->p_sys->p_playlist,
- p_item->p_input->i_id, VLC_TRUE );
+ p_item->p_input, pl_Locked );
it2 = getNextVisibleItem( it ) ;
it->parent()->removeChild( it );
it = it2;
else
{
playlist_NodeDelete( getIntf()->p_sys->p_playlist, p_item,
- VLC_TRUE, VLC_FALSE );
+ true, false );
it2 = getNextSibling( it );
it->parent()->removeChild( it );
it = it2;
it = getNextVisibleItem( it );
}
}
- vlc_mutex_unlock( &getIntf()->p_sys->p_playlist->object_lock );
+ playlist_Unlock( getIntf()->p_sys->p_playlist );
}
void Playtree::action( VarTree *pItem )
{
- vlc_mutex_lock( &m_pPlaylist->object_lock );
+ playlist_Lock( m_pPlaylist );
VarTree::Iterator it;
playlist_item_t *p_item = (playlist_item_t *)pItem->m_pData;
if( p_parent )
{
- playlist_Control( m_pPlaylist, PLAYLIST_VIEWPLAY, VLC_TRUE, p_parent, p_item );
+ playlist_Control( m_pPlaylist, PLAYLIST_VIEWPLAY, pl_Locked, p_parent, p_item );
}
- vlc_mutex_unlock( &m_pPlaylist->object_lock );
+ playlist_Unlock( m_pPlaylist );
}
void Playtree::onChange()
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 );
- it->m_playing = m_pPlaylist->status.p_item == pNode;
+ 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
Iterator item = findById( p_add->i_item );
if( item == end() )
{
+ playlist_Lock( m_pPlaylist );
playlist_item_t *p_item = playlist_ItemGetById(
- m_pPlaylist, p_add->i_item, VLC_TRUE );
- if( !p_item ) return;
+ m_pPlaylist, p_add->i_item );
+ if( !p_item )
+ {
+ playlist_Unlock( m_pPlaylist );
+ return;
+ }
UString *pName = new UString( getIntf(),
p_item->p_input->psz_name );
node->add( p_add->i_item, UStringPtr( pName ),
false,false, false, p_item->i_flags & PLAYLIST_RO_FLAG,
p_item );
+ playlist_Unlock( m_pPlaylist );
}
}
tree_update descr;
{
UString *pName = new UString( getIntf(),
pNode->pp_children[i]->p_input->psz_name );
- rTree.add( pNode->pp_children[i]->p_input->i_id, UStringPtr( pName ),
+ rTree.add( pNode->pp_children[i]->i_id, UStringPtr( pName ),
false,
- m_pPlaylist->status.p_item == pNode->pp_children[i],
+ playlist_CurrentPlayingItem(m_pPlaylist) == pNode->pp_children[i],
false, pNode->pp_children[i]->i_flags & PLAYLIST_RO_FLAG,
pNode->pp_children[i] );
if( pNode->pp_children[i]->i_children )
void Playtree::buildTree()
{
clear();
- vlc_mutex_lock( &m_pPlaylist->object_lock );
+ playlist_Lock( m_pPlaylist );
i_items_to_append = 0;
buildNode( m_pPlaylist->p_root_category, *this );
- vlc_mutex_unlock( &m_pPlaylist->object_lock );
+ playlist_Unlock( m_pPlaylist );
// What is it ?
// checkParents( NULL );
}