diff options
author | wm4 <wm4@nowhere> | 2015-08-18 00:10:54 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-08-18 00:10:54 +0200 |
commit | cf2fa9d3e5bd6b8ca3e1637080b665e896ea60a0 (patch) | |
tree | 1de6ea60ee9f38ad5b7b66d7d15ee7a806a1520b /stream/cache.c | |
parent | bf5eac8dd3f142acd0d506407f1ae853ada3c5bc (diff) | |
download | mpv-cf2fa9d3e5bd6b8ca3e1637080b665e896ea60a0.tar.bz2 mpv-cf2fa9d3e5bd6b8ca3e1637080b665e896ea60a0.tar.xz |
stream: provide a stream_get_size() convenience function
And use it everywhere, instead of retrieving the size manually. Slight
simplification.
Diffstat (limited to 'stream/cache.c')
-rw-r--r-- | stream/cache.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/stream/cache.c b/stream/cache.c index b4d7ad3664..43b7eba329 100644 --- a/stream/cache.c +++ b/stream/cache.c @@ -355,7 +355,8 @@ static void update_cached_controls(struct priv *s) s->stream_metadata = talloc_steal(s, tags); } s->stream_size = s->eof_pos; - if (stream_control(s->stream, STREAM_CTRL_GET_SIZE, &i64) == STREAM_OK) + i64 = stream_get_size(s->stream); + if (i64 >= 0) s->stream_size = i64; s->has_avseek = stream_control(s->stream, STREAM_CTRL_HAS_AVSEEK, NULL) > 0; } @@ -625,8 +626,7 @@ int stream_cache_init(stream_t *cache, stream_t *stream, int64_t cache_size = opts->size * 1024ULL; - int64_t file_size = -1; - stream_control(stream, STREAM_CTRL_GET_SIZE, &file_size); + int64_t file_size = stream_get_size(stream); if (file_size >= 0) cache_size = MPMIN(cache_size, file_size); |