summaryrefslogtreecommitdiffstats
path: root/libmpdemux/stream.h
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-10-20 23:51:02 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-10-20 23:51:02 +0000
commit3eec0e90e9a0c64a91e6e6790c0a02459a25c2bc (patch)
treedebe1546d071c67906b886d656b22c22f7c65c1d /libmpdemux/stream.h
parent21db4ade664dc9edba8fbabd031ab186af1e7d90 (diff)
downloadmpv-3eec0e90e9a0c64a91e6e6790c0a02459a25c2bc.tar.bz2
mpv-3eec0e90e9a0c64a91e6e6790c0a02459a25c2bc.tar.xz
cache2 support
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@2323 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux/stream.h')
-rw-r--r--libmpdemux/stream.h22
1 files changed, 16 insertions, 6 deletions
diff --git a/libmpdemux/stream.h b/libmpdemux/stream.h
index 2859b68bc4..72dd21ed4f 100644
--- a/libmpdemux/stream.h
+++ b/libmpdemux/stream.h
@@ -27,17 +27,27 @@ typedef struct {
int type; // 0=file 1=VCD
unsigned int buf_pos,buf_len;
off_t start_pos,end_pos;
+ unsigned int cache_pid;
+ void* cache_data;
void* priv; // used for DVD
unsigned char buffer[STREAM_BUFFER_SIZE>VCD_SECTOR_SIZE?STREAM_BUFFER_SIZE:VCD_SECTOR_SIZE];
} stream_t;
-int stream_fill_buffer(stream_t *s);
+#ifdef USE_STREAM_CACHE
+void stream_enable_cache(stream_t *s,int size);
+#else
+// no cache
+#define cache_stream_fill_buffer(x) stream_fill_buffer(x)
+#define cache_stream_seek_long(x,y) stream_seek_long(x,y)
+#define stream_enable_cache(x,y)
+#endif
-int stream_seek_long(stream_t *s,off_t pos);
+int cache_stream_fill_buffer(stream_t *s);
+int cache_stream_seek_long(stream_t *s,off_t pos);
inline static int stream_read_char(stream_t *s){
return (s->buf_pos<s->buf_len)?s->buffer[s->buf_pos++]:
- (stream_fill_buffer(s)?s->buffer[s->buf_pos++]:-256);
+ (cache_stream_fill_buffer(s)?s->buffer[s->buf_pos++]:-256);
// if(s->buf_pos<s->buf_len) return s->buffer[s->buf_pos++];
// stream_fill_buffer(s);
// if(s->buf_pos<s->buf_len) return s->buffer[s->buf_pos++];
@@ -81,7 +91,7 @@ inline static void stream_read(stream_t *s,char* mem,int len){
int x;
x=s->buf_len-s->buf_pos;
if(x==0){
- if(!stream_fill_buffer(s)) return; // EOF
+ if(!cache_stream_fill_buffer(s)) return; // EOF
x=s->buf_len-s->buf_pos;
}
if(s->buf_pos>s->buf_len) printf("stream_read: WARNING! s->buf_pos>s->buf_len\n");
@@ -112,7 +122,7 @@ inline static int stream_seek(stream_t *s,off_t pos){
}
}
- return stream_seek_long(s,pos);
+ return cache_stream_seek_long(s,pos);
}
inline static int stream_skip(stream_t *s,int len){
@@ -123,7 +133,7 @@ inline static int stream_skip(stream_t *s,int len){
while(len>0){
int x=s->buf_len-s->buf_pos;
if(x==0){
- if(!stream_fill_buffer(s)) return 0; // EOF
+ if(!cache_stream_fill_buffer(s)) return 0; // EOF
x=s->buf_len-s->buf_pos;
}
if(x>len) x=len;