vlc | branch: master | Pierre Ynard <linkfa...@yahoo.fr> | Sat Apr 3 15:46:41 2021 +0200| [55456d7c1e2892d430f93645972e389e7e8462a8] | committer: Pierre Ynard
liveleak.lua: fix video resolution selection > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=55456d7c1e2892d430f93645972e389e7e8462a8 --- share/lua/playlist/liveleak.lua | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/share/lua/playlist/liveleak.lua b/share/lua/playlist/liveleak.lua index 39ee92e98e..c6e7bf3fa7 100644 --- a/share/lua/playlist/liveleak.lua +++ b/share/lua/playlist/liveleak.lua @@ -59,18 +59,27 @@ function parse() end -- Try to find the video - if not video and string.match( line, '<source ' ) then + if not video and string.match( line, '<video ' ) then + while not string.match( line, '</video>') do + local more = vlc.readline() + if not more then break end + line = line..more + end + -- Apparently the two formats are listed HD first, SD second local prefres = vlc.var.inherit( nil, 'preferred-resolution' ) - for src in string.gmatch( line, '<source src="([^"]+)"' ) do - video = src + for source in string.gmatch( line, '<source( .-)>' ) do + local src = string.match( source, ' src="([^"]+)"' ) + if src then + video = vlc.strings.resolve_xml_special_chars( src ) - if prefres < 0 then - break - end - local height = tonumber( string.match( src, '_(%d+)p%.mp4' ) ) - if ( not height ) or height <= prefres then - break + if prefres < 0 then + break + end + local height = tonumber( string.match( source, ' label="(%d+).-"' ) ) + if ( not height ) or height <= prefres then + break + end end end end _______________________________________________ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits