extension.c File Reference

Include dependency graph for extension.c:


Defines

#define EXT_HAS_MENU   (1 << 0)
 Hook: menu.
#define EXT_TRIGGER_ONLY   (1 << 1)
 Hook: trigger. Not activable.
#define EXT_INPUT_LISTENER   (1 << 2)
 Hook: input_changed.
#define EXT_META_LISTENER   (1 << 3)
 Hook: meta_changed.
#define EXT_PLAYING_LISTENER   (1 << 4)
 Hook: status_changed.

Functions

static int ScanExtensions (extensions_manager_t *p_mgr)
 Batch scan all Lua files in folder "extensions".
static int ScanLuaCallback (vlc_object_t *p_this, const char *psz_script, void *pb_continue)
 Batch scan all Lua files in folder "extensions": callback.
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)
 Get the list of menu entries from an extension script.
static lua_StateGetLuaState (extensions_manager_t *p_mgr, extension_t *p_ext)
static int TriggerMenu (extension_t *p_ext, int id)
static int TriggerExtension (extensions_manager_t *p_mgr, extension_t *p_ext)
 Directly trigger an extension, without activating it This is NOT multithreaded, and this code runs in the UI thread.
int vlclua_extension_deactivate (lua_State *L)
 Deactivate an extension by order from the extension itself.
static int vlclua_extension_dialog_callback (vlc_object_t *p_this, char const *psz_var, vlc_value_t oldval, vlc_value_t newval, void *p_data)
 Callback for the variable "dialog-event".
static void inputItemMetaChanged (const vlc_event_t *p_event, void *data)
 Callback on vlc_InputItemMetaChanged event.
int Open_Extension (vlc_object_t *p_this)
 Module entry-point.
void Close_Extension (vlc_object_t *p_this)
 Module unload function.
int lua_ExtensionActivate (extensions_manager_t *p_mgr, extension_t *p_ext)
int lua_ExtensionDeactivate (extensions_manager_t *p_mgr, extension_t *p_ext)
int lua_ExtensionWidgetClick (extensions_manager_t *p_mgr, extension_t *p_ext, extension_widget_t *p_widget)
int lua_ExecuteFunction (extensions_manager_t *p_mgr, extension_t *p_ext, const char *psz_function,...)
int lua_ExecuteFunctionVa (extensions_manager_t *p_mgr, extension_t *p_ext, const char *psz_function, va_list args)
 Execute a function in a Lua script.
int lua_ExtensionTriggerMenu (extensions_manager_t *p_mgr, extension_t *p_ext, int id)
void vlclua_extension_set (lua_State *L, extension_t *p_ext)
 Set extension associated to the current script.
extension_tvlclua_extension_get (lua_State *L)
 Retrieve extension associated to the current script.
bool LockExtension (extension_t *p_ext)
void UnlockExtension (extension_t *p_ext)

Variables

static const luaL_Reg p_reg []
const char *const ppsz_capabilities []

Define Documentation

#define EXT_HAS_MENU   (1 << 0)

Hook: menu.

Referenced by Control(), and GetMenuEntries().

#define EXT_INPUT_LISTENER   (1 << 2)

Hook: input_changed.

Referenced by Control().

#define EXT_META_LISTENER   (1 << 3)

Hook: meta_changed.

Referenced by Control(), and lua_ExtensionDeactivate().

#define EXT_PLAYING_LISTENER   (1 << 4)

Hook: status_changed.

Referenced by Control().

#define EXT_TRIGGER_ONLY   (1 << 1)

Hook: trigger. Not activable.

Referenced by Control().


Function Documentation

void Close_Extension ( vlc_object_t p_this  ) 

static int Control ( extensions_manager_t p_mgr,
int  i_control,
va_list  args 
) [static]

static lua_State * GetLuaState ( extensions_manager_t p_mgr,
extension_t p_ext 
) [static]

static int GetMenuEntries ( extensions_manager_t p_mgr,
extension_t p_ext,
char ***  pppsz_titles,
uint16_t **  ppi_ids 
) [static]

Get the list of menu entries from an extension script.

Parameters:
p_mgr 
p_ext 
pppsz_titles Pointer to NULL. All strings must be freed by the caller
ppi_ids Pointer to NULL. Must be freed by the caller.
Note:
This function is allowed to run in the UI thread. This means that it MUST respond very fast.
Todo:
Remove the menu() hook and provide a new function vlc.set_menu()

References EXT_HAS_MENU, GetLuaState(), extension_sys_t::i_capabilities, IsActivated(), LockExtension(), msg_Dbg, msg_Warn, extension_t::p_sys, extension_t::psz_name, strdup(), UnlockExtension(), VLC_EGENERIC, and VLC_SUCCESS.

Referenced by Control().

static void inputItemMetaChanged ( const vlc_event_t p_event,
void *  data 
) [static]

Callback on vlc_InputItemMetaChanged event.

References CMD_UPDATE_META, PushCommandUnique(), vlc_event_t::type, and vlc_InputItemMetaChanged.

Referenced by Control().

bool LockExtension ( extension_t p_ext  ) 

int lua_ExecuteFunction ( extensions_manager_t p_mgr,
extension_t p_ext,
const char *  psz_function,
  ... 
)

int lua_ExecuteFunctionVa ( extensions_manager_t p_mgr,
extension_t p_ext,
const char *  psz_function,
va_list  args 
)

Execute a function in a Lua script.

Parameters:
psz_function Name of global function to execute. If NULL, assume that the function object is already on top of the stack.
Returns:
< 0 in case of failure, >= 0 in case of success
Note:
It's better to call this function from a dedicated thread (see extension_thread.c)

References GetLuaState(), lua_DialogFlush(), LUA_END, LUA_NUM, LUA_TEXT, msg_Warn, extension_t::psz_name, and VLC_EGENERIC.

Referenced by lua_ExecuteFunction().

int lua_ExtensionActivate ( extensions_manager_t p_mgr,
extension_t p_ext 
)

References LUA_END, and lua_ExecuteFunction().

int lua_ExtensionDeactivate ( extensions_manager_t p_mgr,
extension_t p_ext 
)

int lua_ExtensionTriggerMenu ( extensions_manager_t p_mgr,
extension_t p_ext,
int  id 
)

int lua_ExtensionWidgetClick ( extensions_manager_t p_mgr,
extension_t p_ext,
extension_widget_t p_widget 
)

int Open_Extension ( vlc_object_t p_this  ) 

static int ScanExtensions ( extensions_manager_t p_mgr  )  [static]

Batch scan all Lua files in folder "extensions".

Parameters:
p_mgr This extensions_manager_t object

References ScanLuaCallback(), VLC_EGENERIC, VLC_OBJECT, VLC_SUCCESS, and vlclua_scripts_batch_execute().

Referenced by Open_Extension().

int ScanLuaCallback ( vlc_object_t p_this,
const char *  psz_script,
void *  pb_continue 
) [static]

static int TriggerExtension ( extensions_manager_t p_mgr,
extension_t p_ext 
) [static]

Directly trigger an extension, without activating it This is NOT multithreaded, and this code runs in the UI thread.

Parameters:
p_mgr 
p_ext Extension to trigger
Returns:
Value returned by the lua function "trigger"

References extension_sys_t::L, LUA_END, lua_ExecuteFunction(), and extension_t::p_sys.

Referenced by Control().

static int TriggerMenu ( extension_t p_ext,
int  id 
) [inline, static]

References CMD_TRIGGERMENU, and PushCommand().

Referenced by Control().

void UnlockExtension ( extension_t p_ext  ) 

int vlclua_extension_deactivate ( lua_State L  ) 

Deactivate an extension by order from the extension itself.

Parameters:
L lua_State
Note:
This is an asynchronous call. A script calling vlc.deactivate() will be executed to the end before the last call to deactivate() is done.

References Deactivate(), extension_sys_t::p_mgr, extension_t::p_sys, VLC_SUCCESS, and vlclua_extension_get().

Referenced by GetLuaState().

static int vlclua_extension_dialog_callback ( vlc_object_t p_this,
char const *  psz_var,
vlc_value_t  oldval,
vlc_value_t  newval,
void *  p_data 
) [static]

Callback for the variable "dialog-event".

Parameters:
p_this Current object owner of the extension and the dialog
psz_var "dialog-event"
oldval Unused
newval Address of the dialog
p_data Unused

References CMD_CLICK, CMD_CLOSE, extension_dialog_command_t::event, EXTENSION_EVENT_CLICK, EXTENSION_EVENT_CLOSE, msg_Dbg, vlc_value_t::p_address, extension_dialog_command_t::p_data, extension_dialog_command_t::p_dlg, extension_dialog_t::p_sys, PushCommandUnique(), and VLC_SUCCESS.

Referenced by Open_Extension().

extension_t* vlclua_extension_get ( lua_State L  ) 

Retrieve extension associated to the current script.

Parameters:
L current lua_State
Returns:
Extension pointer

References vlclua_extension_set().

Referenced by vlclua_extension_deactivate(), and vlclua_get_input_internal().

void vlclua_extension_set ( lua_State L,
extension_t p_ext 
)

Set extension associated to the current script.

Parameters:
L current lua_State
p_ext the extension

References vlclua_extension_set().

Referenced by GetLuaState(), vlclua_extension_get(), and vlclua_extension_set().


Variable Documentation

const luaL_Reg p_reg[] [static]

Initial value:

{
    { NULL, NULL }
}

const char* const ppsz_capabilities[]

Initial value:

 {
    "menu",
    "trigger",
    "input-listener",
    "meta-listener",
    "playing-listener",
    NULL
}

Referenced by ScanLuaCallback().


Generated on Tue May 25 08:05:25 2010 for VLC by  doxygen 1.5.6