]> git.sesse.net Git - vlc/blobdiff - modules/lua/vlc.h
macosx: fix wrong ref counting in media info
[vlc] / modules / lua / vlc.h
index 3683bd2eeffd399ab9d6d85c412c875b4607726f..c6df44aec20172743afb7ccd45271d5a681302e2 100644 (file)
 #include <vlc_input.h>
 #include <vlc_playlist.h>
 #include <vlc_meta.h>
+#include <vlc_meta_fetcher.h>
 #include <vlc_url.h>
 #include <vlc_strings.h>
 #include <vlc_stream.h>
+#include <vlc_demux.h>
 
+#define LUA_COMPAT_APIINTCASTS
 #define LUA_COMPAT_MODULE
 #include <lua.h>        /* Low level lua C API */
 #include <lauxlib.h>    /* Higher level C API */
@@ -49,9 +52,9 @@
 /*****************************************************************************
  * Module entry points
  *****************************************************************************/
-int ReadMeta( vlc_object_t * );
-int FetchMeta( vlc_object_t * );
-int FindArt( vlc_object_t * );
+int ReadMeta( demux_meta_t * );
+int FetchMeta( meta_fetcher_t * );
+int FindArt( meta_fetcher_t * );
 
 int Import_LuaPlaylist( vlc_object_t * );
 void Close_LuaPlaylist( vlc_object_t * );
@@ -77,7 +80,7 @@ static inline void lua_Dbg( vlc_object_t * p_this, const char * ppz_fmt, ... )
 {
     va_list ap;
     va_start( ap, ppz_fmt );
-    msg_GenericVa( p_this, VLC_MSG_DBG, MODULE_STRING, ppz_fmt, ap );
+    msg_GenericVa( p_this, VLC_MSG_DBG, ppz_fmt, ap );
     va_end( ap );
 }
 
@@ -113,8 +116,8 @@ void vlclua_set_this( lua_State *, vlc_object_t * );
 #define vlclua_set_this(a, b) vlclua_set_this(a, VLC_OBJECT(b))
 vlc_object_t * vlclua_get_this( lua_State * );
 
-struct intf_sys_t;
-void vlclua_set_intf( lua_State *, struct intf_sys_t * );
+void vlclua_set_playlist_internal( lua_State *, playlist_t * );
+playlist_t * vlclua_get_playlist_internal( lua_State * );
 
 /*****************************************************************************
  * Lua function bridge
@@ -126,12 +129,20 @@ int vlclua_push_ret( lua_State *, int i_error );
  * Will execute func on all scripts in luadirname, and stop if func returns
  * success.
  *****************************************************************************/
+typedef struct luabatch_context_t luabatch_context_t;
+struct luabatch_context_t
+{
+    input_item_t *p_item;
+    meta_fetcher_scope_t e_scope;
+    bool (*pf_validator)( const luabatch_context_t *, meta_fetcher_scope_t );
+};
+
 int vlclua_scripts_batch_execute( vlc_object_t *p_this, const char * luadirname,
-        int (*func)(vlc_object_t *, const char *, void *),
+        int (*func)(vlc_object_t *, const char *, const luabatch_context_t *),
         void * user_data );
-int vlclua_dir_list( vlc_object_t *p_this, const char *luadirname, char ***pppsz_dir_list );
+int vlclua_dir_list( const char *luadirname, char ***pppsz_dir_list );
 void vlclua_dir_list_free( char **ppsz_dir_list );
-char *vlclua_find_file( vlc_object_t *p_this, const char *psz_luadirname, const char *psz_name );
+char *vlclua_find_file( const char *psz_luadirname, const char *psz_name );
 
 /*****************************************************************************
  * Replace Lua file reader by VLC input. Allows loadings scripts in Zip pkg.
@@ -152,8 +163,21 @@ int vlclua_playlist_add_internal( vlc_object_t *, lua_State *, playlist_t *,
                                   input_item_t *, bool );
 #define vlclua_playlist_add_internal( a, b, c, d, e ) vlclua_playlist_add_internal( VLC_OBJECT( a ), b, c, d, e )
 
-int vlclua_add_modules_path( vlc_object_t *, lua_State *, const char *psz_filename );
-#define vlclua_add_modules_path( a, b, c ) vlclua_add_modules_path( VLC_OBJECT( a ), b, c )
+int vlclua_add_modules_path( lua_State *, const char *psz_filename );
+
+/**
+ * File descriptors table
+ */
+typedef struct
+{
+    int *fdv;
+    unsigned fdc;
+    int fd[2];
+} vlclua_dtable_t;
+
+int vlclua_fd_init( lua_State *, vlclua_dtable_t * );
+void vlclua_fd_interrupt( vlclua_dtable_t * );
+void vlclua_fd_cleanup( vlclua_dtable_t * );
 
 /**
  * Per-interface private state
@@ -162,10 +186,8 @@ struct intf_sys_t
 {
     char *psz_filename;
     lua_State *L;
-
     vlc_thread_t thread;
-    vlc_mutex_t lock;
-    bool exiting;
+    vlclua_dtable_t dtable;
 };
 
 #endif /* VLC_LUA_H */