Originally committed as revision 22557 to svn://svn.ffmpeg.org/ffmpeg/trunk
Michael Niedermayer authored on 2010/03/16 07:54:22... | ... |
@@ -202,7 +202,7 @@ int64_t url_seek(URLContext *h, int64_t pos, int whence) |
202 | 202 |
|
203 | 203 |
if (!h->prot->url_seek) |
204 | 204 |
return AVERROR(EPIPE); |
205 |
- ret = h->prot->url_seek(h, pos, whence); |
|
205 |
+ ret = h->prot->url_seek(h, pos, whence & ~AVSEEK_FORCE); |
|
206 | 206 |
return ret; |
207 | 207 |
} |
208 | 208 |
|
... | ... |
@@ -192,6 +192,14 @@ int64_t av_url_read_seek(URLContext *h, int stream_index, |
192 | 192 |
*/ |
193 | 193 |
#define AVSEEK_SIZE 0x10000 |
194 | 194 |
|
195 |
+/** |
|
196 |
+ * Oring this flag as into the "whence" parameter to a seek function causes it to |
|
197 |
+ * seek by any means (like reopening and linear reading) or other normally unreasonble |
|
198 |
+ * means that can be extreemly slow. |
|
199 |
+ * This may be ignored by the seek code. |
|
200 |
+ */ |
|
201 |
+#define AVSEEK_FORCE 0x20000 |
|
202 |
+ |
|
195 | 203 |
typedef struct URLProtocol { |
196 | 204 |
const char *name; |
197 | 205 |
int (*url_open)(URLContext *h, const char *url, int flags); |
... | ... |
@@ -150,8 +150,9 @@ int64_t url_fseek(ByteIOContext *s, int64_t offset, int whence) |
150 | 150 |
offset1 >= 0 && offset1 <= (s->buf_end - s->buffer)) { |
151 | 151 |
/* can do the seek inside the buffer */ |
152 | 152 |
s->buf_ptr = s->buffer + offset1; |
153 |
- } else if(s->is_streamed && !s->write_flag && |
|
154 |
- offset1 >= 0 && offset1 < (s->buf_end - s->buffer) + (1<<16)){ |
|
153 |
+ } else if(s->is_streamed && !s->write_flag && offset1 >= 0 && |
|
154 |
+ ( offset1 < (s->buf_end - s->buffer) + (1<<16) |
|
155 |
+ || (whence & AVSEEK_FORCE))){ |
|
155 | 156 |
while(s->pos < offset && !s->eof_reached) |
156 | 157 |
fill_buffer(s); |
157 | 158 |
if (s->eof_reached) |