mirror of
https://github.com/mpv-player/mpv
synced 2024-11-18 21:16:10 +01:00
cache_file: refuse to cache unseekable streams
This makes no sense to use with DVD/BD/DVB and some others, and these streams happen to be unseekable. Also, other kinds of unseekable streams (like reading from pipe) should work, but will exhibit sketchy behavior if they need to seek. So just disable it, and leave these problems to the memory cache (cache.c).
This commit is contained in:
parent
b0cb2977ed
commit
6b9aee20bd
@ -127,6 +127,11 @@ int stream_file_cache_init(stream_t *cache, stream_t *stream,
|
|||||||
if (!opts->file || !opts->file[0] || opts->file_max < 1)
|
if (!opts->file || !opts->file[0] || opts->file_max < 1)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (!stream->seekable) {
|
||||||
|
MP_ERR(cache, "can't cache unseekable stream\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
bool use_anon_file = strcmp(opts->file, "TMP") == 0;
|
bool use_anon_file = strcmp(opts->file, "TMP") == 0;
|
||||||
FILE *file = use_anon_file ? tmpfile() : fopen(opts->file, "wb+");
|
FILE *file = use_anon_file ? tmpfile() : fopen(opts->file, "wb+");
|
||||||
if (!file) {
|
if (!file) {
|
||||||
|
Loading…
Reference in New Issue
Block a user