[vlc-devel] commit: Add new common.volume(). Understands use of strings like "+10", " -10" or "10" for relative or absolute volume changes. Fixes volume in http interface. (Antoine Cellerier )

git version control git at videolan.org
Mon Dec 21 23:25:30 CET 2009


vlc | branch: master | Antoine Cellerier <dionoea at videolan.org> | Mon Dec 21 23:24:30 2009 +0100| [fd7f9a09f0d2d40386ffa6fcbc228f782f357b47] | committer: Antoine Cellerier 

Add new common.volume(). Understands use of strings like "+10", "-10" or "10" for relative or absolute volume changes. Fixes volume in http interface.

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

 share/lua/http/requests/status.xml |    2 +-
 share/lua/intf/modules/common.lua  |    8 ++++++++
 share/lua/intf/rc.lua              |    2 +-
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/share/lua/http/requests/status.xml b/share/lua/http/requests/status.xml
index 328e65f..a8ae703 100644
--- a/share/lua/http/requests/status.xml
+++ b/share/lua/http/requests/status.xml
@@ -89,7 +89,7 @@ elseif command == "fullscreen" then
 elseif command == "snapshot" then
   common.snapshot()
 elseif command == "volume" then
-  vlc.volume.set(tonumber(val))
+  common.volume(val)
 elseif command == "seek" then
   common.seek(val)
 elseif command == "key" then
diff --git a/share/lua/intf/modules/common.lua b/share/lua/intf/modules/common.lua
index f0a1aa2..f2c8061 100644
--- a/share/lua/intf/modules/common.lua
+++ b/share/lua/intf/modules/common.lua
@@ -85,3 +85,11 @@ function seek(value)
         vlc.var.set(input,"time",tonumber(value))
     end
 end
+
+function volume(value)
+    if type(value)=="string" and string.sub(value,1,1) == "+" or string.sub(value,1,1) == "-" then
+        vlc.volume.set(vlc.volume.get()+tonumber(value))
+    else
+        vlc.volume.set(tostring(value))
+    end
+end
diff --git a/share/lua/intf/rc.lua b/share/lua/intf/rc.lua
index 2348c4e..1926497 100644
--- a/share/lua/intf/rc.lua
+++ b/share/lua/intf/rc.lua
@@ -397,7 +397,7 @@ end
 
 function volume(name,client,value)
     if value then
-        vlc.volume.set(value)
+        common.volume(value)
     else
         client:append(tostring(vlc.volume.get()))
     end




More information about the vlc-devel mailing list