Revision 493f54ad

View differences:

libavformat/avio.c
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

  
libavformat/avio.h
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);
libavformat/aviobuf.c
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)

Also available in: Unified diff