in lua-http interface, but if someone could double check it would be nice.
msg_Err( p_demux, "Script went completely foobar" );
vlc_object_release( p_input_thread );
msg_Err( p_demux, "Script went completely foobar" );
vlc_object_release( p_input_thread );
- pl_Release( p_playlist );
+ vlclua_release_playlist_internal( p_playlist );
return -1; /* Needed for correct operation of go back */
}
return -1; /* Needed for correct operation of go back */
}
input_thread_t * vlclua_get_input_internal( lua_State *L )
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
input_thread_t * vlclua_get_input_internal( lua_State *L )
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
+ vlc_object_lock( p_playlist );
input_thread_t *p_input = p_playlist->p_input;
if( p_input ) vlc_object_yield( p_input );
input_thread_t *p_input = p_playlist->p_input;
if( p_input ) vlc_object_yield( p_input );
- pl_Release( p_playlist );
+ vlc_object_unlock( p_playlist );
+ vlclua_release_playlist_internal( p_playlist );
return p_input;
}
static int vlclua_input_info( lua_State *L )
{
input_thread_t * p_input = vlclua_get_input_internal( L );
return p_input;
}
static int vlclua_input_info( lua_State *L )
{
input_thread_t * p_input = vlclua_get_input_internal( L );
+ vlc_object_lock( p_input );
int i_cat;
int i;
if( !p_input ) return vlclua_error( L );
int i_cat;
int i;
if( !p_input ) return vlclua_error( L );
}
lua_settable( L, -3 );
}
}
lua_settable( L, -3 );
}
- //vlc_object_release( p_input );
+ vlc_object_unlock( p_input );
+ vlc_object_release( p_input );
vlclua_push_vlc_object( L, p_playlist, vlclua_gc_release );
}
else lua_pushnil( L );
vlclua_push_vlc_object( L, p_playlist, vlclua_gc_release );
}
else lua_pushnil( L );
+ //vlclua_release_playlist_internal( p_playlist );
return pl_Yield( p_this );
}
return pl_Yield( p_this );
}
+void vlclua_release_playlist_internal( playlist_t *p_playlist )
+{
+ pl_Release( p_playlist );
+}
+
static int vlclua_playlist_prev( lua_State * L )
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
playlist_Prev( p_playlist );
static int vlclua_playlist_prev( lua_State * L )
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
playlist_Prev( p_playlist );
- pl_Release( p_playlist );
+ vlclua_release_playlist_internal( p_playlist );
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
playlist_Next( p_playlist );
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
playlist_Next( p_playlist );
- pl_Release( p_playlist );
+ vlclua_release_playlist_internal( p_playlist );
int i_skip = luaL_checkint( L, 1 );
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
playlist_Skip( p_playlist, i_skip );
int i_skip = luaL_checkint( L, 1 );
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
playlist_Skip( p_playlist, i_skip );
- pl_Release( p_playlist );
+ vlclua_release_playlist_internal( p_playlist );
return 0;
}
static int vlclua_playlist_play( lua_State * L )
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
return 0;
}
static int vlclua_playlist_play( lua_State * L )
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
+ vlc_object_lock( p_playlist );
playlist_Play( p_playlist );
playlist_Play( p_playlist );
- pl_Release( p_playlist );
+ vlc_object_unlock( p_playlist );
+ vlclua_release_playlist_internal( p_playlist );
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
playlist_Pause( p_playlist );
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
playlist_Pause( p_playlist );
- pl_Release( p_playlist );
+ vlclua_release_playlist_internal( p_playlist );
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
playlist_Stop( p_playlist );
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
playlist_Stop( p_playlist );
- pl_Release( p_playlist );
+ vlclua_release_playlist_internal( p_playlist );
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
playlist_Stop( p_playlist ); /* Isn't this already implied by Clear? */
playlist_Clear( p_playlist, pl_Unlocked );
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
playlist_Stop( p_playlist ); /* Isn't this already implied by Clear? */
playlist_Clear( p_playlist, pl_Unlocked );
- pl_Release( p_playlist );
+ vlclua_release_playlist_internal( p_playlist );
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
int i_ret = vlclua_var_toggle_or_set( L, p_playlist, "repeat" );
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
int i_ret = vlclua_var_toggle_or_set( L, p_playlist, "repeat" );
- pl_Release( p_playlist );
+ vlclua_release_playlist_internal( p_playlist );
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
int i_ret = vlclua_var_toggle_or_set( L, p_playlist, "loop" );
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
int i_ret = vlclua_var_toggle_or_set( L, p_playlist, "loop" );
- pl_Release( p_playlist );
+ vlclua_release_playlist_internal( p_playlist );
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
int i_ret = vlclua_var_toggle_or_set( L, p_playlist, "random" );
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
int i_ret = vlclua_var_toggle_or_set( L, p_playlist, "random" );
- pl_Release( p_playlist );
+ vlclua_release_playlist_internal( p_playlist );
{
int i_id = luaL_checkint( L, 1 );
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
{
int i_id = luaL_checkint( L, 1 );
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
+ vlc_object_lock( p_playlist );
int i_ret = playlist_Control( p_playlist, PLAYLIST_VIEWPLAY,
true, NULL,
playlist_ItemGetById( p_playlist, i_id,
true ) );
int i_ret = playlist_Control( p_playlist, PLAYLIST_VIEWPLAY,
true, NULL,
playlist_ItemGetById( p_playlist, i_id,
true ) );
- pl_Release( p_playlist );
+ vlc_object_unlock( p_playlist );
+ vlclua_release_playlist_internal( p_playlist );
return vlclua_push_ret( L, i_ret );
}
return vlclua_push_ret( L, i_ret );
}
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
i_count = vlclua_playlist_add_internal( p_this, L, p_playlist,
NULL, true );
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
i_count = vlclua_playlist_add_internal( p_this, L, p_playlist,
NULL, true );
- pl_Release( p_playlist );
+ vlclua_release_playlist_internal( p_playlist );
lua_pushinteger( L, i_count );
return 1;
}
lua_pushinteger( L, i_count );
return 1;
}
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
i_count = vlclua_playlist_add_internal( p_this, L, p_playlist,
NULL, false );
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
i_count = vlclua_playlist_add_internal( p_this, L, p_playlist,
NULL, false );
- pl_Release( p_playlist );
+ vlclua_release_playlist_internal( p_playlist );
lua_pushinteger( L, i_count );
return 1;
}
lua_pushinteger( L, i_count );
return 1;
}
static void push_playlist_item( lua_State *L, playlist_item_t *p_item )
{
input_item_t *p_input = p_item->p_input;
static void push_playlist_item( lua_State *L, playlist_item_t *p_item )
{
input_item_t *p_input = p_item->p_input;
- int i_flags = p_item->i_flags;
+ int i_flags = 0;
+ i_flags = p_item->i_flags;
lua_newtable( L );
lua_pushinteger( L, p_item->i_id );
lua_setfield( L, -2, "id" );
lua_newtable( L );
lua_pushinteger( L, p_item->i_id );
lua_setfield( L, -2, "id" );
static int vlclua_playlist_get( lua_State *L )
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
static int vlclua_playlist_get( lua_State *L )
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
+ vlc_object_lock( p_playlist );
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;
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 )
{
p_item = playlist_ItemGetById( p_playlist, i_id, true );
if( !p_item )
{
- pl_Release( p_playlist );
+ vlclua_release_playlist_internal( p_playlist );
+ vlc_object_unlock( p_playlist );
return 0; /* Should we return an error instead? */
}
}
return 0; /* Should we return an error instead? */
}
}
- pl_Release( p_playlist );
+ vlc_object_unlock( p_playlist );
+ vlclua_release_playlist_internal( p_playlist );
return 0; /* Should we return an error instead? */
}
}
return 0; /* Should we return an error instead? */
}
}
: p_playlist->p_root_onelevel;
}
push_playlist_item( L, p_item );
: p_playlist->p_root_onelevel;
}
push_playlist_item( L, p_item );
- pl_Release( p_playlist );
+ vlc_object_unlock( p_playlist );
+ vlclua_release_playlist_internal( p_playlist );
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;
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 );
playlist_LiveSearchUpdate( p_playlist, p_item, psz_string );
playlist_LiveSearchUpdate( p_playlist, p_item, psz_string );
+ vlc_object_unlock( p_playlist );
push_playlist_item( L, p_item );
push_playlist_item( L, p_item );
- pl_Release( p_playlist );
+ vlclua_release_playlist_internal( p_playlist );
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
lua_pushinteger( L, var_GetInteger( p_playlist, "playlist-current" ) );
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
lua_pushinteger( L, var_GetInteger( p_playlist, "playlist-current" ) );
- pl_Release( p_playlist );
+ vlclua_release_playlist_internal( p_playlist );
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 );
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 );
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 );
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 );
- pl_Release( p_playlist );
+ vlc_object_unlock( p_playlist );
+ vlclua_release_playlist_internal( p_playlist );
return vlclua_push_ret( L, i_ret );
}
/* FIXME: split this in 3 different functions? */
static int vlclua_playlist_status( lua_State *L )
{
return vlclua_push_ret( L, i_ret );
}
/* FIXME: split this in 3 different functions? */
static int vlclua_playlist_status( lua_State *L )
{
- intf_thread_t *p_intf = (intf_thread_t *)vlclua_get_this( L );
- playlist_t *p_playlist = pl_Yield( p_intf );
+ playlist_t *p_playlist = vlclua_get_playlist_internal( L );
/*
int i_count = 0;
lua_settop( L, 0 );*/
/*
int i_count = 0;
lua_settop( L, 0 );*/
{
lua_pushstring( L, "stopped" );
}
{
lua_pushstring( L, "stopped" );
}
- pl_Release( p_playlist );
+ vlclua_release_playlist_internal( p_playlist );
#define VLC_LUA_PLAYLIST_H
playlist_t *vlclua_get_playlist_internal( lua_State * );
#define VLC_LUA_PLAYLIST_H
playlist_t *vlclua_get_playlist_internal( lua_State * );
+void vlclua_release_playlist_internal( playlist_t * );
const char *psz_sd = luaL_checkstring( L, 1 );
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
int i_ret = playlist_ServicesDiscoveryAdd( p_playlist, psz_sd );
const char *psz_sd = luaL_checkstring( L, 1 );
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
int i_ret = playlist_ServicesDiscoveryAdd( p_playlist, psz_sd );
- pl_Release( p_playlist );
+ vlclua_release_playlist_internal( p_playlist );
return vlclua_push_ret( L, i_ret );
}
return vlclua_push_ret( L, i_ret );
}
const char *psz_sd = luaL_checkstring( L, 1 );
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
int i_ret = playlist_ServicesDiscoveryRemove( p_playlist, psz_sd );
const char *psz_sd = luaL_checkstring( L, 1 );
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
int i_ret = playlist_ServicesDiscoveryRemove( p_playlist, psz_sd );
- pl_Release( p_playlist );
+ vlclua_release_playlist_internal( p_playlist );
return vlclua_push_ret( L, i_ret );
}
return vlclua_push_ret( L, i_ret );
}
const char *psz_sd = luaL_checkstring( L, 1 );
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
lua_pushboolean( L, playlist_IsServicesDiscoveryLoaded( p_playlist, psz_sd ));
const char *psz_sd = luaL_checkstring( L, 1 );
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
lua_pushboolean( L, playlist_IsServicesDiscoveryLoaded( p_playlist, psz_sd ));
- pl_Release( p_playlist );
+ vlclua_release_playlist_internal( p_playlist );