#include <vlc_common.h>
#include <vlc_input.h>
+#include <vlc_interface.h>
#include <vlc_events.h>
#include <vlc_dialog.h>
* Extensions capabilities
* Note: #define and ppsz_capabilities must be in sync
*/
-static const char const caps[][20] = {
+static const char caps[][20] = {
#define EXT_HAS_MENU (1 << 0) ///< Hook: menu
"menu",
#define EXT_TRIGGER_ONLY (1 << 1) ///< Hook: trigger. Not activable
static int ScanExtensions( extensions_manager_t *p_this );
static int ScanLuaCallback( vlc_object_t *p_this, const char *psz_script,
- void *dummy );
+ const struct luabatch_context_t * );
static int Control( extensions_manager_t *, int, va_list );
static int GetMenuEntries( extensions_manager_t *p_mgr, extension_t *p_ext,
char ***pppsz_titles, uint16_t **ppi_ids );
* @param dummy: unused
**/
int ScanLuaCallback( vlc_object_t *p_this, const char *psz_filename,
- void *dummy )
+ const struct luabatch_context_t *dummy )
{
VLC_UNUSED(dummy);
extensions_manager_t *p_mgr = ( extensions_manager_t* ) p_this;
if( !p_ext->p_sys->L )
return VLC_SUCCESS;
+ vlclua_fd_interrupt( &p_ext->p_sys->dtable );
+
// Unset and release input objects
if( p_ext->p_sys->p_input )
{
int i_ret = lua_ExecuteFunction( p_mgr, p_ext, "deactivate", LUA_END );
/* Clear Lua State */
+ vlclua_fd_cleanup( &p_ext->p_sys->dtable );
lua_close( p_ext->p_sys->L );
p_ext->p_sys->L = NULL;
return NULL;
}
vlclua_set_this( L, p_mgr );
+ vlclua_set_playlist_internal( L,
+ pl_Get((intf_thread_t *)(p_mgr->p_parent)) );
vlclua_extension_set( L, p_ext );
luaL_openlibs( L );
luaopen_dialog( L, p_ext );
luaopen_input( L );
luaopen_msg( L );
- luaopen_net( L );
+ if( vlclua_fd_init( L, &p_ext->p_sys->dtable ) )
+ {
+ lua_close( L );
+ return NULL;
+ }
luaopen_object( L );
luaopen_osd( L );
luaopen_playlist( L );
- luaopen_sd( L );
+ luaopen_sd_intf( L );
luaopen_stream( L );
luaopen_strings( L );
luaopen_variables( L );
luaopen_vlm( L );
luaopen_volume( L );
luaopen_xml( L );
-#if defined(WIN32) && !VLC_WINSTORE_APP
+#if defined(_WIN32) && !VLC_WINSTORE_APP
luaopen_win( L );
#endif
{
msg_Warn( p_mgr, "Error while setting the module "
"search path for %s", p_ext->psz_name );
+ vlclua_fd_cleanup( &p_ext->p_sys->dtable );
lua_close( L );
return NULL;
}
{
msg_Warn( p_mgr, "Error loading script %s: %s", p_ext->psz_name,
lua_tostring( L, lua_gettop( L ) ) );
+ vlclua_fd_cleanup( &p_ext->p_sys->dtable );
lua_close( L );
return NULL;
}
/* Close lua state for trigger-only extensions */
if( p_ext->p_sys->L )
+ {
+ vlclua_fd_cleanup( &p_ext->p_sys->dtable );
lua_close( p_ext->p_sys->L );
+ }
p_ext->p_sys->L = NULL;
return i_ret;
vlc_mutex_lock( &p_ext->p_sys->command_lock );
- // Do we have a pending Deactivate command?
- if( ( p_ext->p_sys->command &&
- p_ext->p_sys->command->i_command == CMD_DEACTIVATE )
- || ( p_ext->p_sys->command->next
- && p_ext->p_sys->command->next->i_command == CMD_DEACTIVATE) )
- {
- if( p_ext->p_sys->progress )
- {
- dialog_ProgressDestroy( p_ext->p_sys->progress );
- p_ext->p_sys->progress = NULL;
+ for( struct command_t *cmd = p_ext->p_sys->command;
+ cmd != NULL;
+ cmd = cmd->next )
+ if( cmd->i_command == CMD_DEACTIVATE )
+ { /* We have a pending Deactivate command... */
+ if( p_ext->p_sys->progress )
+ {
+ dialog_ProgressDestroy( p_ext->p_sys->progress );
+ p_ext->p_sys->progress = NULL;
+ }
+ vlc_mutex_unlock( &p_ext->p_sys->command_lock );
+ KillExtension( p_mgr, p_ext );
+ return;
}
- vlc_mutex_unlock( &p_ext->p_sys->command_lock );
- KillExtension( p_mgr, p_ext );
- return;
- }
if( !p_ext->p_sys->progress )
{