diff options
Diffstat (limited to 'stream')
-rw-r--r-- | stream/cache.c | 2 | ||||
-rw-r--r-- | stream/stream.c | 38 | ||||
-rw-r--r-- | stream/stream.h | 4 | ||||
-rw-r--r-- | stream/stream_vcd.c | 2 |
4 files changed, 14 insertions, 32 deletions
diff --git a/stream/cache.c b/stream/cache.c index 4a062538db..364ef68891 100644 --- a/stream/cache.c +++ b/stream/cache.c @@ -134,7 +134,7 @@ static int cond_timed_wait(pthread_cond_t *cond, pthread_mutex_t *mutex, double timeout) { struct timespec ts; -#if _POSIX_TIMERS > 0 +#if defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0 clock_gettime(CLOCK_REALTIME, &ts); #else struct timeval tv; diff --git a/stream/stream.c b/stream/stream.c index 7716e51a56..523fcc2e8e 100644 --- a/stream/stream.c +++ b/stream/stream.c @@ -60,18 +60,11 @@ static struct input_ctx *stream_check_interrupt_ctx; extern const stream_info_t stream_info_vcd; extern const stream_info_t stream_info_cdda; -extern const stream_info_t stream_info_asf; -extern const stream_info_t stream_info_udp; -extern const stream_info_t stream_info_http1; -extern const stream_info_t stream_info_http2; extern const stream_info_t stream_info_dvb; extern const stream_info_t stream_info_tv; extern const stream_info_t stream_info_radio; extern const stream_info_t stream_info_pvr; -extern const stream_info_t stream_info_ftp; -extern const stream_info_t stream_info_vstream; extern const stream_info_t stream_info_smb; - extern const stream_info_t stream_info_null; extern const stream_info_t stream_info_memory; extern const stream_info_t stream_info_mf; @@ -103,12 +96,6 @@ static const stream_info_t *const auto_open_streams[] = { #ifdef CONFIG_PVR &stream_info_pvr, #endif -#ifdef CONFIG_FTP - &stream_info_ftp, -#endif -#ifdef CONFIG_VSTREAM - &stream_info_vstream, -#endif #ifdef CONFIG_LIBSMBCLIENT &stream_info_smb, #endif @@ -169,11 +156,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->seek) s->flags &= ~MP_STREAM_SEEK; if (s->seek && !(s->flags & MP_STREAM_SEEK)) @@ -622,16 +604,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), @@ -639,12 +627,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 554c4e2ec3..a0cd3d58fc 100644 --- a/stream/stream.h +++ b/stream/stream.h @@ -141,7 +141,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 @@ -163,10 +162,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, diff --git a/stream/stream_vcd.c b/stream/stream_vcd.c index be345a507b..0fd2998c58 100644 --- a/stream/stream_vcd.c +++ b/stream/stream_vcd.c @@ -134,7 +134,7 @@ static int open_s(stream_t *stream,int mode, void* opts) /* open() can't be used for devices so do it the complicated way */ hd = CreateFile(device, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL); - f = _open_osfhandle((long)hd, _O_RDONLY); + f = _open_osfhandle((intptr_t)hd, _O_RDONLY); #else f=open(p->device,O_RDONLY); #endif |