summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRicardo Constantino <wiiaboo@gmail.com>2018-01-26 20:57:10 +0000
committerRicardo Constantino <wiiaboo@gmail.com>2018-01-26 20:57:10 +0000
commit7eb34275732071acf779a0f241642411f91f78b7 (patch)
treece6c1024b0e85bcea6389c687156582a7aa15d0a
parentce42a965330dfeb7d2f6c69ea42d35454105c828 (diff)
downloadmpv-7eb34275732071acf779a0f241642411f91f78b7.tar.bz2
mpv-7eb34275732071acf779a0f241642411f91f78b7.tar.xz
ytdl_hook: prefer hls/dash manifest if available
This makes all the video/audio variants available for selection. Might break with non-hls/dash, or even with dash if FFmpeg wasn't compiled with the demuxer.
-rw-r--r--player/lua/ytdl_hook.lua16
1 files changed, 10 insertions, 6 deletions
diff --git a/player/lua/ytdl_hook.lua b/player/lua/ytdl_hook.lua
index 6c8e78657d..959b8179db 100644
--- a/player/lua/ytdl_hook.lua
+++ b/player/lua/ytdl_hook.lua
@@ -235,9 +235,13 @@ end
local function add_single_video(json)
local streamurl = ""
local max_bitrate = 0
+ local reqfmts = json["requested_formats"]
- if has_native_dash_demuxer() and proto_is_dash(json) then
- local mpd_url = json["requested_formats"][1]["manifest_url"] or
+ -- prefer manifest_url if present
+ if (has_native_dash_demuxer() and proto_is_dash(json)) or
+ (reqfmts and reqfmts[1]["manifest_url"]) or
+ json["manifest_url"] then
+ local mpd_url = reqfmts and reqfmts[1]["manifest_url"] or
json["manifest_url"]
if not mpd_url then
msg.error("No manifest URL found in JSON data.")
@@ -248,8 +252,8 @@ local function add_single_video(json)
streamurl = mpd_url
- if json.requested_formats then
- for _, track in pairs(json.requested_formats) do
+ if reqfmts then
+ for _, track in pairs(reqfmts) do
max_bitrate = track.tbr > max_bitrate and
track.tbr or max_bitrate
end
@@ -258,8 +262,8 @@ local function add_single_video(json)
end
-- DASH/split tracks
- elseif not (json["requested_formats"] == nil) then
- for _, track in pairs(json.requested_formats) do
+ elseif reqfmts then
+ for _, track in pairs(reqfmts) do
local edl_track = nil
edl_track = edl_track_joined(track.fragments,
track.protocol, json.is_live,