diff options
Diffstat (limited to 'src/xine-engine/input_cache.c')
-rw-r--r-- | src/xine-engine/input_cache.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/src/xine-engine/input_cache.c b/src/xine-engine/input_cache.c index 4eb524af6..e761fed38 100644 --- a/src/xine-engine/input_cache.c +++ b/src/xine-engine/input_cache.c @@ -19,7 +19,7 @@ * * Buffered Input Plugin (request optimizer). * - * The goal of this input plugin is to reduce + * The goal of this input plugin is to reduce * the number of calls to the real input plugin. */ @@ -58,7 +58,7 @@ typedef struct { } cache_input_plugin_t; -/* +/* * read data from input plugin and write it into file */ static off_t cache_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) { @@ -128,13 +128,13 @@ static off_t cache_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) { /* readahead bytes */ main_read = this->main_input_plugin->read(this->main_input_plugin, this->buf, this->buf_size); this->main_read_call++; - + if( main_read >= 0 ) { this->buf_len = main_read; - + if (len > this->buf_len) len = this->buf_len; - + if (len) { xine_fast_memcpy(buf + read_len, this->buf, len); this->buf_pos = len; @@ -148,7 +148,7 @@ static off_t cache_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) { /* direct read */ main_read = this->main_input_plugin->read(this->main_input_plugin, buf + read_len, len); this->main_read_call++; - + if( main_read >= 0 ) read_len += main_read; else @@ -156,7 +156,7 @@ static off_t cache_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) { read_len = main_read; } } - + return read_len; } @@ -190,7 +190,7 @@ static buf_element_t *cache_plugin_read_block(input_plugin_t *this_gen, fifo_buf buf = fifo->buffer_pool_alloc (fifo); if (buf) { buf->type = BUF_DEMUX_BLOCK; - + assert(todo <= buf->max_size); read_len = cache_plugin_read (this_gen, buf->content, todo); buf->size = read_len; @@ -226,11 +226,11 @@ static off_t cache_plugin_seek(input_plugin_t *this_gen, off_t offset, int origi case SEEK_CUR: rel_offset = offset; break; - + case SEEK_SET: rel_offset = offset - cur_pos; break; - + default: /* invalid origin - main input should know better */ cur_pos = this->main_input_plugin->seek(this->main_input_plugin, offset, origin); @@ -238,16 +238,16 @@ static off_t cache_plugin_seek(input_plugin_t *this_gen, off_t offset, int origi this->main_seek_call++; return cur_pos; } - + new_buf_pos = (off_t)this->buf_pos + rel_offset; lprintf("buf_len: %d, rel_offset=%"PRId64", new_buf_pos=%"PRId64"\n", - this->buf_len, rel_offset, new_buf_pos); - + this->buf_len, rel_offset, new_buf_pos); + if ((new_buf_pos < 0) || (new_buf_pos >= this->buf_len)) { if( origin == SEEK_SET ) cur_pos = this->main_input_plugin->seek(this->main_input_plugin, offset, origin); else - cur_pos = this->main_input_plugin->seek(this->main_input_plugin, + cur_pos = this->main_input_plugin->seek(this->main_input_plugin, offset - (this->buf_len - this->buf_pos), origin); this->buf_len = this->buf_pos = 0; this->main_seek_call++; @@ -262,7 +262,7 @@ static off_t cache_plugin_seek(input_plugin_t *this_gen, off_t offset, int origi static off_t cache_plugin_seek_time(input_plugin_t *this_gen, int time_offset, int origin) { cache_input_plugin_t *this = (cache_input_plugin_t *)this_gen; off_t cur_pos; - + lprintf("time_offset: %d, origin: %d\n", time_offset, origin); this->seek_call++; @@ -275,7 +275,7 @@ static off_t cache_plugin_seek_time(input_plugin_t *this_gen, int time_offset, i static off_t cache_plugin_get_current_pos(input_plugin_t *this_gen) { cache_input_plugin_t *this = (cache_input_plugin_t *)this_gen; off_t cur_pos; - + cur_pos = this->main_input_plugin->get_current_pos(this->main_input_plugin); if( this->buf_len ) { if( cur_pos >= (this->buf_len - this->buf_pos) ) @@ -290,7 +290,7 @@ static off_t cache_plugin_get_current_pos(input_plugin_t *this_gen) { static int cache_plugin_get_current_time(input_plugin_t *this_gen) { cache_input_plugin_t *this = (cache_input_plugin_t *)this_gen; int cur_time; - + cur_time = this->main_input_plugin->get_current_time(this->main_input_plugin); return cur_time; @@ -314,7 +314,7 @@ static const char* cache_plugin_get_mrl (input_plugin_t *this_gen) { return this->main_input_plugin->get_mrl(this->main_input_plugin); } -static int cache_plugin_get_optional_data (input_plugin_t *this_gen, +static int cache_plugin_get_optional_data (input_plugin_t *this_gen, void *data, int data_type) { cache_input_plugin_t *this = (cache_input_plugin_t *)this_gen; @@ -322,8 +322,8 @@ static int cache_plugin_get_optional_data (input_plugin_t *this_gen, this->main_input_plugin, data, data_type); } -/* - * dispose main input plugin and self +/* + * dispose main input plugin and self */ static void cache_plugin_dispose(input_plugin_t *this_gen) { cache_input_plugin_t *this = (cache_input_plugin_t *)this_gen; @@ -341,8 +341,8 @@ static void cache_plugin_dispose(input_plugin_t *this_gen) { } -/* - * create self instance, +/* + * create self instance, */ input_plugin_t *_x_cache_plugin_get_instance (xine_stream_t *stream, int readahead_size) { cache_input_plugin_t *this; @@ -359,7 +359,7 @@ input_plugin_t *_x_cache_plugin_get_instance (xine_stream_t *stream, int readahe this = calloc(1, sizeof(cache_input_plugin_t)); if (!this) return NULL; - + this->main_input_plugin = main_plugin; this->stream = stream; |