]> git.sesse.net Git - vlc/blobdiff - modules/misc/lua/extension.h
Do not store extension pointer in a variable visible from the lua code.
[vlc] / modules / misc / lua / extension.h
index bf15b704848cc5d205b20e4cb5a76143e5f518f6..eb54b385b8e0b34f1a196136ba4a0a0136a5c3ae 100644 (file)
@@ -36,6 +36,18 @@ TYPEDEF_ARRAY( extension_t, array_extension_t );
 #define CMD_TRIGGERMENU 3    /* Arg1 = int*, pointing to id to trigger. free */
 #define CMD_CLICK       4    /* Arg1 = extension_widget_t* */
 #define CMD_CLOSE       5
+#define CMD_SET_INPUT   6    /* No arg. Just signal current input changed */
+#define CMD_UPDATE_META 7    /* No arg. Just signal current input item meta
+                              * changed */
+#define CMD_PLAYING_CHANGED 8 /* Arg1 = int*, New playing status  */
+
+//Data types
+typedef enum
+{
+    LUA_END = 0,
+    LUA_NUM,
+    LUA_TEXT
+} lua_datatype_e;
 
 struct extensions_manager_sys_t
 {
@@ -45,9 +57,6 @@ struct extensions_manager_sys_t
     /* Lock for this list */
     vlc_mutex_t lock;
 
-    /* Lua specific */
-    lua_State *L;
-
     /* Flag indicating that the module is about to be unloaded */
     bool b_killed;
 };
@@ -65,7 +74,11 @@ struct extension_sys_t
     vlc_mutex_t command_lock;
     vlc_mutex_t running_lock;
     vlc_cond_t wait;
-    bool b_exiting;
+
+    /* The input this extension should use for vlc.input
+     * or NULL if it should use playlist's current input */
+    struct input_thread_t *p_input;
+
     extensions_manager_t *p_mgr;     ///< Parent
     /* Queue of commands to execute */
     struct command_t
@@ -74,6 +87,8 @@ struct extension_sys_t
         void *data[10];         ///< Optional void* arguments
         struct command_t *next; ///< Next command
     } *command;
+
+    bool b_exiting;
 };
 
 /* Extensions: manager functions */
@@ -81,20 +96,42 @@ int Activate( extensions_manager_t *p_mgr, extension_t * );
 bool IsActivated( extensions_manager_t *p_mgr, extension_t * );
 int Deactivate( extensions_manager_t *p_mgr, extension_t * );
 void WaitForDeactivation( extension_t *p_ext );
-int PushCommand( extension_t *p_ext, int i_command, ... );
+int __PushCommand( extension_t *ext, bool unique, int cmd, va_list options );
+static inline int PushCommand( extension_t *ext, int cmd, ... )
+{
+    va_list args;
+    va_start( args, cmd );
+    int i_ret = __PushCommand( ext, false, cmd, args );
+    va_end( args );
+    return i_ret;
+}
+static inline int PushCommandUnique( extension_t *ext, int cmd, ... )
+{
+    va_list args;
+    va_start( args, cmd );
+    int i_ret = __PushCommand( ext, true, cmd, args );
+    va_end( args );
+    return i_ret;
+}
 bool LockExtension( extension_t *p_ext );
 void UnlockExtension( extension_t *p_ext );
 
 /* Lua specific functions */
+void vlclua_extension_set( lua_State *L, extension_t * );
 extension_t *vlclua_extension_get( lua_State *L );
 int lua_ExtensionActivate( extensions_manager_t *, extension_t * );
 int lua_ExtensionDeactivate( extensions_manager_t *, extension_t * );
+int lua_ExecuteFunctionVa( extensions_manager_t *p_mgr, extension_t *p_ext,
+                            const char *psz_function, va_list args );
 int lua_ExecuteFunction( extensions_manager_t *p_mgr, extension_t *p_ext,
-                         const char *psz_function );
+                         const char *psz_function, ... );
 int lua_ExtensionWidgetClick( extensions_manager_t *p_mgr,
                               extension_t *p_ext,
                               extension_widget_t *p_widget );
 int lua_ExtensionTriggerMenu( extensions_manager_t *p_mgr,
                               extension_t *p_ext, int id );
 
+/* Dialog specific */
+int lua_DialogFlush( lua_State *L );
+
 #endif // LUA_EXTENSION_H