X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fmisc%2Flua%2Flibs%2Fsd.c;h=5515cd014b7c0cb43a628f63cdfeee392f9d75a8;hb=2a2dd55119a03f4e410fca67cc07c7a4e990ed95;hp=846069116f9727ec8ca823167c7a69a28e6f9711;hpb=98c78b8b61012914b53175f58aca97965e664db2;p=vlc diff --git a/modules/misc/lua/libs/sd.c b/modules/misc/lua/libs/sd.c index 846069116f..5515cd014b 100644 --- a/modules/misc/lua/libs/sd.c +++ b/modules/misc/lua/libs/sd.c @@ -5,7 +5,7 @@ * $Id$ * * Authors: Antoine Cellerier - * Fabio Ritrovato + * Fabio Ritrovato * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -62,8 +62,7 @@ static int vlclua_sd_get_services_names( lua_State *L ) { playlist_t *p_playlist = vlclua_get_playlist_internal( L ); char **ppsz_longnames; - char **ppsz_names = vlc_sd_GetNames( p_playlist, &ppsz_longnames ); - vlclua_release_playlist_internal( p_playlist ); + char **ppsz_names = vlc_sd_GetNames( p_playlist, &ppsz_longnames, NULL ); if( !ppsz_names ) return 0; @@ -88,7 +87,6 @@ static int vlclua_sd_add( lua_State *L ) const char *psz_sd = luaL_checkstring( L, 1 ); playlist_t *p_playlist = vlclua_get_playlist_internal( L ); int i_ret = playlist_ServicesDiscoveryAdd( p_playlist, psz_sd ); - vlclua_release_playlist_internal( p_playlist ); return vlclua_push_ret( L, i_ret ); } @@ -97,7 +95,6 @@ static int vlclua_sd_remove( lua_State *L ) const char *psz_sd = luaL_checkstring( L, 1 ); playlist_t *p_playlist = vlclua_get_playlist_internal( L ); int i_ret = playlist_ServicesDiscoveryRemove( p_playlist, psz_sd ); - vlclua_release_playlist_internal( p_playlist ); return vlclua_push_ret( L, i_ret ); } @@ -106,7 +103,6 @@ static int vlclua_sd_is_loaded( lua_State *L ) const char *psz_sd = luaL_checkstring( L, 1 ); playlist_t *p_playlist = vlclua_get_playlist_internal( L ); lua_pushboolean( L, playlist_IsServicesDiscoveryLoaded( p_playlist, psz_sd )); - vlclua_release_playlist_internal( p_playlist ); return 1; } @@ -118,10 +114,13 @@ static int vlclua_sd_add_node( lua_State *L ) lua_getfield( L, -1, "title" ); if( lua_isstring( L, -1 ) ) { - input_item_t *p_input = input_item_New( p_sd, - "vlc://nop", - lua_tostring( L, -1 ) ); + char *name = strdup( lua_tostring( L, -1 ) ); lua_pop( L, 1 ); + input_item_t *p_input = input_item_NewWithType( VLC_OBJECT( p_sd ), + "vlc://nop", + name, 0, NULL, 0, + -1, ITEM_TYPE_NODE ); + free( name ); lua_getfield( L, -1, "arturl" ); if( lua_isstring( L, -1 ) ) { @@ -160,9 +159,15 @@ static int vlclua_sd_add_item( lua_State *L ) lua_getfield( L, -1, "url" ); if( lua_isstring( L, -1 ) ) { + char **ppsz_options = NULL; + int i_options = 0; char *psz_url = strdup( lua_tostring( L, -1 ) ); lua_pop( L, 1 ); - input_item_t *p_input = input_item_New( p_sd, psz_url, psz_url ); + vlclua_read_options( p_sd, L, &i_options, &ppsz_options ); + input_item_t *p_input = input_item_NewExt( p_sd, psz_url, psz_url, + i_options, + (const char **)ppsz_options, + VLC_INPUT_OPTION_TRUSTED, -1 ); free( psz_url ); vlclua_read_meta_data( p_sd, L, p_input ); /* This one is to be tested... */ @@ -218,10 +223,16 @@ static int vlclua_node_add_subitem( lua_State *L ) lua_getfield( L, -1, "url" ); if( lua_isstring( L, -1 ) ) { + char **ppsz_options = NULL; + int i_options = 0; char *url = strdup( lua_tostring( L, -1 ) ); lua_pop( L, 1 ); + vlclua_read_options( p_sd, L, &i_options, &ppsz_options ); input_item_node_t *p_input_node = input_item_node_Create( *pp_node ); - input_item_t *p_input = input_item_New( p_sd, url, url ); + input_item_t *p_input = input_item_NewExt( p_sd, url, url, + i_options, + (const char **)ppsz_options, + VLC_INPUT_OPTION_TRUSTED, -1 ); free( url ); vlclua_read_meta_data( p_sd, L, p_input ); /* This one is to be tested... */ @@ -267,8 +278,10 @@ static int vlclua_node_add_node( lua_State *L ) char *name = strdup( lua_tostring( L, -1 ) ); lua_pop( L, 1 ); input_item_node_t *p_input_node = input_item_node_Create( *pp_node ); - input_item_t *p_input = input_item_New( p_sd, "vlc://nop", - name ); + input_item_t *p_input = input_item_NewWithType( VLC_OBJECT( p_sd ), + "vlc://nop", + name, 0, NULL, 0, + -1, ITEM_TYPE_NODE ); free( name ); lua_getfield( L, -1, "arturl" ); if( lua_isstring( L, -1 ) )