X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fmisc%2Flua%2Fplaylist.c;h=60602fd6efb28cef84a6348e4a648a6de5b0b053;hb=ff6d0af6bd54027a616eaab0caab220329b34b92;hp=a948d8f459da6bedd83c3598ae6a22c77c6d8fa7;hpb=bddd76b004670b9b82448a12eac3687aa22e49ba;p=vlc diff --git a/modules/misc/lua/playlist.c b/modules/misc/lua/playlist.c index a948d8f459..60602fd6ef 100644 --- a/modules/misc/lua/playlist.c +++ b/modules/misc/lua/playlist.c @@ -24,7 +24,11 @@ /***************************************************************************** * Preamble *****************************************************************************/ -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include #include #include #include @@ -70,7 +74,7 @@ static int vlclua_demux_peek( lua_State *L ) static int vlclua_demux_read( lua_State *L ) { demux_t *p_demux = (demux_t *)vlclua_get_this( L ); - byte_t *p_read; + uint8_t *p_read; int n = luaL_checkint( L, 1 ); int i_read = stream_Read( p_demux->s, &p_read, n ); lua_pushlstring( L, (const char *)p_read, i_read ); @@ -122,6 +126,7 @@ static luaL_Reg p_reg_parse[] = static int probe_luascript( vlc_object_t *p_this, const char * psz_filename, lua_State * L, void * user_data ) { + VLC_UNUSED(user_data); demux_t * p_demux = (demux_t *)p_this; p_demux->p_sys->psz_filename = strdup(psz_filename); @@ -179,10 +184,11 @@ static int probe_luascript( vlc_object_t *p_this, const char * psz_filename, /***************************************************************************** * Import_LuaPlaylist: main import function *****************************************************************************/ -int E_(Import_LuaPlaylist)( vlc_object_t *p_this ) +int Import_LuaPlaylist( vlc_object_t *p_this ) { demux_t *p_demux = (demux_t *)p_this; lua_State *L; + int ret; p_demux->p_sys = (demux_sys_t*)malloc( sizeof( demux_sys_t ) ); if( !p_demux->p_sys ) @@ -218,16 +224,18 @@ int E_(Import_LuaPlaylist)( vlc_object_t *p_this ) lua_pop( L, 1 ); - return vlclua_scripts_batch_execute( p_this, "luaplaylist", &probe_luascript, - L, NULL ); + ret = vlclua_scripts_batch_execute( p_this, "playlist", + &probe_luascript, L, NULL ); + if( ret ) + Close_LuaPlaylist( p_this ); + return ret; } - /***************************************************************************** * Deactivate: frees unused data *****************************************************************************/ -void E_(Close_LuaPlaylist)( vlc_object_t *p_this ) +void Close_LuaPlaylist( vlc_object_t *p_this ) { demux_t *p_demux = (demux_t *)p_this; lua_close( p_demux->p_sys->L ); @@ -240,7 +248,6 @@ static int Demux( demux_t *p_demux ) lua_State *L = p_demux->p_sys->L; char *psz_filename = p_demux->p_sys->psz_filename; - playlist_t *p_playlist = pl_Yield( p_demux ); input_thread_t *p_input_thread = (input_thread_t *) vlc_object_find( p_demux, VLC_OBJECT_INPUT, FIND_PARENT ); input_item_t *p_current_input = input_GetItem( p_input_thread ); @@ -253,7 +260,7 @@ static int Demux( demux_t *p_demux ) { msg_Warn( p_demux, "Error while runing script %s, " "function parse() not found", psz_filename ); - E_(Close_LuaPlaylist)( VLC_OBJECT( p_demux ) ); + Close_LuaPlaylist( VLC_OBJECT( p_demux ) ); return VLC_EGENERIC; } @@ -262,23 +269,23 @@ static int Demux( demux_t *p_demux ) msg_Warn( p_demux, "Error while runing script %s, " "function parse(): %s", psz_filename, lua_tostring( L, lua_gettop( L ) ) ); - E_(Close_LuaPlaylist)( VLC_OBJECT( p_demux ) ); + Close_LuaPlaylist( VLC_OBJECT( p_demux ) ); return VLC_EGENERIC; } if( lua_gettop( L ) ) - vlclua_playlist_add_internal( p_demux, L, p_playlist, + vlclua_playlist_add_internal( p_demux, L, NULL, p_current_input, 0 ); else msg_Err( p_demux, "Script went completely foobar" ); vlc_object_release( p_input_thread ); - vlc_object_release( p_playlist ); return -1; /* Needed for correct operation of go back */ } static int Control( demux_t *p_demux, int i_query, va_list args ) { + VLC_UNUSED(p_demux); VLC_UNUSED(i_query); VLC_UNUSED(args); return VLC_EGENERIC; }