Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
d11ea136
Commit
d11ea136
authored
Sep 15, 2011
by
Pierre Ynard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
youtube.lua: preferred resolution selection
parent
0e644cb3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
share/lua/playlist/youtube.lua
share/lua/playlist/youtube.lua
+29
-0
No files found.
share/lua/playlist/youtube.lua
View file @
d11ea136
...
...
@@ -37,6 +37,17 @@ function get_arturl()
return
"http://img.youtube.com/vi/"
..
video_id
..
"/default.jpg"
end
function
get_prefres
()
local
prefres
=
-
1
if
vlc
.
var
and
vlc
.
var
.
inherit
then
prefres
=
vlc
.
var
.
inherit
(
nil
,
"preferred-resolution"
)
if
prefres
==
nil
then
prefres
=
-
1
end
end
return
prefres
end
-- Probe function.
function
probe
()
if
vlc
.
access
~=
"http"
and
vlc
.
access
~=
"https"
then
...
...
@@ -87,6 +98,24 @@ function parse()
-- JSON parameters, also formerly known as "
swfConfig
",
-- "
SWF_ARGS
", "
swfArgs
" ...
if string.match( line, "
PLAYER_CONFIG
" ) then
if not fmt then
prefres = get_prefres()
if prefres >= 0 then
fmt_list = string.match( line, "
\
"fmt_list\"
:
\
"(.-)\"" )
if fmt_list then
for itag,height in string.gmatch( fmt_list, "
(
%
d
+
)
\\
/%
d
+
x
(
%
d
+
)
\\
/
[
^
,]
+
" ) do
-- Apparently formats are listed in quality
-- order, so we take the first one that works,
-- or fallback to the lowest quality
fmt = itag
if tonumber(height) <= prefres then
break
end
end
end
end
end
url_map = string.match( line, "
\
"url_encoded_fmt_stream_map\"
:
\
"(.-)\"" )
if url_map then
-- FIXME: do this properly
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment