[vlc-commits] Extends lua's SD API to add a remove_node method, similar for remove_item
Julien 'Lta' BALLET
git at videolan.org
Wed Jan 22 21:05:14 CET 2014
vlc | branch: master | Julien 'Lta' BALLET <contact at lta.io> | Tue Jan 21 16:45:08 2014 +0100| [df28caa30662840d74cae6312ca8fb09546ce8a9] | committer: Jean-Baptiste Kempf
Extends lua's SD API to add a remove_node method, similar for remove_item
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=df28caa30662840d74cae6312ca8fb09546ce8a9
---
modules/lua/libs/sd.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/modules/lua/libs/sd.c b/modules/lua/libs/sd.c
index 4bbf1d7..fe5ac57 100644
--- a/modules/lua/libs/sd.c
+++ b/modules/lua/libs/sd.c
@@ -319,6 +319,21 @@ static int vlclua_sd_remove_item( lua_State *L )
return 1;
}
+static int vlclua_sd_remove_node( lua_State *L )
+{
+ services_discovery_t *p_sd = (services_discovery_t *)vlclua_get_this( L );
+ if( !lua_isnil( L, 1 ) )
+ {
+ input_item_t **pp_input = luaL_checkudata( L, 1, "node" );
+ if( *pp_input )
+ services_discovery_RemoveItem( p_sd, *pp_input );
+ /* Make sure we won't try to remove it again */
+ *pp_input = NULL;
+ }
+ return 1;
+}
+
+
static int vlclua_sd_remove_all_items_nodes( lua_State *L )
{
services_discovery_t *p_sd = (services_discovery_t *)vlclua_get_this( L );
@@ -458,6 +473,7 @@ static const luaL_Reg vlclua_sd_reg[] = {
{ "add_node", vlclua_sd_add_node },
{ "add_item", vlclua_sd_add_item },
{ "remove_item", vlclua_sd_remove_item },
+ { "remove_node", vlclua_sd_remove_node },
{ "remove_all_items_nodes", vlclua_sd_remove_all_items_nodes },
{ NULL, NULL }
};
More information about the vlc-commits
mailing list