[vlc-commits] luahttp: use us_tonumber() for commands passing decimals

Pierre Ynard git at videolan.org
Fri May 18 06:16:29 CEST 2012


vlc/vlc-2.0 | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Fri May 18 06:08:37 2012 +0200| [ce58247d771dd3a4b57a68d0c800808e850b609f] | committer: Pierre Ynard

luahttp: use us_tonumber() for commands passing decimals

This fixes playback rate, track delay and equalizer settings.
(cherry picked from commit fff364519a7723f98c7be6a507893e21efc6c2bd)

Signed-off-by: Pierre Ynard <linkfanel at yahoo.fr>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=ce58247d771dd3a4b57a68d0c800808e850b609f
---

 share/lua/intf/modules/httprequests.lua |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/share/lua/intf/modules/httprequests.lua b/share/lua/intf/modules/httprequests.lua
index d527a6b..bf41c3c 100644
--- a/share/lua/intf/modules/httprequests.lua
+++ b/share/lua/intf/modules/httprequests.lua
@@ -74,7 +74,7 @@ processcommands = function ()
     local id = tonumber(_GET['id'] or -1)
     local val = _GET['val']
     local options = _GET['option']
-    local band = _GET['band']
+    local band = tonumber(_GET['band'])
     if type(options) ~= "table" then -- Deal with the 0 or 1 option case
       options = { options }
     end
@@ -158,14 +158,17 @@ processcommands = function ()
       common.hotkey("key-"..val)
     elseif command == "audiodelay" then
       if vlc.object.input() and val then
+       val = common.us_tonumber(val)
        vlc.var.set(vlc.object.input(),"audio-delay",val)
       end
     elseif command == "rate" then
-      if vlc.object.input() and tonumber(val) >= 0 then
+      val = common.us_tonumber(val)
+      if vlc.object.input() and val >= 0 then
        vlc.var.set(vlc.object.input(),"rate",val)
       end
     elseif command == "subdelay" then
       if vlc.object.input() then
+       val = common.us_tonumber(val)
        vlc.var.set(vlc.object.input(),"spu-delay",val)
       end
     elseif command == "aspectratio" then
@@ -173,8 +176,10 @@ processcommands = function ()
        vlc.var.set(vlc.object.vout(),"aspect-ratio",val)
       end
     elseif command == "preamp" then
+      val = common.us_tonumber(val)
       vlc.equalizer.preampset(val)
     elseif command == "equalizer" then
+      val = common.us_tonumber(val)
       vlc.equalizer.equalizerset(band,val)
     elseif command == "enableeq" then
       if val == '0' then vlc.equalizer.enable(false) else vlc.equalizer.enable(true) end



More information about the vlc-commits mailing list