[vlc-devel] [PATCH] add http commands to select title, chapter, subtitle track, audio track and video track

Rob Jonson rob at hobbyistsoftware.com
Fri Feb 10 12:20:34 CET 2012


---
 share/lua/http/requests/README.txt      |   19 +++++++++++++++++++
 share/lua/intf/modules/httprequests.lua |   16 +++++++++++++++-
 2 files changed, 34 insertions(+), 1 deletions(-)

diff --git a/share/lua/http/requests/README.txt b/share/lua/http/requests/README.txt
index 5cba1fd..95d1f4e 100644
--- a/share/lua/http/requests/README.txt
+++ b/share/lua/http/requests/README.txt
@@ -149,6 +149,25 @@ Band 0: 60 Hz, 1: 170 Hz, 2: 310 Hz, 3: 600 Hz, 4: 1 kHz,
 
 <Display the list of presets available for the equalizer
 
+---
+Commands available from API version 2
+---
+
+> select the title
+  ?command=title&val=<val>
+
+> select the chapter
+  ?command=title&val=<val>
+
+> select the audio track (use the number from the stream)
+  ?command=audio_track&val=<val>
+
+> select the video track (use the number from the stream)
+  ?command=video_track&val=<val>
+
+> select the sibtitle track (use the number from the stream)
+  ?command=subtitle_track&val=<val>
+
 playlist.xml or playlist.json:
 =============
 < get the full playlist tree
diff --git a/share/lua/intf/modules/httprequests.lua b/share/lua/intf/modules/httprequests.lua
index 56805ab..262f618 100644
--- a/share/lua/intf/modules/httprequests.lua
+++ b/share/lua/intf/modules/httprequests.lua
@@ -177,6 +177,16 @@ processcommands = function ()
       if val == '0' then vlc.equalizer.enable(false) else vlc.equalizer.enable(true) end
     elseif command == "setpreset" then
       vlc.equalizer.setpreset(val)
+    elseif command == "title" then
+  	  vlc.var.set(vlc.object.input(), "title", val)
+	elseif command == "chapter" then
+  	  vlc.var.set(vlc.object.input(), "chapter", val)
+  	elseif command == "audio_track" then
+  	  vlc.var.set(vlc.object.input(), "audio-es", val)
+	elseif command == "video_track" then
+  	  vlc.var.set(vlc.object.input(), "video-es", val)
+	elseif command == "subtitle_track" then
+  	  vlc.var.set(vlc.object.input(), "spu-es", val)
     end
 
     local input = nil
@@ -423,7 +433,7 @@ local aout = vlc.object.aout()
     local s ={}
 
     --update api version when new data/commands added
-    s.apiversion=1
+    s.apiversion=2
     s.version=vlc.misc.version()
     s.volume=vlc.volume.get()
 
@@ -505,6 +515,10 @@ local aout = vlc.object.aout()
             local tag = string.gsub(k,"_","")
         s.stats[tag]=v
       end
+
+      	s.information.chapters=vlc.var.get_list(input, "chapter")
+      	s.information.titles=vlc.var.get_list(input, "title")
+
     end
     return s
 end
-- 
1.7.5




More information about the vlc-devel mailing list