Commit Graph

11 Commits

Author SHA1 Message Date
Kacper Michajłow ad119d9dc9 stream_curl: expose redirect location to lavf
Some demuxers like DASH and HLS, query the location through the
"location" av option, this is how http.c in lavf exposes it. Respect
this interface and expose effective url.

Fixes: https://github.com/mpv-player/mpv/pull/18044
2026-06-02 08:36:21 +02:00
Kacper Michajłow 13a3e3ad0e stream_curl: log user friendly message when TLS verification fails 2026-05-28 20:14:35 +02:00
Kacper Michajłow ca89a744c9 stream_curl: tell libcurl to use the native CA store
This is independent of other CA certificate locations set at run time or
build time. Those locations are searched in addition to the native CA
store.
2026-05-28 20:14:35 +02:00
Kacper Michajłow 427e4bf25d stream_curl: support offset/end_offset passed in AVDictionary
lavf's http demuxer exposes initial/final byte offsets as AVOptions.
Some demuxers, like lavf/hls.c assume it is always available, even for
custom IO. We need to use those values for correct demuxing.

Fixes: https://github.com/mpv-player/mpv/pull/17879#issuecomment-4468476976
2026-05-26 19:32:02 +02:00
Kacper Michajłow 059bc7025b stream_curl: disable by default on libavformat < 62.15.101 2026-05-16 18:20:42 +02:00
Kacper Michajłow 724b76fe0a stream_curl: add --curl-enabled option 2026-05-16 18:20:42 +02:00
Kacper Michajłow 9a9c890e23 stream_curl: use for ftp/ftps
It's significantly more stable than Lavf. Fixes seeking out of cached
ranges. Additionally correctly marks demuxer_is_network for ftp too.
2026-05-16 18:20:42 +02:00
Kacper Michajłow 332764d909 stream_curl: build protocol list based on libcurl state
Allow only subset of supported protocols by libcurl.
2026-05-16 18:20:42 +02:00
Kacper Michajłow b14d8f5ee1 demux_lavf: route nested HTTP opens through the curl backend
Hook AVFormatContext.io_open so HLS/DASH segment fetches and other
nested FFmpeg I/O go through stream_http when libcurl is available.
This lets segments inherit the connection reuse, HTTP/2 multiplexing,
mid-stream resume and conditional compression of the top-level stream.

Falls back to FFmpeg's default I/O for non-HTTP URLs and when the curl
backend is not built in.
2026-05-16 18:20:42 +02:00
Kacper Michajłow f658223abb stream_curl: allow reading cookies not only from a local file 2026-05-16 18:20:42 +02:00
Kacper Michajłow c6833a9307 stream_curl: add libcurl-based stream backend
Introduces stream_http, an internal libcurl-driven backend for http://
and https:// URLs. Runs all transfers on a dedicated curl multi thread
with a producer-side ring buffer, and exposes HTTP/2 multiplexing,
QUIC/HTTP/3 (when libcurl supports it), HSTS and TCP keep-alive.

Should generally be more stable and faster than FFmpeg HTTP/1.1 impl,
additionally connections are kept-alive between files open, so if you
open playlist of network files and navigate through them, it will re-use
the same connection.

Build is gated on the new 'libcurl' meson option (auto). When disabled
or unavailable, mpv silently falls back to FFmpeg's HTTP implementation.
2026-05-16 18:20:42 +02:00