Mercurial > libavformat.hg
changeset 5850:a9a36b4f83a2 libavformat
Add AVSEEK_FORCE flag to indicate that the code should attempt to seek
by any means.
author | michael |
---|---|
date | Mon, 15 Mar 2010 22:54:22 +0000 |
parents | 219b4cc8f378 |
children | d88fc4640994 |
files | avio.c avio.h aviobuf.c |
diffstat | 3 files changed, 12 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/avio.c Mon Mar 15 22:37:14 2010 +0000 +++ b/avio.c Mon Mar 15 22:54:22 2010 +0000 @@ -202,7 +202,7 @@ if (!h->prot->url_seek) return AVERROR(EPIPE); - ret = h->prot->url_seek(h, pos, whence); + ret = h->prot->url_seek(h, pos, whence & ~AVSEEK_FORCE); return ret; }
--- a/avio.h Mon Mar 15 22:37:14 2010 +0000 +++ b/avio.h Mon Mar 15 22:54:22 2010 +0000 @@ -192,6 +192,14 @@ */ #define AVSEEK_SIZE 0x10000 +/** + * Oring this flag as into the "whence" parameter to a seek function causes it to + * seek by any means (like reopening and linear reading) or other normally unreasonble + * means that can be extreemly slow. + * This may be ignored by the seek code. + */ +#define AVSEEK_FORCE 0x20000 + typedef struct URLProtocol { const char *name; int (*url_open)(URLContext *h, const char *url, int flags);
--- a/aviobuf.c Mon Mar 15 22:37:14 2010 +0000 +++ b/aviobuf.c Mon Mar 15 22:54:22 2010 +0000 @@ -150,8 +150,9 @@ offset1 >= 0 && offset1 <= (s->buf_end - s->buffer)) { /* can do the seek inside the buffer */ s->buf_ptr = s->buffer + offset1; - } else if(s->is_streamed && !s->write_flag && - offset1 >= 0 && offset1 < (s->buf_end - s->buffer) + (1<<16)){ + } else if(s->is_streamed && !s->write_flag && offset1 >= 0 && + ( offset1 < (s->buf_end - s->buffer) + (1<<16) + || (whence & AVSEEK_FORCE))){ while(s->pos < offset && !s->eof_reached) fill_buffer(s); if (s->eof_reached)