[vlc-commits] liveleak.lua: fix video resolution selection
Pierre Ynard
git at videolan.org
Sat Apr 3 14:00:39 UTC 2021
vlc/vlc-3.0 | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Sat Apr 3 15:46:41 2021 +0200| [d58b7748a1ce997bc86f1c5619bd9276cf981bc1] | committer: Pierre Ynard
liveleak.lua: fix video resolution selection
(cherry picked from commit 55456d7c1e2892d430f93645972e389e7e8462a8)
Signed-off-by: Pierre Ynard <linkfanel at yahoo.fr>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=d58b7748a1ce997bc86f1c5619bd9276cf981bc1
---
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
More information about the vlc-commits
mailing list