Commit 2d0aee25 authored by Rémi Duraffort's avatar Rémi Duraffort

lua extensions: use an enum and remove demuy declaration.

parent 75acda83
...@@ -27,19 +27,18 @@ ...@@ -27,19 +27,18 @@
#include <vlc_extensions.h> #include <vlc_extensions.h>
#include <vlc_arrays.h> #include <vlc_arrays.h>
///< Array of extension_t
TYPEDEF_ARRAY( extension_t, array_extension_t );
/* List of available commands */ /* List of available commands */
#define CMD_ACTIVATE 1 typedef enum
#define CMD_DEACTIVATE 2 {
#define CMD_TRIGGERMENU 3 /* Arg1 = int*, pointing to id to trigger. free */ CMD_ACTIVATE = 1,
#define CMD_CLICK 4 /* Arg1 = extension_widget_t* */ CMD_DEACTIVATE,
#define CMD_CLOSE 5 CMD_TRIGGERMENU, /* Arg1 = int*, pointing to id to trigger. free */
#define CMD_SET_INPUT 6 /* No arg. Just signal current input changed */ CMD_CLICK, /* Arg1 = extension_widget_t* */
#define CMD_UPDATE_META 7 /* No arg. Just signal current input item meta CMD_CLOSE,
* changed */ CMD_SET_INPUT, /* No arg. Just signal current input changed */
#define CMD_PLAYING_CHANGED 8 /* Arg1 = int*, New playing status */ CMD_UPDATE_META, /* No arg. Just signal current input item meta changed */
CMD_PLAYING_CHANGED /* Arg1 = int*, New playing status */
} command_type_e;
//Data types //Data types
typedef enum typedef enum
...@@ -83,7 +82,7 @@ struct extension_sys_t ...@@ -83,7 +82,7 @@ struct extension_sys_t
/* Queue of commands to execute */ /* Queue of commands to execute */
struct command_t struct command_t
{ {
int i_command; command_type_e i_command;
void *data[10]; ///< Optional void* arguments void *data[10]; ///< Optional void* arguments
struct command_t *next; ///< Next command struct command_t *next; ///< Next command
} *command; } *command;
...@@ -96,7 +95,7 @@ int Activate( extensions_manager_t *p_mgr, extension_t * ); ...@@ -96,7 +95,7 @@ int Activate( extensions_manager_t *p_mgr, extension_t * );
bool IsActivated( 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 * ); int Deactivate( extensions_manager_t *p_mgr, extension_t * );
void WaitForDeactivation( extension_t *p_ext ); void WaitForDeactivation( extension_t *p_ext );
int __PushCommand( extension_t *ext, bool unique, int cmd, va_list options ); int __PushCommand( extension_t *ext, bool unique, command_type_e cmd, va_list options );
static inline int PushCommand( extension_t *ext, int cmd, ... ) static inline int PushCommand( extension_t *ext, int cmd, ... )
{ {
va_list args; va_list args;
......
...@@ -207,7 +207,7 @@ void WaitForDeactivation( extension_t *p_ext ) ...@@ -207,7 +207,7 @@ void WaitForDeactivation( extension_t *p_ext )
} }
/** Push a UI command */ /** Push a UI command */
int __PushCommand( extension_t *p_ext, bool b_unique, int i_command, int __PushCommand( extension_t *p_ext, bool b_unique, command_type_e i_command,
va_list args ) va_list args )
{ {
vlc_mutex_lock( &p_ext->p_sys->command_lock ); vlc_mutex_lock( &p_ext->p_sys->command_lock );
...@@ -319,7 +319,7 @@ static void* Run( void *data ) ...@@ -319,7 +319,7 @@ static void* Run( void *data )
{ {
if( lua_ExecuteFunction( p_mgr, p_ext, "activate", LUA_END ) < 0 ) if( lua_ExecuteFunction( p_mgr, p_ext, "activate", LUA_END ) < 0 )
{ {
msg_Dbg( p_mgr, "Could not activate extension!" ); msg_Err( p_mgr, "Could not activate extension!" );
Deactivate( p_mgr, p_ext ); Deactivate( p_mgr, p_ext );
cmd = NULL; cmd = NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment