[vlc-devel] [PATCH 2/2] http: lua: Add track listing & selection

Hugo Beauzée-Luyssen hugo at beauzee.fr
Thu Jan 12 11:16:16 CET 2017


---
 share/lua/intf/modules/httprequests.lua | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/share/lua/intf/modules/httprequests.lua b/share/lua/intf/modules/httprequests.lua
index 094bf3baa0..697e95d075 100644
--- a/share/lua/intf/modules/httprequests.lua
+++ b/share/lua/intf/modules/httprequests.lua
@@ -194,11 +194,22 @@ processcommands = function ()
     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)
+        if vlc.input.item() then
+            vlc.input.item():select_track("audio", val)
+        end
     elseif command == "video_track" then
-        vlc.var.set(vlc.object.input(), "video-es", val)
+        if vlc.input.item() then
+            vlc.input.item():select_track("video", val)
+        end
     elseif command == "subtitle_track" then
-        vlc.var.set(vlc.object.input(), "spu-es", val)
+        if vlc.input.item() then
+            vlc.input.item():select_track("spu", val)
+        end
+    elseif command == "select_track" then
+        local track_type = _GET["type"]
+        if vlc.input.item() and track_type and val then
+            vlc.input.item():select_track(track_type, val)
+        end
     end
 
     local input = nil
@@ -471,8 +482,12 @@ getstatus = function (includecategories)
         s.subtitledelay=0
     end
 
+    s.tracks = {}
     if item then
         s.length=math.floor(item:duration())
+        for k, t in pairs(item:tracks()) do
+            s.tracks["track_" .. k] = t
+        end
     else
         s.length=0
     end
-- 
2.11.0



More information about the vlc-devel mailing list