[vlc-devel] [PATCH 08/40] lua: sd: remove SD item category

RĂ©mi Denis-Courmont remi at remlab.net
Sun May 14 17:45:38 CEST 2017


Lua has support for sub-item which wholly supersets item category.
None of the scripts ever used the category parameter anyway.
---
 modules/lua/libs/sd.c | 18 ++++--------------
 share/lua/README.txt  |  3 +--
 2 files changed, 5 insertions(+), 16 deletions(-)

diff --git a/modules/lua/libs/sd.c b/modules/lua/libs/sd.c
index 455547a9d3..c0dd445c66 100644
--- a/modules/lua/libs/sd.c
+++ b/modules/lua/libs/sd.c
@@ -329,36 +329,26 @@ static const luaL_Reg vlclua_node_reg[] = {
 
 /*** Services discovery instance ***/
 
-static int vlclua_sd_add_common( services_discovery_t *p_sd, lua_State *L,
+static int vlclua_sd_add_common( services_discovery_t *p_sd,
                                  input_item_t *p_input )
 {
-    if( p_input == NULL )
-        return 1;
-
-    lua_getfield( L, -2, "category" );
-    if( lua_isstring( L, -1 ) )
-        services_discovery_AddItemCat( p_sd, p_input, luaL_checkstring( L, -1 ) );
-    else
+    if( p_input != NULL )
         services_discovery_AddItem( p_sd, p_input );
-    lua_pop( L, 1 );
-
     return 1;
 }
 
 static int vlclua_sd_add_item( lua_State *L )
 {
     services_discovery_t *p_sd = (services_discovery_t *)vlclua_get_this( L );
-    input_item_t *p_input = vlclua_sd_create_item( p_sd, L );
 
-    return vlclua_sd_add_common( p_sd, L, p_input );
+    return vlclua_sd_add_common( p_sd, vlclua_sd_create_item( p_sd, L ) );
 }
 
 static int vlclua_sd_add_node( lua_State *L )
 {
     services_discovery_t *p_sd = (services_discovery_t *)vlclua_get_this( L );
-    input_item_t *p_input = vlclua_sd_create_node( p_sd, L );
 
-    return vlclua_sd_add_common( p_sd, L, p_input );
+    return vlclua_sd_add_common( p_sd, vlclua_sd_create_node( p_sd, L ) );
 }
 
 static int vlclua_sd_remove_item( lua_State *L )
diff --git a/share/lua/README.txt b/share/lua/README.txt
index d726fcf095..fb5fe2759c 100644
--- a/share/lua/README.txt
+++ b/share/lua/README.txt
@@ -325,8 +325,7 @@ sd.add_node( ... ): Add a node to the service discovery.
       .arturl: the node's ArtURL (OPTIONAL)
       .category: the node's category (OPTIONAL)
 sd.add_item( ... ): Add an item to the service discovery.
-  The item object has the same members as the one in playlist.add() along with:
-      .category: the item's category (OPTIONAL)
+  The item object has the same members as the one in playlist.add().
   Returns the input item.
 sd.remove_item( item ): remove the item.
 
-- 
2.11.0



More information about the vlc-devel mailing list