Commit 5384c38e authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Lua: split sd function for SD and for interfaces plugins (fixes #10308)

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.
parent d731e774
...@@ -828,7 +828,7 @@ static lua_State* GetLuaState( extensions_manager_t *p_mgr, ...@@ -828,7 +828,7 @@ static lua_State* GetLuaState( extensions_manager_t *p_mgr,
luaopen_object( L ); luaopen_object( L );
luaopen_osd( L ); luaopen_osd( L );
luaopen_playlist( L ); luaopen_playlist( L );
luaopen_sd( L ); luaopen_sd_intf( L );
luaopen_stream( L ); luaopen_stream( L );
luaopen_strings( L ); luaopen_strings( L );
luaopen_variables( L ); luaopen_variables( L );
......
...@@ -259,7 +259,7 @@ static int Start_LuaIntf( vlc_object_t *p_this, const char *name ) ...@@ -259,7 +259,7 @@ static int Start_LuaIntf( vlc_object_t *p_this, const char *name )
luaopen_object( L ); luaopen_object( L );
luaopen_osd( L ); luaopen_osd( L );
luaopen_playlist( L ); luaopen_playlist( L );
luaopen_sd( L ); luaopen_sd_intf( L );
luaopen_stream( L ); luaopen_stream( L );
luaopen_strings( L ); luaopen_strings( L );
luaopen_variables( L ); luaopen_variables( L );
......
...@@ -35,7 +35,8 @@ void luaopen_net_intf( lua_State * ); ...@@ -35,7 +35,8 @@ void luaopen_net_intf( lua_State * );
void luaopen_object( lua_State * ); void luaopen_object( lua_State * );
void luaopen_osd( lua_State * ); void luaopen_osd( lua_State * );
void luaopen_playlist( 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_stream( lua_State * );
void luaopen_strings( lua_State * ); void luaopen_strings( lua_State * );
void luaopen_variables( lua_State * ); void luaopen_variables( lua_State * );
......
...@@ -475,11 +475,7 @@ static int vlclua_node_add_subnode( lua_State *L ) ...@@ -475,11 +475,7 @@ static int vlclua_node_add_subnode( lua_State *L )
/***************************************************************************** /*****************************************************************************
* *
*****************************************************************************/ *****************************************************************************/
static const luaL_Reg vlclua_sd_reg[] = { static const luaL_Reg vlclua_sd_sd_reg[] = {
{ "get_services_names", vlclua_sd_get_services_names },
{ "add", vlclua_sd_add },
{ "remove", vlclua_sd_remove },
{ "is_loaded", vlclua_sd_is_loaded },
{ "add_node", vlclua_sd_add_node }, { "add_node", vlclua_sd_add_node },
{ "add_item", vlclua_sd_add_item }, { "add_item", vlclua_sd_add_item },
{ "remove_item", vlclua_sd_remove_item }, { "remove_item", vlclua_sd_remove_item },
...@@ -488,9 +484,24 @@ static const luaL_Reg vlclua_sd_reg[] = { ...@@ -488,9 +484,24 @@ static const luaL_Reg vlclua_sd_reg[] = {
{ NULL, NULL } { 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 ); lua_newtable( L );
luaL_register( L, NULL, vlclua_sd_reg ); luaL_register( L, NULL, vlclua_sd_intf_reg );
lua_setfield( L, -2, "sd" ); lua_setfield( L, -2, "sd" );
} }
...@@ -110,7 +110,7 @@ int Open_LuaSD( vlc_object_t *p_this ) ...@@ -110,7 +110,7 @@ int Open_LuaSD( vlc_object_t *p_this )
luaopen_input( L ); luaopen_input( L );
luaopen_msg( L ); luaopen_msg( L );
luaopen_object( L ); luaopen_object( L );
luaopen_sd( L ); luaopen_sd_sd( L );
luaopen_strings( L ); luaopen_strings( L );
luaopen_variables( L ); luaopen_variables( L );
luaopen_stream( L ); luaopen_stream( L );
......
...@@ -310,13 +310,19 @@ playlist.move( id_item, id_where ): take id_item and if id_where has children, i ...@@ -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 ... 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 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. modules. The module name is used as key, the long name is used as value.
sd.add( name ): Add service discovery. sd.add( name ): Add service discovery.
sd.remove( name ): Remove service discovery. sd.remove( name ): Remove service discovery.
sd.is_loaded( name ): Check if service discovery is loaded. 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. sd.add_node( ... ): Add a node to the service discovery.
The node object has the following members: The node object has the following members:
.title: the node's name .title: the node's name
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment