diff options
author | albeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-02-23 21:22:55 +0000 |
---|---|---|
committer | albeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-02-23 21:22:55 +0000 |
commit | 9ada242c51e0d325d553d3ec875373f1126d7cb1 (patch) | |
tree | 1a88924eaf222faf9d4e5506cd827a6c4d520502 /libmpdemux/cache2.c | |
parent | 5264cd378017ef8d42a4fe83d371272bdfaacaef (diff) | |
download | mpv-9ada242c51e0d325d553d3ec875373f1126d7cb1.tar.bz2 mpv-9ada242c51e0d325d553d3ec875373f1126d7cb1.tar.xz |
Make blocking call in libmpdemux interuptable (only with new input,
awnser to quit, pt_next, pt_up_step and alt_src_step)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4826 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux/cache2.c')
-rw-r--r-- | libmpdemux/cache2.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libmpdemux/cache2.c b/libmpdemux/cache2.c index 4b6deb0cdc..a925920370 100644 --- a/libmpdemux/cache2.c +++ b/libmpdemux/cache2.c @@ -8,7 +8,7 @@ #define READ_USLEEP_TIME 10000 #define FILL_USLEEP_TIME 50000 -#define PREFILL_USLEEP_TIME 200000 +#define PREFILL_SLEEP_TIME 200 #include <stdio.h> #include <stdlib.h> @@ -196,7 +196,7 @@ static void exit_sighandler(int x){ exit(0); } -void stream_enable_cache(stream_t *stream,int size,int min,int prefill){ +int stream_enable_cache(stream_t *stream,int size,int min,int prefill){ int ss=(stream->type==STREAMTYPE_VCD)?VCD_SECTOR_DATA:STREAM_BUFFER_SIZE; cache_vars_t* s=cache_init(size,ss); stream->cache_data=s; @@ -213,9 +213,10 @@ void stream_enable_cache(stream_t *stream,int size,int min,int prefill){ s->max_filepos-s->read_filepos ); if(s->eof) break; // file is smaller than prefill size - usleep(PREFILL_USLEEP_TIME); + if(mpdemux_check_interrupt(PREFILL_SLEEP_TIME)) + return 0; } - return; // parent exits + return 1; // parent exits } // cache thread mainloop: |