[vlc-devel] [PATCH] lua/http: load renderer discovery from xml/json page
Pierre Ynard
linkfanel at yahoo.fr
Mon Aug 24 20:49:18 CEST 2020
After more consideration, this avoids having the httprequests.lua
module depend on a function from custom.lua, and avoids crashing if the
function is not defined.
diff --git a/share/lua/http/requests/rd.json b/share/lua/http/requests/rd.json
index d01d787..2b48537 100644
--- a/share/lua/http/requests/rd.json
+++ b/share/lua/http/requests/rd.json
@@ -25,6 +25,8 @@ vim:syntax=lua
--package.loaded.httprequests = nil --uncomment to debug changes
require "httprequests"
+rd = get_renderer_discovery()
+
httprequests.processcommands()
local rdTable=httprequests.get_renderers()
diff --git a/share/lua/http/requests/rd.xml b/share/lua/http/requests/rd.xml
index 6b8b3d3..cbb8df4 100644
--- a/share/lua/http/requests/rd.xml
+++ b/share/lua/http/requests/rd.xml
@@ -26,6 +26,8 @@ vim:syntax=lua
require "httprequests"
+rd = get_renderer_discovery()
+
httprequests.processcommands()
local rdTable=httprequests.get_renderers()
diff --git a/share/lua/intf/modules/httprequests.lua b/share/lua/intf/modules/httprequests.lua
index bff81f3..8232268 100644
--- a/share/lua/intf/modules/httprequests.lua
+++ b/share/lua/intf/modules/httprequests.lua
@@ -188,13 +188,13 @@ processcommands = function ()
elseif command == "subtitle_track" then
vlc.player.toggle_spu_track(val)
elseif command == "set_renderer" then
- local rd = get_renderer_discovery()
- if not rd then
- return
+ if rd then
+ rd:select(id)
end
- rd:select(id)
elseif command == "unset_renderer" then
- rd:select(-1)
+ if rd then
+ rd:select(-1)
+ end
end
local input = nil
@@ -525,7 +525,6 @@ getstatus = function (includecategories)
end
get_renderers = function()
- local rd = get_renderer_discovery()
if not rd then
return {}
end
--
Pierre Ynard
"Une âme dans un corps, c'est comme un dessin sur une feuille de papier."
More information about the vlc-devel
mailing list