[vlc-devel] [PATCH] lua: http: Expose renderers
linkfanel at yahoo.fr
Wed Aug 12 03:20:16 CEST 2020
> diff --git a/share/lua/intf/modules/httprequests.lua
> index 33f2836a00..fa829cba3d 100644
> --- a/share/lua/intf/modules/httprequests.lua
> +++ b/share/lua/intf/modules/httprequests.lua
> @@ -27,7 +27,8 @@ module("httprequests",package.seeall)
> local common = require ("common")
> local dkjson = require ("dkjson")
> +-- renderer discovery instance
> +local vlcrd = nil
It seems rather weird to store state inside a module. Also, this works
currently because of the particular way that the lua http interface runs
server-side scripting, but it doesn't seem like a great idea to rely on
or create bounds to this implementation.
Also it could be one of several modules, are they all equivalent? Can't
there be several RDs at the same time, and shouldn't the HTTP API
account for that?
> @@ -418,10 +424,14 @@ getstatus = function (includecategories)
> local vout = vlc.object.vout()
> local aout = vlc.object.aout()
> + if not vlcrd then
> + vlcrd = vlc.rd.create()
> + end
> + s.renderers = vlcrd:list()
I'm not sure I understand this API correctly (it's not documented in
share/lua/README.txt - would be nice if it was), but this seems like a
strange place to instantiate the RD. It seems awkward for getstatus() to
change or create new state; and that's a place that doesn't provide for
choosing a particular module by name. Also if the RD needs some time to
get populated, it shouldn't be created right before getting used in the
same request - and if it doesn't need time, then it might be possible to
use temporary instances instead of storing a persistent one.
For comparison, the VLM is instantiated by http.lua itself upon load, in
custom.lua - which sucks too in different ways.
"Une âme dans un corps, c'est comme un dessin sur une feuille de papier."
More information about the vlc-devel