diff options
author | ChrisK2 <spam@kalania.de> | 2015-10-11 00:35:35 +0200 |
---|---|---|
committer | ChrisK2 <spam@kalania.de> | 2015-10-11 00:35:35 +0200 |
commit | 78caf6ae8634b9fe9589187d8febb927dce2ddeb (patch) | |
tree | 3ccc8f1041c94f607ffae78b6fa8cbad818e589a /player/lua | |
parent | 46c499d02a6803421a04ef5ebb5f4077c968da3d (diff) | |
download | mpv-78caf6ae8634b9fe9589187d8febb927dce2ddeb.tar.bz2 mpv-78caf6ae8634b9fe9589187d8febb927dce2ddeb.tar.xz |
ytdl: Remove DASH hacks, use DASH by default
Thanks to rcombs, ffmpeg now properly supports DASH and we can
remove our hacks for it and use it by default whenever
available. If you don't like this for whatever reason, you
can get the "normal" streams back with --ytdl-format=best .
Closes #579
Closes #1321
Closes #2359
Diffstat (limited to 'player/lua')
-rw-r--r-- | player/lua/ytdl_hook.lua | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/player/lua/ytdl_hook.lua b/player/lua/ytdl_hook.lua index 66ab85159b..d43a7bb35e 100644 --- a/player/lua/ytdl_hook.lua +++ b/player/lua/ytdl_hook.lua @@ -2,7 +2,8 @@ local utils = require 'mp.utils' local msg = require 'mp.msg' local ytdl = { - path = "youtube-dl" + path = "youtube-dl", + searched = false } local function exec(args) @@ -60,6 +61,16 @@ mp.add_hook("on_load", 10, function () if (url:find("http://") == 1) or (url:find("https://") == 1) or (url:find("ytdl://") == 1) then + -- check for youtube-dl in mpv's config dir + if not (ytdl.searched) then + local ytdl_mcd = mp.find_config_file("youtube-dl") + if not (ytdl_mcd == nil) then + msg.verbose("found youtube-dl at: " .. ytdl_mcd) + ytdl.path = ytdl_mcd + end + ytdl.searched = true + end + -- strip ytdl:// if (url:find("ytdl://") == 1) then url = url:sub(8) @@ -183,19 +194,10 @@ mp.add_hook("on_load", 10, function () -- video url streamurl = json["requested_formats"][1].url - if (json["ext"] == "mp4") and not (json.duration == nil) then - msg.info("Using DASH, expect inaccurate duration.") - msg.info("Actual duration: "..mp.format_time(json.duration)) - end - -- audio url mp.set_property("file-local-options/audio-file", json["requested_formats"][2].url) - -- workaround for slow startup (causes inaccurate duration) - mp.set_property("file-local-options/demuxer-lavf-o", - "fflags=+ignidx") - elseif not (json.url == nil) then -- normal video streamurl = json.url |