]> git.sesse.net Git - vlc/blob - modules/misc/lua/vlclua.h
79fdaa4cb8e33728e412fea75dcb7fc0c3eda291
[vlc] / modules / misc / lua / vlclua.h
1 /*****************************************************************************
2  * luameta.c: Get meta/artwork using lua scripts
3  *****************************************************************************
4  * Copyright (C) 2007 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Antoine Cellerier <dionoea at videolan tod org>
8  *          Pierre d'Herbemont <pdherbemont # videolan.org>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25 #ifndef VLCLUA_H
26 #define VLC_LUA_H
27 /*****************************************************************************
28  * Preamble
29  *****************************************************************************/
30 #ifndef  _GNU_SOURCE
31 #   define  _GNU_SOURCE
32 #endif
33
34 #include <vlc/vlc.h>
35 #include <vlc_input.h>
36 #include <vlc_playlist.h>
37 #include <vlc_meta.h>
38 #include <vlc_url.h>
39 #include <vlc_strings.h>
40 #include <vlc_stream.h>
41 #include <vlc_charset.h>
42
43 #ifdef HAVE_SYS_STAT_H
44 #   include <sys/stat.h>
45 #endif
46
47 #include <lua.h>        /* Low level lua C API */
48 #include <lauxlib.h>    /* Higher level C API */
49 #include <lualib.h>     /* Lua libs */
50
51 /*****************************************************************************
52  * Module entry points
53  *****************************************************************************/
54 int E_(FindArt)( vlc_object_t * );
55 int E_(FindMeta)( vlc_object_t * );
56
57 int E_(Import_LuaPlaylist)( vlc_object_t * );
58 void E_(Close_LuaPlaylist)( vlc_object_t * );
59
60
61 /*****************************************************************************
62  * Lua debug
63  *****************************************************************************/
64 static inline void lua_Dbg( vlc_object_t * p_this, const char * ppz_fmt, ... )
65 {
66     if( p_this->p_libvlc->i_verbose < 3 )
67         return;
68
69     va_list ap;
70     va_start( ap, ppz_fmt );
71     __msg_GenericVa( ( vlc_object_t *)p_this, MSG_QUEUE_NORMAL,
72                       VLC_MSG_DBG, MODULE_STRING,
73                       ppz_fmt, ap );
74     va_end( ap );
75 }
76
77 /*****************************************************************************
78  * Lua function bridge
79  *****************************************************************************/
80 vlc_object_t * vlclua_get_this( lua_State *p_state );
81 int vlclua_stream_new( lua_State *p_state );
82 int vlclua_stream_read( lua_State *p_state );
83 int vlclua_stream_readline( lua_State *p_state );
84 int vlclua_stream_delete( lua_State *p_state );
85 int vlclua_decode_uri( lua_State *p_state );
86 int vlclua_resolve_xml_special_chars( lua_State *p_state );
87 int vlclua_msg_dbg( lua_State *p_state );
88 int vlclua_msg_warn( lua_State *p_state );
89 int vlclua_msg_err( lua_State *p_state );
90 int vlclua_msg_info( lua_State *p_state );
91
92
93 /*****************************************************************************
94  * Will execute func on all scripts in luadirname, and stop if func returns
95  * success.
96  *****************************************************************************/
97 int vlclua_scripts_batch_execute( vlc_object_t *p_this, const char * luadirname,
98         int (*func)(vlc_object_t *, const char *, lua_State *, void *),
99         lua_State * p_state, void * user_data);
100
101
102
103 /*****************************************************************************
104  * Meta data setters utility.
105  *****************************************************************************/
106 void vlclua_read_meta_data( vlc_object_t *p_this,
107         lua_State *p_state, int o, int t, input_item_t *p_input );
108
109
110 void vlclua_read_custom_meta_data( vlc_object_t *p_this,
111         lua_State *p_state, int o, int t, input_item_t *p_input );
112
113 #endif /* VLC_LUA_H */
114