if( p_playlist )
{
- vlc_object_lock( p_playlist );
+ PL_LOCK;
p_intf->p_sys->i_last_state = (int) PLAYLIST_STOPPED;
msg_rc( STATUS_CHANGE "( stop state: 0 )" );
- vlc_object_unlock( p_playlist );
+ PL_UNLOCK;
}
}
if( (p_input != NULL) && !p_input->b_dead && vlc_object_alive (p_input) &&
(p_playlist != NULL) )
{
- vlc_object_lock( p_playlist );
+ PL_LOCK;
if( (p_intf->p_sys->i_last_state != p_playlist->status.i_status) &&
(p_playlist->status.i_status == PLAYLIST_STOPPED) )
{
p_intf->p_sys->i_last_state = p_playlist->status.i_status;
msg_rc( STATUS_CHANGE "( pause state: 4 )" );
}
- vlc_object_unlock( p_playlist );
+ PL_UNLOCK;
}
if( p_input && b_showpos )
{
intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = pl_Yield( p_intf );
+ bool empty;
- vlc_object_lock( p_playlist );
- if( playlist_IsEmpty( p_playlist ) )
- {
- vlc_object_unlock( p_playlist );
- vlc_object_release( p_playlist );
+ PL_LOCK;
+ empty = playlist_IsEmpty( p_playlist );
+ PL_UNLOCK;
+ vlc_object_release( p_playlist );
+
+ if( empty )
[o_main intfOpenFileGeneric: (id)sender];
- }
- else
- {
- vlc_object_unlock( p_playlist );
- vlc_object_release( p_playlist );
- }
var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_PLAY_PAUSE );
}
i_type = ORDER_NORMAL;
}
- vlc_object_lock( p_playlist );
+ PL_LOCK;
playlist_RecursiveNodeSort( p_playlist, p_playlist->p_root_category, i_mode, i_type );
- vlc_object_unlock( p_playlist );
+ PL_UNLOCK;
vlc_object_release( p_playlist );
[self playlistUpdated];
red.blue = 0;
red.green = 0;
#endif
- vlc_object_lock( p_playlist );
+ PL_LOCK;
for( i_dummy = 0; i_dummy < playlist_CurrentSize(p_playlist) ; i_dummy++ )
{
playlist_item_t *p_item = playlist_ItemGetById( p_playlist, i_dummy, pl_Locked );
-1);
}
}
- vlc_object_unlock( p_playlist );
+ PL_UNLOCK;
}
/*****************************************************************
if (p_playlist)
{
- vlc_object_lock( p_playlist );
- if (playlist_CurrentSize(p_playlist))
+ int s;
+
+ PL_LOCK;
+ s = playlist_CurrentSize(p_playlist);
+ PL_UNLOCK;
+ /* FIXME: This is racy... */
+ if (s)
{
- vlc_object_unlock( p_playlist );
playlist_Play( p_playlist );
gdk_window_lower( p_intf->p_sys->p_window->window );
}
- else
- {
- vlc_object_unlock( p_playlist );
- }
pl_Release( p_intf );
}
}
/// \todo Choose sort method/order - Need more commands
/// \todo Choose the correct view
playlist_t *p_playlist = getIntf()->p_sys->p_playlist;
- vlc_object_lock( p_playlist );
+ PL_LOCK;
playlist_RecursiveNodeSort( p_playlist, p_playlist->p_root_onelevel,
SORT_TITLE, ORDER_NORMAL );
- vlc_object_unlock( p_playlist );
+ PL_UNLOCK;
// Ask for rebuild
Playtree &rVar = VlcProc::instance( getIntf() )->getPlaytreeVar();
/* Update the colour of items */
- vlc_object_lock( p_playlist );
+ PL_LOCK;
if( p_intf->p_sys->i_playing != playlist_CurrentSize( p_playlist ) )
{
// p_playlist->i_index in RED
// if exists, p_intf->p_sys->i_playing in BLACK
p_intf->p_sys->i_playing = p_playlist->i_current_index;
}
- vlc_object_unlock( p_playlist );
+ PL_UNLOCK;
pl_Release( p_intf );
}
ListView_DeleteAllItems( hListView );
/* ...and rebuild it */
- vlc_object_lock( p_playlist );
+ PL_LOCK;
playlist_item_t * p_root = p_playlist->p_local_onelevel;
playlist_item_t * p_child = NULL;
UpdateItem( p_child->i_id );
}
- vlc_object_unlock( p_playlist );
+ PL_UNLOCK;
if ( i_focused )
ListView_SetItemState( hListView, i_focused, LVIS_FOCUSED |
playlist_t *p_playlist = pl_Yield( p_intf );
if( p_playlist == NULL ) return;
- vlc_object_lock( p_playlist);
+ PL_LOCK;
playlist_item_t *p_item = playlist_ItemGetById( p_playlist, i_item, true );
- vlc_object_unlock( p_playlist );
+ PL_UNLOCK;
if( p_item )
{
input_thread_t * vlclua_get_input_internal( lua_State *L )
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
- vlc_object_lock( p_playlist );
+ PL_LOCK;
input_thread_t *p_input = p_playlist->p_input;
if( p_input ) vlc_object_yield( p_input );
- vlc_object_unlock( p_playlist );
+ PL_UNLOCK;
vlclua_release_playlist_internal( p_playlist );
return p_input;
}
static int vlclua_playlist_play( lua_State * L )
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
- vlc_object_lock( p_playlist );
+ PL_LOCK;
playlist_Play( p_playlist );
- vlc_object_unlock( p_playlist );
+ PL_UNLOCK;
vlclua_release_playlist_internal( p_playlist );
return 0;
}
{
int i_id = luaL_checkint( L, 1 );
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
- vlc_object_lock( p_playlist );
+ PL_LOCK;
int i_ret = playlist_Control( p_playlist, PLAYLIST_VIEWPLAY,
true, NULL,
playlist_ItemGetById( p_playlist, i_id,
true ) );
- vlc_object_unlock( p_playlist );
+ PL_UNLOCK;
vlclua_release_playlist_internal( p_playlist );
return vlclua_push_ret( L, i_ret );
}
static int vlclua_playlist_get( lua_State *L )
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
- vlc_object_lock( p_playlist );
+ PL_LOCK;
int b_category = luaL_optboolean( L, 2, 1 ); /* Default to tree playlist (discared when 1st argument is a playlist_item's id) */
playlist_item_t *p_item = NULL;
p_item = playlist_ItemGetById( p_playlist, i_id, true );
if( !p_item )
{
- vlc_object_unlock( p_playlist );
+ PL_UNLOCK;
vlclua_release_playlist_internal( p_playlist );
return 0; /* Should we return an error instead? */
}
}
if( !p_item )
{
- vlc_object_unlock( p_playlist );
+ PL_UNLOCK;
vlclua_release_playlist_internal( p_playlist );
return 0; /* Should we return an error instead? */
}
: p_playlist->p_root_onelevel;
}
push_playlist_item( L, p_item );
- vlc_object_unlock( p_playlist );
+ PL_UNLOCK;
vlclua_release_playlist_internal( p_playlist );
return 1;
}
int b_category = luaL_optboolean( L, 2, 1 ); /* default to category */
playlist_item_t *p_item = b_category ? p_playlist->p_root_category
: p_playlist->p_root_onelevel;
- vlc_object_lock( p_playlist );
+ PL_LOCK;
playlist_LiveSearchUpdate( p_playlist, p_item, psz_string );
- vlc_object_unlock( p_playlist );
+ PL_UNLOCK;
push_playlist_item( L, p_item );
vlclua_release_playlist_internal( p_playlist );
return 1;
int i_type = luaL_optboolean( L, 2, 0 ) ? ORDER_REVERSE : ORDER_NORMAL;
int b_category = luaL_optboolean( L, 3, 1 ); /* default to category */
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
- vlc_object_lock( p_playlist );
+ PL_LOCK;
playlist_item_t *p_root = b_category ? p_playlist->p_local_category
: p_playlist->p_local_onelevel;
int i_ret = playlist_RecursiveNodeSort( p_playlist, p_root, i_mode,
i_type );
- vlc_object_unlock( p_playlist );
+ PL_UNLOCK;
vlclua_release_playlist_internal( p_playlist );
return vlclua_push_ret( L, i_ret );
}
lua_pushstring( L, psz_uri );
free( psz_uri );
lua_pushnumber( L, config_GetInt( p_intf, "volume" ) );*/
- vlc_object_lock( p_playlist );
+ PL_LOCK;
switch( p_playlist->status.i_status )
{
case PLAYLIST_STOPPED:
lua_pushstring( L, "unknown" );
break;
}
- vlc_object_unlock( p_playlist );
+ PL_UNLOCK;
/*i_count += 3;*/
}
else
{
services_discovery_t *p_sd = ( services_discovery_t* )p_this;
services_discovery_sys_t *p_sys = ( services_discovery_sys_t * )
- malloc( sizeof( services_discovery_sys_t ) );
+ malloc( sizeof( services_discovery_sys_t ) );
+ playlist_t *p_playlist = pl_Yield( p_sd );
p_sd->p_sys = p_sys;
- p_sys->p_playlist = pl_Yield( p_sd );
+ p_sys->p_playlist = p_playlist;
Cookie *cookie = &p_sys->cookie;
/* Create our playlist node */
- vlc_object_lock( p_sys->p_playlist );
- playlist_NodesPairCreate( pl_Get( p_sd ), _("Devices"),
+ PL_LOCK;
+ playlist_NodesPairCreate( p_playlist, _("Devices"),
&p_sys->p_node_cat, &p_sys->p_node_one,
true );
- vlc_object_unlock( p_sys->p_playlist );
+ PL_UNLOCK;
cookie->serviceDiscovery = p_sd;
cookie->lock = new Lockable();
{
services_discovery_t *p_sd = ( services_discovery_t* )p_this;
services_discovery_sys_t *p_sys = p_sd->p_sys;
+ playlist_t *p_playlist = p_sys->p_playlist;
UpnpFinish();
delete p_sys->cookie.serverList;
delete p_sys->cookie.lock;
- vlc_object_lock( p_sys->p_playlist );
- playlist_NodeDelete( pl_Get( p_sd ), p_sys->p_node_one, true,
- true );
- playlist_NodeDelete( pl_Get( p_sd ), p_sys->p_node_cat, true,
- true );
- vlc_object_unlock( p_sys->p_playlist );
+ PL_LOCK;
+ playlist_NodeDelete( p_playlist, p_sys->p_node_one, true, true );
+ playlist_NodeDelete( p_playlist, p_sys->p_node_cat, true, true );
+ PL_UNLOCK;
pl_Release( p_sd );
free( p_sys );
}