]> git.sesse.net Git - vlc/blobdiff - modules/lua/vlc.h
macosx: fix wrong ref counting in media info
[vlc] / modules / lua / vlc.h
index d98f7fc8cf740c88ae13a0ac7822839dde969fb3..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,6 +116,9 @@ 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 * );
 
+void vlclua_set_playlist_internal( lua_State *, playlist_t * );
+playlist_t * vlclua_get_playlist_internal( lua_State * );
+
 /*****************************************************************************
  * Lua function bridge
  *****************************************************************************/
@@ -123,8 +129,16 @@ 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( const char *luadirname, char ***pppsz_dir_list );
 void vlclua_dir_list_free( char **ppsz_dir_list );
@@ -151,6 +165,20 @@ int vlclua_playlist_add_internal( vlc_object_t *, lua_State *, playlist_t *,
 
 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
  */
@@ -158,17 +186,9 @@ struct intf_sys_t
 {
     char *psz_filename;
     lua_State *L;
-#ifndef _WIN32
-    int fd[2];
-#endif
-    int *fdv;
-    unsigned fdc;
-
     vlc_thread_t thread;
+    vlclua_dtable_t dtable;
 };
 
-void vlclua_fd_init( struct intf_sys_t * );
-void vlclua_fd_destroy( struct intf_sys_t * );
-
 #endif /* VLC_LUA_H */