mirror of
https://github.com/mpv-player/mpv
synced 2024-12-22 23:02:37 +00:00
stream_lavf: use ffmpeg for http/https streaming
The internal mplayer http implementation is terrible and old. Try to use ffmpeg instead. Enable ffmpeg https as well (we don't have native support for it and never will). Enable the cache for ffmpeg streams. In theory, we want to enable the cache for network streams only (or at least, not enable it for files), but there doesn't seem to be any way to query this. ffmpeg has its own read-cache, but apparently it doesn't get filled asynchronously (only to the degree internal socket/kernel buffers do). Should it turn out that the mplayer implementation is better than ffmpeg's in some way (unlikely), this commit might be reverted until ffmpeg is ready. So far, the ffmpeg implementation seems to work very well though. The original mplayer stream implementation is made available under "mp_http://" and "mp_http_proxy://". This is for testing, until the http implementation is completely removed. Note that this is unlikely to happen soon: ffmpeg doesn't support Microsoft streaming, while mplayer has some support. This code has dependencies on http. Note: "http_proxy://" doesn't work anymore. Use "httpproxy://" to get the ffmpeg implementation of it. Using https requires enabling OpenSSL in ffmpeg by adding the --enable-openssl switch to ffmpeg's configure.
This commit is contained in:
parent
6294c78549
commit
c02f252938
@ -938,7 +938,7 @@ const stream_info_t stream_info_http1 = {
|
||||
"Bertrand, Albeau, Reimar Doeffinger, Arpi?",
|
||||
"plain http",
|
||||
open_s1,
|
||||
{"http", "http_proxy", "unsv", "icyx", "noicyx", NULL},
|
||||
{"mp_http", "mp_http_proxy", "unsv", "icyx", "noicyx", NULL},
|
||||
NULL,
|
||||
0 // Urls are an option string
|
||||
};
|
||||
@ -949,7 +949,7 @@ const stream_info_t stream_info_http2 = {
|
||||
"Bertrand, Albeu, Arpi? who?",
|
||||
"plain http, also used as fallback for many other protocols",
|
||||
open_s2,
|
||||
{"http", "http_proxy", "pnm", "mms", "mmsu", "mmst", "rtsp", NULL}, //all the others as fallback
|
||||
{"mp_http", "mp_http_proxy", "pnm", "mms", "mmsu", "mmst", "rtsp", NULL}, //all the others as fallback
|
||||
NULL,
|
||||
0 // Urls are an option string
|
||||
};
|
||||
|
@ -152,6 +152,8 @@ static int open_f(stream_t *stream, int mode, void *opts, int *file_format)
|
||||
stream->write_buffer = write_buffer;
|
||||
stream->control = control;
|
||||
stream->close = close_f;
|
||||
// enable cache (should be avoided for files, but no way to detect this)
|
||||
stream->streaming = true;
|
||||
res = STREAM_OK;
|
||||
|
||||
out:
|
||||
@ -164,7 +166,7 @@ const stream_info_t stream_info_ffmpeg = {
|
||||
"",
|
||||
"",
|
||||
open_f,
|
||||
{ "lavf", "ffmpeg", "rtmp", "rtsp", NULL },
|
||||
{ "lavf", "ffmpeg", "rtmp", "rtsp", "http", "https", NULL },
|
||||
NULL,
|
||||
1 // Urls are an option string
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user