00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef VLC_LUA_H
00026 #define VLC_LUA_H
00027
00028
00029
00030
00031 #include <vlc_common.h>
00032 #include <vlc_input.h>
00033 #include <vlc_playlist.h>
00034 #include <vlc_meta.h>
00035 #include <vlc_url.h>
00036 #include <vlc_strings.h>
00037 #include <vlc_stream.h>
00038 #include <vlc_charset.h>
00039
00040 #ifdef HAVE_SYS_STAT_H
00041 # include <sys/stat.h>
00042 #endif
00043
00044 #include <lua.h>
00045 #include <lauxlib.h>
00046 #include <lualib.h>
00047
00048
00049
00050
00051 int FindArt( vlc_object_t * );
00052
00053 int Import_LuaPlaylist( vlc_object_t * );
00054 void Close_LuaPlaylist( vlc_object_t * );
00055
00056 int Open_LuaIntf( vlc_object_t * );
00057 void Close_LuaIntf( vlc_object_t * );
00058
00059
00060
00061
00062
00063 static inline void lua_Dbg( vlc_object_t * p_this, const char * ppz_fmt, ... )
00064 {
00065 va_list ap;
00066 va_start( ap, ppz_fmt );
00067 __msg_GenericVa( ( vlc_object_t *)p_this, VLC_MSG_DBG, MODULE_STRING,
00068 ppz_fmt, ap );
00069 va_end( ap );
00070 }
00071
00072
00073
00074
00075 static inline int luaL_checkboolean( lua_State *L, int narg )
00076 {
00077 luaL_checktype( L, narg, LUA_TBOOLEAN );
00078 return lua_toboolean( L, narg );
00079 }
00080
00081 static inline int luaL_optboolean( lua_State *L, int narg, int def )
00082 {
00083 return luaL_opt( L, luaL_checkboolean, narg, def );
00084 }
00085
00086 static inline const char *luaL_nilorcheckstring( lua_State *L, int narg )
00087 {
00088 if( lua_isnil( L, narg ) )
00089 return NULL;
00090 return luaL_checkstring( L, narg );
00091 }
00092
00093 vlc_object_t * vlclua_get_this( lua_State * );
00094
00095
00096
00097
00098 #define vlclua_error( L ) luaL_error( L, "VLC lua error in file %s line %d (function %s)", __FILE__, __LINE__, __func__ )
00099 int vlclua_push_ret( lua_State *, int i_error );
00100
00101
00102
00103
00104
00105 int vlclua_scripts_batch_execute( vlc_object_t *p_this, const char * luadirname,
00106 int (*func)(vlc_object_t *, const char *, lua_State *, void *),
00107 lua_State * L, void * user_data );
00108 int vlclua_dir_list( const char *luadirname, char **ppsz_dir_list );
00109 void vlclua_dir_list_free( char **ppsz_dir_list );
00110
00111
00112
00113
00114 void __vlclua_read_options( vlc_object_t *, lua_State *, int *, char *** );
00115 #define vlclua_read_options(a,b,c,d) __vlclua_read_options(VLC_OBJECT(a),b,c,d)
00116 void __vlclua_read_meta_data( vlc_object_t *, lua_State *, input_item_t * );
00117 #define vlclua_read_meta_data(a,b,c) __vlclua_read_meta_data(VLC_OBJECT(a),b,c)
00118 void __vlclua_read_custom_meta_data( vlc_object_t *, lua_State *,
00119 input_item_t *);
00120 #define vlclua_read_custom_meta_data(a,b,c) __vlclua_read_custom_meta_data(VLC_OBJECT(a),b,c)
00121 int __vlclua_playlist_add_internal( vlc_object_t *, lua_State *, playlist_t *,
00122 input_item_t *, bool );
00123 #define vlclua_playlist_add_internal(a,b,c,d,e) __vlclua_playlist_add_internal(VLC_OBJECT(a),b,c,d,e)
00124
00125
00126 #endif
00127