summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
Diffstat (limited to 'stream')
-rw-r--r--stream/stream.c25
-rw-r--r--stream/stream.h4
2 files changed, 12 insertions, 17 deletions
diff --git a/stream/stream.c b/stream/stream.c
index 3dc25d7880..c1e88a0796 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -172,11 +172,6 @@ static stream_t *open_stream_plugin(const stream_info_t *sinfo,
if (!s->read_chunk)
s->read_chunk = 4 * (s->sector_size ? s->sector_size : STREAM_BUFFER_SIZE);
- if (s->streaming && !s->cache_size) {
- // Set default cache size to use if user does not specify it.
- s->cache_size = 320;
- }
-
if (s->type <= -2)
mp_msg(MSGT_OPEN, MSGL_WARN, "Warning streams need a type !!!!\n");
if (!s->seek)
@@ -661,16 +656,22 @@ stream_t *open_memory_stream(void *data, int len)
return s;
}
+static int stream_enable_cache(stream_t **stream, int64_t size, int64_t min,
+ int64_t seek_limit);
+
+/**
+ * \return 1 on success, 0 if the function was interrupted and -1 on error, or
+ * if the cache is disabled
+ */
int stream_enable_cache_percent(stream_t **stream, int64_t stream_cache_size,
+ int64_t stream_cache_def_size,
float stream_cache_min_percent,
float stream_cache_seek_min_percent)
{
-
if (stream_cache_size == -1)
- stream_cache_size = (*stream)->cache_size;
+ stream_cache_size = (*stream)->streaming ? stream_cache_def_size : 0;
stream_cache_size = stream_cache_size * 1024; // input is in KiB
-
return stream_enable_cache(stream, stream_cache_size,
stream_cache_size *
(stream_cache_min_percent / 100.0),
@@ -678,12 +679,8 @@ int stream_enable_cache_percent(stream_t **stream, int64_t stream_cache_size,
(stream_cache_seek_min_percent / 100.0));
}
-/**
- * \return 1 on success, 0 if the function was interrupted and -1 on error, or
- * if the cache is disabled
- */
-int stream_enable_cache(stream_t **stream, int64_t size, int64_t min,
- int64_t seek_limit)
+static int stream_enable_cache(stream_t **stream, int64_t size, int64_t min,
+ int64_t seek_limit)
{
stream_t *orig = *stream;
diff --git a/stream/stream.h b/stream/stream.h
index 149618ccd6..f1033ed38f 100644
--- a/stream/stream.h
+++ b/stream/stream.h
@@ -154,7 +154,6 @@ typedef struct stream {
int eof;
int mode; //STREAM_READ or STREAM_WRITE
bool streaming; // known to be a network stream if true
- int cache_size; // cache size in KB to use if enabled
void *priv; // used for DVD, TV, RTSP etc
char *url; // strdup() of filename/url
char *mime_type; // when HTTP streaming is used
@@ -175,10 +174,9 @@ int stream_fill_buffer(stream_t *s);
void stream_set_capture_file(stream_t *s, const char *filename);
int stream_enable_cache_percent(stream_t **stream, int64_t stream_cache_size,
+ int64_t stream_cache_def_size,
float stream_cache_min_percent,
float stream_cache_seek_min_percent);
-int stream_enable_cache(stream_t **stream, int64_t size, int64_t min,
- int64_t seek_limit);
// Internal
int stream_cache_init(stream_t *cache, stream_t *stream, int64_t size,