[vlc-devel] [PATCH 8/9] lua: sd: Remove sd media browsing
Romain Vimont
rom1v at videolabs.io
Mon Mar 4 11:53:28 CET 2019
Services discovery media were displayed via the old playlist, which
allowed to display their tree.
The new playlist is not a tree, but a list, so it can't be used to
display services discovery trees. This lua API is only used from
cli.lua, and we consider it's not worth it to implement this feature for
now, so just remove it.
---
modules/lua/extension.c | 1 -
modules/lua/intf.c | 1 -
modules/lua/libs/sd.c | 57 -----------------------------------------
share/lua/intf/cli.lua | 23 -----------------
4 files changed, 82 deletions(-)
diff --git a/modules/lua/extension.c b/modules/lua/extension.c
index 475bd06767..ba25d432a8 100644
--- a/modules/lua/extension.c
+++ b/modules/lua/extension.c
@@ -840,7 +840,6 @@ static lua_State* GetLuaState( extensions_manager_t *p_mgr,
luaopen_object( L );
luaopen_osd( L );
luaopen_playlist( L );
- luaopen_sd_intf( L );
luaopen_stream( L );
luaopen_strings( L );
luaopen_variables( L );
diff --git a/modules/lua/intf.c b/modules/lua/intf.c
index cd906b4591..63c902bf21 100644
--- a/modules/lua/intf.c
+++ b/modules/lua/intf.c
@@ -274,7 +274,6 @@ static int Start_LuaIntf( vlc_object_t *p_this, const char *name )
luaopen_object( L );
luaopen_osd( L );
luaopen_playlist( L );
- luaopen_sd_intf( L );
luaopen_stream( L );
luaopen_strings( L );
luaopen_variables( L );
diff --git a/modules/lua/libs/sd.c b/modules/lua/libs/sd.c
index a35091154d..d0dc85d6c2 100644
--- a/modules/lua/libs/sd.c
+++ b/modules/lua/libs/sd.c
@@ -398,60 +398,3 @@ void luaopen_sd_sd( lua_State *L )
luaL_register( L, NULL, vlclua_sd_sd_reg );
lua_setfield( L, -2, "sd" );
}
-
-
-/*** SD management (for user interfaces) ***/
-
-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, NULL );
- if( !ppsz_names )
- return 0;
-
- char **ppsz_longname = ppsz_longnames;
- char **ppsz_name = ppsz_names;
- lua_settop( L, 0 );
- lua_newtable( L );
- for( ; *ppsz_name; ppsz_name++,ppsz_longname++ )
- {
- lua_pushstring( L, *ppsz_longname );
- lua_setfield( L, -2, *ppsz_name );
- free( *ppsz_name );
- free( *ppsz_longname );
- }
- free( ppsz_names );
- free( ppsz_longnames );
- return 1;
-}
-
-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 );
- return vlclua_push_ret( L, i_ret );
-}
-
-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 );
- return vlclua_push_ret( L, i_ret );
-}
-
-static const luaL_Reg vlclua_sd_intf_reg[] = {
- { "get_services_names", vlclua_sd_get_services_names },
- { "add", vlclua_sd_add },
- { "remove", vlclua_sd_remove },
- { NULL, NULL }
-};
-
-void luaopen_sd_intf( lua_State *L )
-{
- lua_newtable( L );
- luaL_register( L, NULL, vlclua_sd_intf_reg );
- lua_setfield( L, -2, "sd" );
-}
diff --git a/share/lua/intf/cli.lua b/share/lua/intf/cli.lua
index 58501d10d5..02c6967abb 100644
--- a/share/lua/intf/cli.lua
+++ b/share/lua/intf/cli.lua
@@ -250,26 +250,6 @@ function playlist_sort(name,client,arg)
end
end
-function sd_add(name,client,arg)
- vlc.sd.add(arg)
- client:append(arg.." enabled.")
-end
-
-function sd_remove(name,client,arg)
- vlc.sd.remove(arg)
- client:append(arg.." disabled.")
-end
-
-function services_discovery(name,client,arg)
- local sd = vlc.sd.get_services_names()
- client:append("+----[ Services discovery ]")
- for n,ln in pairs(sd) do
- client:append("| "..n..": " .. ln)
- end
- client:append("+----[ End of services discovery ]")
- client:append("Enabled services discovery sources appear in the playlist.")
-end
-
function load_vlm(name, client, value)
if vlm == nil then
vlm = vlc.vlm()
@@ -585,9 +565,6 @@ commands_ordered = {
{ "delete"; { func = skip2(vlc.playlist.delete); args = "[X]"; help = "delete item X in playlist" } };
{ "move"; { func = move; args = "[X][Y]"; help = "move item X in playlist after Y" } };
{ "sort"; { func = playlist_sort; args = "key"; help = "sort the playlist" } };
- { "sd"; { func = services_discovery; args = "[sd]"; help = "show services discovery or toggle" } };
- { "sd_add"; { func = sd_add; args = "sd"; help = "add services discovery" } };
- { "sd_remove"; { func = sd_remove; args = "sd"; help = "remove services discovery" } };
{ "play"; { func = skip2(vlc.playlist.play); help = "play stream" } };
{ "stop"; { func = skip2(vlc.playlist.stop); help = "stop stream" } };
{ "next"; { func = skip2(vlc.playlist.next); help = "next playlist item" } };
--
2.20.1
More information about the vlc-devel
mailing list