From d303ebd9b6d46be4681b47043fda102811a36239 Mon Sep 17 00:00:00 2001 From: Ricardo Constantino Date: Wed, 25 Jan 2017 15:33:05 +0000 Subject: stream_lavf: add support for data URIs Only FFmpeg supports them and they need to be in the format data:// like other protocols or prefixed with ffmpeg:// or lavf://. Closes #4058 --- DOCS/man/mpv.rst | 4 ++++ player/lua/ytdl_hook.lua | 2 +- stream/stream_lavf.c | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/DOCS/man/mpv.rst b/DOCS/man/mpv.rst index 8f8651779c..db0382893d 100644 --- a/DOCS/man/mpv.rst +++ b/DOCS/man/mpv.rst @@ -673,6 +673,10 @@ PROTOCOLS either aliases to documented protocols, or are just redirections to protocols implemented and documented in FFmpeg. + ``data:`` is supported in FFmpeg (not in Libav), but needs to be in the + format ``data://``. This is done to avoid ambiguity with filenames. You + can also prefix it with ``lavf://`` or ``ffmpeg://``. + ``ytdl://...`` By default, the youtube-dl hook script (enabled by default for mpv CLI) only looks at http URLs. Prefixing an URL with ``ytdl://`` forces it to diff --git a/player/lua/ytdl_hook.lua b/player/lua/ytdl_hook.lua index 1bae4f398c..a2b38ba036 100644 --- a/player/lua/ytdl_hook.lua +++ b/player/lua/ytdl_hook.lua @@ -295,7 +295,7 @@ mp.add_hook("on_load", 10, function () msg.debug("streamurl: " .. streamurl) - mp.set_property("stream-open-filename", streamurl) + mp.set_property("stream-open-filename", streamurl:gsub("^data:", "data://", 1)) mp.set_property("file-local-options/force-media-title", json.title) diff --git a/stream/stream_lavf.c b/stream/stream_lavf.c index 7594175bd3..873043b38c 100644 --- a/stream/stream_lavf.c +++ b/stream/stream_lavf.c @@ -416,6 +416,7 @@ const stream_info_t stream_info_ffmpeg = { .protocols = (const char *const[]){ "rtmp", "rtsp", "http", "https", "mms", "mmst", "mmsh", "mmshttp", "rtp", "httpproxy", "hls", "rtmpe", "rtmps", "rtmpt", "rtmpte", "rtmpts", "srtp", + "data", NULL }, .can_write = true, .is_safe = true, -- cgit v1.2.3