mirror of https://github.com/mpv-player/mpv
stream: change cache return values
Basically a cosmetic change, because currently the player just continues even if the cache fails initializing.
This commit is contained in:
parent
f5af596237
commit
8c7a9b0cd0
|
@ -599,13 +599,13 @@ static void cache_uninit(stream_t *cache)
|
|||
talloc_free(s);
|
||||
}
|
||||
|
||||
// return 1 on success, 0 if the function was interrupted and -1 on error, or
|
||||
// if the cache is disabled
|
||||
// return 1 on success, 0 if the cache is disabled/not needed, and -1 on error
|
||||
// or if the cache is disabled
|
||||
int stream_cache_init(stream_t *cache, stream_t *stream,
|
||||
struct mp_cache_opts *opts)
|
||||
{
|
||||
if (opts->size < 1)
|
||||
return -1;
|
||||
return 0;
|
||||
|
||||
struct priv *s = talloc_zero(NULL, struct priv);
|
||||
s->log = cache->log;
|
||||
|
@ -653,7 +653,7 @@ int stream_cache_init(stream_t *cache, stream_t *stream,
|
|||
return 1;
|
||||
for (;;) {
|
||||
if (stream_check_interrupt(cache))
|
||||
return 0;
|
||||
return -1;
|
||||
int64_t fill;
|
||||
int idle;
|
||||
if (stream_control(s->cache, STREAM_CTRL_GET_CACHE_FILL, &fill) < 0)
|
||||
|
|
|
@ -827,15 +827,15 @@ bool stream_wants_cache(stream_t *stream, struct mp_cache_opts *opts)
|
|||
return use_opts.size > 0;
|
||||
}
|
||||
|
||||
// return: 1 on success, 0 if the function was interrupted and -1 on error, or
|
||||
// if the cache is disabled
|
||||
// return 1 on success, 0 if the cache is disabled/not needed, and -1 on error
|
||||
// or if the cache is disabled
|
||||
int stream_enable_cache(stream_t **stream, struct mp_cache_opts *opts)
|
||||
{
|
||||
stream_t *orig = *stream;
|
||||
struct mp_cache_opts use_opts = check_cache_opts(*stream, opts);
|
||||
|
||||
if (use_opts.size < 1)
|
||||
return -1;
|
||||
return 0;
|
||||
|
||||
stream_t *fcache = open_cache(orig, "file-cache");
|
||||
if (stream_file_cache_init(fcache, orig, &use_opts) <= 0) {
|
||||
|
|
Loading…
Reference in New Issue