Commit 0dfe0525 authored by François Revol's avatar François Revol Committed by Jean-Baptiste Kempf

lua vimeo playlist: Handle VP6 and VP8 codecs

Check which codecs are available instead of asking blindly for h264.
Signed-off-by: default avatarFrançois Revol <revol@free.fr>
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
(cherry picked from commit 8e60ce57f9be6ccad2248c57f40dc9b364da09e7)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 11319bfa
...@@ -48,6 +48,7 @@ function parse() ...@@ -48,6 +48,7 @@ function parse()
prefres = get_prefres() prefres = get_prefres()
ishd = false ishd = false
quality = "sd" quality = "sd"
codec = nil
while true do while true do
line = vlc.readline() line = vlc.readline()
if not line then break end if not line then break end
...@@ -77,6 +78,16 @@ function parse() ...@@ -77,6 +78,16 @@ function parse()
if string.match( line, "{config:.*\"timestamp\":" ) then if string.match( line, "{config:.*\"timestamp\":" ) then
_,_,tstamp = string.find (line, "\"timestamp\":([0-9]*)," ) _,_,tstamp = string.find (line, "\"timestamp\":([0-9]*)," )
end end
-- Try to find the available codecs
if string.match( line, "{config:.*,\"files\":{\"vp6\":" ) then
codec = "vp6"
end
if string.match( line, "{config:.*,\"files\":{\"vp8\":" ) then
codec = "vp8"
end
if string.match( line, "{config:.*,\"files\":{\"h264\":" ) then
codec = "h264"
end
-- Try to find whether video is HD actually -- Try to find whether video is HD actually
if string.match( line, "{config:.*,\"hd\":1" ) then if string.match( line, "{config:.*,\"hd\":1" ) then
ishd = true ishd = true
...@@ -86,10 +97,15 @@ function parse() ...@@ -86,10 +97,15 @@ function parse()
end end
end end
if not codec then
vlc.msg.warn("unable to find codec info")
return nil
end
if ishd and ( not height or prefres < 0 or prefres >= tonumber(height) ) then if ishd and ( not height or prefres < 0 or prefres >= tonumber(height) ) then
quality = "hd" quality = "hd"
end end
path = "http://player.vimeo.com/play_redirect?quality="..quality.."&codecs=h264&clip_id="..id.."&time="..tstamp.."&sig="..rsig.."&type=html5_desktop_local" path = "http://player.vimeo.com/play_redirect?quality="..quality.."&codecs="..codec.."&clip_id="..id.."&time="..tstamp.."&sig="..rsig.."&type=html5_desktop_local"
return { { path = path; name = name; arturl = arturl, duration = duration } } return { { path = path; name = name; arturl = arturl, duration = duration } }
end end
return {} return {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment