Mercurial > libavformat.hg
comparison aviobuf.c @ 5874:6a24c2ae6ee4 libavformat
Mask away AVSEEK_FORCE properly in some checks in url_fseek()
Patch by Tomas H¸«£rdin $(name).$(s/¸«£/a/ $(surname)) AT codemill DOT se
author | benoit |
---|---|
date | Wed, 24 Mar 2010 10:41:58 +0000 |
parents | a1121e5fa662 |
children | bde9a4b67f86 |
comparison
equal
deleted
inserted
replaced
5873:e3fb53259d86 | 5874:6a24c2ae6ee4 |
---|---|
128 | 128 |
129 int64_t url_fseek(ByteIOContext *s, int64_t offset, int whence) | 129 int64_t url_fseek(ByteIOContext *s, int64_t offset, int whence) |
130 { | 130 { |
131 int64_t offset1; | 131 int64_t offset1; |
132 int64_t pos; | 132 int64_t pos; |
133 int force = whence & AVSEEK_FORCE; | |
134 whence &= ~AVSEEK_FORCE; | |
133 | 135 |
134 if(!s) | 136 if(!s) |
135 return AVERROR(EINVAL); | 137 return AVERROR(EINVAL); |
136 | 138 |
137 pos = s->pos - (s->write_flag ? 0 : (s->buf_end - s->buffer)); | 139 pos = s->pos - (s->write_flag ? 0 : (s->buf_end - s->buffer)); |
149 if (!s->must_flush && | 151 if (!s->must_flush && |
150 offset1 >= 0 && offset1 <= (s->buf_end - s->buffer)) { | 152 offset1 >= 0 && offset1 <= (s->buf_end - s->buffer)) { |
151 /* can do the seek inside the buffer */ | 153 /* can do the seek inside the buffer */ |
152 s->buf_ptr = s->buffer + offset1; | 154 s->buf_ptr = s->buffer + offset1; |
153 } else if(s->is_streamed && !s->write_flag && offset1 >= 0 && | 155 } else if(s->is_streamed && !s->write_flag && offset1 >= 0 && |
154 ( offset1 < (s->buf_end - s->buffer) + (1<<16) | 156 (offset1 < (s->buf_end - s->buffer) + (1<<16) || force)) { |
155 || (whence & AVSEEK_FORCE))){ | |
156 while(s->pos < offset && !s->eof_reached) | 157 while(s->pos < offset && !s->eof_reached) |
157 fill_buffer(s); | 158 fill_buffer(s); |
158 if (s->eof_reached) | 159 if (s->eof_reached) |
159 return AVERROR_EOF; | 160 return AVERROR_EOF; |
160 s->buf_ptr = s->buf_end + offset - s->pos; | 161 s->buf_ptr = s->buf_end + offset - s->pos; |