]> git.sesse.net Git - vlc/commitdiff
Lua: split sd function for SD and for interfaces plugins (fixes #10308)
authorRémi Denis-Courmont <remi@remlab.net>
Sun, 23 Mar 2014 21:04:45 +0000 (23:04 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Sun, 23 Mar 2014 21:08:38 +0000 (23:08 +0200)
Functions casting this to a services_discovery_t pointer are only
usable by SD plugins. Functions looking up the playlist are only usable
by interfaces plugins and extensions.

modules/lua/extension.c
modules/lua/intf.c
modules/lua/libs.h
modules/lua/libs/sd.c
modules/lua/services_discovery.c
share/lua/README.txt

index 439083a8b1cc48d40fdfec09a9c6c2711c0e20fb..f1efb873ac9e80c39a047de8993fd615157cb649 100644 (file)
@@ -828,7 +828,7 @@ static lua_State* GetLuaState( extensions_manager_t *p_mgr,
             luaopen_object( L );
             luaopen_osd( L );
             luaopen_playlist( L );
-            luaopen_sd( L );
+            luaopen_sd_intf( L );
             luaopen_stream( L );
             luaopen_strings( L );
             luaopen_variables( L );
index f23eed3a3b0af2cec813e5dc428ba747cf046ca0..9dacd8d2b9d989c009dc386f13bf4cbbf8c52150 100644 (file)
@@ -259,7 +259,7 @@ static int Start_LuaIntf( vlc_object_t *p_this, const char *name )
     luaopen_object( L );
     luaopen_osd( L );
     luaopen_playlist( L );
-    luaopen_sd( L );
+    luaopen_sd_intf( L );
     luaopen_stream( L );
     luaopen_strings( L );
     luaopen_variables( L );
index 7e62f18a22d50284499f882d32c0fd08c859bc35..1951cf8f4f4ceb27e70153683bcfa7ef43a3ed70 100644 (file)
@@ -35,7 +35,8 @@ void luaopen_net_intf( lua_State * );
 void luaopen_object( lua_State * );
 void luaopen_osd( lua_State * );
 void luaopen_playlist( lua_State * );
-void luaopen_sd( lua_State * );
+void luaopen_sd_sd( lua_State * );
+void luaopen_sd_intf( lua_State * );
 void luaopen_stream( lua_State * );
 void luaopen_strings( lua_State * );
 void luaopen_variables( lua_State * );
index 1b54ca621ddff1622d3731c83896ba8615060ec5..f162847adf8708b2d869df2b058bf5e015655738 100644 (file)
@@ -475,11 +475,7 @@ static int vlclua_node_add_subnode( lua_State *L )
 /*****************************************************************************
  *
  *****************************************************************************/
-static const luaL_Reg vlclua_sd_reg[] = {
-    { "get_services_names", vlclua_sd_get_services_names },
-    { "add", vlclua_sd_add },
-    { "remove", vlclua_sd_remove },
-    { "is_loaded", vlclua_sd_is_loaded },
+static const luaL_Reg vlclua_sd_sd_reg[] = {
     { "add_node", vlclua_sd_add_node },
     { "add_item", vlclua_sd_add_item },
     { "remove_item", vlclua_sd_remove_item },
@@ -488,9 +484,24 @@ static const luaL_Reg vlclua_sd_reg[] = {
     { NULL, NULL }
 };
 
-void luaopen_sd( lua_State *L )
+void luaopen_sd_sd( lua_State *L )
+{
+    lua_newtable( L );
+    luaL_register( L, NULL, vlclua_sd_sd_reg );
+    lua_setfield( L, -2, "sd" );
+}
+
+static const luaL_Reg vlclua_sd_intf_reg[] = {
+    { "get_services_names", vlclua_sd_get_services_names },
+    { "add", vlclua_sd_add },
+    { "remove", vlclua_sd_remove },
+    { "is_loaded", vlclua_sd_is_loaded },
+    { NULL, NULL }
+};
+
+void luaopen_sd_intf( lua_State *L )
 {
     lua_newtable( L );
-    luaL_register( L, NULL, vlclua_sd_reg );
+    luaL_register( L, NULL, vlclua_sd_intf_reg );
     lua_setfield( L, -2, "sd" );
 }
index c81d31b9b1c36578b6a86f473685ac193bfddc1f..74c8c6c406414bd718c8d8ecd1d4bc4e4afc7a82 100644 (file)
@@ -110,7 +110,7 @@ int Open_LuaSD( vlc_object_t *p_this )
     luaopen_input( L );
     luaopen_msg( L );
     luaopen_object( L );
-    luaopen_sd( L );
+    luaopen_sd_sd( L );
     luaopen_strings( L );
     luaopen_variables( L );
     luaopen_stream( L );
index dc506afbdc0b36cf83c05703125584d1c98192f1..c29cc4afb3d2a414bc50d8a2e3ed87924eff1364 100644 (file)
@@ -310,13 +310,19 @@ playlist.move( id_item, id_where ): take id_item and if id_where has children, i
 
 FIXME: add methods to get an item's meta, options, es ...
 
-SD
---
+Services discovery
+------------------
+
+Interfaces and extensions can use the following SD functions:
+
 sd.get_services_names(): Get a table of all available service discovery
   modules. The module name is used as key, the long name is used as value.
 sd.add( name ): Add service discovery.
 sd.remove( name ): Remove service discovery.
 sd.is_loaded( name ): Check if service discovery is loaded.
+
+Services discovery scripts can use the following SD functions:
+
 sd.add_node( ... ): Add a node to the service discovery.
   The node object has the following members:
       .title: the node's name