[vlc-commits] LUA: Display list of active audio filters

Akash Mehrotra git at videolan.org
Tue Aug 30 19:41:44 CEST 2011


vlc | branch: master | Akash Mehrotra <mehrotra.akash at gmail.com> | Thu Aug  4 18:09:03 2011 +0530| [4784f3f0647098c853eee74b287f22082b6c3798] | committer: Jean-Baptiste Kempf

LUA: Display list of active audio filters

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 share/lua/intf/modules/httprequests.lua |   37 ++++++++++++++++++++++++++++++-
 1 files changed, 36 insertions(+), 1 deletions(-)

diff --git a/share/lua/intf/modules/httprequests.lua b/share/lua/intf/modules/httprequests.lua
index b96cb9e..81ead6a 100644
--- a/share/lua/intf/modules/httprequests.lua
+++ b/share/lua/intf/modules/httprequests.lua
@@ -31,6 +31,31 @@ local function stripslashes(s)
   return string.gsub(s,"\\(.)","%1")
 end
 
+function strsplit(text, delimiter)
+	local strfind = string.find
+	local strsub = string.sub
+	local tinsert = table.insert
+	local list = {}
+	local pos = 1
+	if strfind("", delimiter, 1) then -- this would result in endless loops
+		error("delimiter matches empty string!")
+	end
+	local i=1
+	while 1 do
+		i=i+1
+		local first, last = strfind(text, delimiter, pos)
+		if first then -- found?
+			tinsert(list,i, strsub(text, pos, first-1))
+			pos = last+1
+		else
+			tinsert(list,i, strsub(text, pos))
+		break
+		end
+	end
+	return list
+end
+
+
 --main function to process commands sent with the request
 
 processcommands = function ()
@@ -307,6 +332,7 @@ local input = vlc.object.input()
 local item = vlc.input.item()
 local playlist = vlc.object.playlist()
 local vout = vlc.object.vout()
+local aout = vlc.object.aout()
 
 	local s ={}
 	
@@ -336,7 +362,16 @@ local vout = vlc.object.vout()
 	else
 		s.fullscreen=0
 	end
-	
+	if aout then
+		local filters=vlc.var.get(aout,"audio-filter")
+		local temp=strsplit(filters,":")
+		s.audiofilters={}
+		local id=0
+		for i,j in pairs(temp) do
+			s.audiofilters['filter_'..id]=j
+			id=id+1
+		end
+	end
 	s.state=vlc.playlist.status()
 	s.random=vlc.var.get(playlist,"random")
 	s.loop=vlc.var.get(playlist,"loop")



More information about the vlc-commits mailing list