summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-01-23 12:13:28 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-01-23 12:13:28 +0000
commit4e28b4bc9ed8e29daf3570596cc7a4c5325e8039 (patch)
tree7aa817a12cb9240d39470343c663f4cc61ed581a /stream
parent0e86058912f8ad3af2d49e0eedf01b585bd5732c (diff)
downloadmpv-4e28b4bc9ed8e29daf3570596cc7a4c5325e8039.tar.bz2
mpv-4e28b4bc9ed8e29daf3570596cc7a4c5325e8039.tar.xz
Change code to allow playing a stream even if enabling the cache failed
while still handling it when the user aborts the cache fill. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30402 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'stream')
-rw-r--r--stream/cache2.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/stream/cache2.c b/stream/cache2.c
index 72a906b9a5..64f685e82c 100644
--- a/stream/cache2.c
+++ b/stream/cache2.c
@@ -313,6 +313,9 @@ static void exit_sighandler(int x){
exit(0);
}
+/**
+ * \return 1 on success, 0 if the function was interrupted and -1 on error
+ */
int stream_enable_cache(stream_t *stream,int size,int min,int seek_limit){
int ss = stream->sector_size ? stream->sector_size : STREAM_BUFFER_SIZE;
cache_vars_t* s;
@@ -323,7 +326,7 @@ int stream_enable_cache(stream_t *stream,int size,int min,int seek_limit){
}
s=cache_init(size,ss);
- if(s == NULL) return 0;
+ if(s == NULL) return -1;
stream->cache_data=s;
s->stream=stream; // callback
s->seek_limit=seek_limit;
@@ -362,7 +365,7 @@ int stream_enable_cache(stream_t *stream,int size,int min,int seek_limit){
if (!stream->cache_pid) {
mp_msg(MSGT_CACHE, MSGL_ERR,
"Starting cache process/thread failed: %s.\n", strerror(errno));
- return 0;
+ return -1;
}
// wait until cache is filled at least prefill_init %
mp_msg(MSGT_CACHE,MSGL_V,"CACHE_PRE_INIT: %"PRId64" [%"PRId64"] %"PRId64" pre:%d eof:%d \n",