lua extensions: remove dummy function (moreover vlc_join is simpler to understand)
[vlc/asuraparaju-public.git] / modules / misc / lua / extension.h
blob261de76dedeec78f7c321d5cad7b69f57beff0cd
1 /*****************************************************************************
2 * extension.h: Lua Extensions (meta data, web information, ...)
3 *****************************************************************************
4 * Copyright (C) 2009-2010 VideoLAN and authors
5 * $Id$
7 * Authors: Jean-Philippe André < jpeg # videolan.org >
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 #ifndef LUA_EXTENSION_H
25 #define LUA_EXTENSION_H
27 #include <vlc_extensions.h>
28 #include <vlc_arrays.h>
30 /* List of available commands */
31 typedef enum
33 CMD_ACTIVATE = 1,
34 CMD_DEACTIVATE,
35 CMD_TRIGGERMENU, /* Arg1 = int*, pointing to id to trigger. free */
36 CMD_CLICK, /* Arg1 = extension_widget_t* */
37 CMD_CLOSE,
38 CMD_SET_INPUT, /* No arg. Just signal current input changed */
39 CMD_UPDATE_META, /* No arg. Just signal current input item meta changed */
40 CMD_PLAYING_CHANGED /* Arg1 = int*, New playing status */
41 } command_type_e;
43 //Data types
44 typedef enum
46 LUA_END = 0,
47 LUA_NUM,
48 LUA_TEXT
49 } lua_datatype_e;
51 struct extensions_manager_sys_t
53 /* List of activated extensions */
54 DECL_ARRAY( extension_t* ) activated_extensions;
56 /* Lock for this list */
57 vlc_mutex_t lock;
59 /* Flag indicating that the module is about to be unloaded */
60 bool b_killed;
63 struct extension_sys_t
65 /* Extension general */
66 int i_capabilities;
68 /* Lua specific */
69 lua_State *L;
71 /* Thread data */
72 vlc_thread_t thread;
73 vlc_mutex_t command_lock;
74 vlc_mutex_t running_lock;
75 vlc_cond_t wait;
77 /* The input this extension should use for vlc.input
78 * or NULL if it should use playlist's current input */
79 struct input_thread_t *p_input;
81 extensions_manager_t *p_mgr; ///< Parent
82 /* Queue of commands to execute */
83 struct command_t
85 command_type_e i_command;
86 void *data[10]; ///< Optional void* arguments
87 struct command_t *next; ///< Next command
88 } *command;
90 bool b_exiting;
93 /* Extensions: manager functions */
94 int Activate( extensions_manager_t *p_mgr, extension_t * );
95 bool IsActivated( extensions_manager_t *p_mgr, extension_t * );
96 int Deactivate( extensions_manager_t *p_mgr, extension_t * );
97 int __PushCommand( extension_t *ext, bool unique, command_type_e cmd, va_list options );
98 static inline int PushCommand( extension_t *ext, int cmd, ... )
100 va_list args;
101 va_start( args, cmd );
102 int i_ret = __PushCommand( ext, false, cmd, args );
103 va_end( args );
104 return i_ret;
106 static inline int PushCommandUnique( extension_t *ext, int cmd, ... )
108 va_list args;
109 va_start( args, cmd );
110 int i_ret = __PushCommand( ext, true, cmd, args );
111 va_end( args );
112 return i_ret;
114 bool LockExtension( extension_t *p_ext );
115 void UnlockExtension( extension_t *p_ext );
117 /* Lua specific functions */
118 void vlclua_extension_set( lua_State *L, extension_t * );
119 extension_t *vlclua_extension_get( lua_State *L );
120 int lua_ExtensionActivate( extensions_manager_t *, extension_t * );
121 int lua_ExtensionDeactivate( extensions_manager_t *, extension_t * );
122 int lua_ExecuteFunctionVa( extensions_manager_t *p_mgr, extension_t *p_ext,
123 const char *psz_function, va_list args );
124 int lua_ExecuteFunction( extensions_manager_t *p_mgr, extension_t *p_ext,
125 const char *psz_function, ... );
126 int lua_ExtensionWidgetClick( extensions_manager_t *p_mgr,
127 extension_t *p_ext,
128 extension_widget_t *p_widget );
129 int lua_ExtensionTriggerMenu( extensions_manager_t *p_mgr,
130 extension_t *p_ext, int id );
132 /* Dialog specific */
133 int lua_DialogFlush( lua_State *L );
135 #endif // LUA_EXTENSION_H