From 61202bb3640740d2cb98cf13922dcdf67970d5ef Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 30 Jan 2017 19:38:43 +0100 Subject: ytdl_hook, edl: implement pseudo-DASH support We use the metadata provided by youtube-dl to sort-of implement fragmented DASH streaming. This is all a bit hacky, but hopefully a makeshift solution until libavformat has proper mechanisms. (Although in danger of being one of those temporary hacks that become permanent.) --- player/lua/ytdl_hook.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'player/lua/ytdl_hook.lua') diff --git a/player/lua/ytdl_hook.lua b/player/lua/ytdl_hook.lua index 7349e579e3..fba5100822 100644 --- a/player/lua/ytdl_hook.lua +++ b/player/lua/ytdl_hook.lua @@ -90,11 +90,17 @@ end local function edl_track_joined(fragments) local edl = "edl://" - for i = 1, #fragments do + local offset = 1 + if fragments[1] and not fragments[1].duration then + -- if no duration, probably initialization segment + edl = edl .. "!mp4_dash,init=" .. edl_escape(fragments[1].url) + offset = 2 + end + for i = offset, #fragments do local fragment = fragments[i] - edl = edl .. edl_escape(fragment.url) if fragment.duration then - edl = edl .. ",length=" .. fragment.duration + edl = edl .. edl_escape(fragment.url) + edl = edl..",length="..fragment.duration end edl = edl .. ";" end -- cgit v1.2.3