mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-02-02 12:53:29 +00:00
Add AVSEEK_FORCE flag to indicate that the code should attempt to seek
by any means. Originally committed as revision 22557 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
53f66cee0c
commit
493f54ada0
@ -202,7 +202,7 @@ int64_t url_seek(URLContext *h, int64_t pos, int whence)
|
|||||||
|
|
||||||
if (!h->prot->url_seek)
|
if (!h->prot->url_seek)
|
||||||
return AVERROR(EPIPE);
|
return AVERROR(EPIPE);
|
||||||
ret = h->prot->url_seek(h, pos, whence);
|
ret = h->prot->url_seek(h, pos, whence & ~AVSEEK_FORCE);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,6 +192,14 @@ int64_t av_url_read_seek(URLContext *h, int stream_index,
|
|||||||
*/
|
*/
|
||||||
#define AVSEEK_SIZE 0x10000
|
#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 {
|
typedef struct URLProtocol {
|
||||||
const char *name;
|
const char *name;
|
||||||
int (*url_open)(URLContext *h, const char *url, int flags);
|
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)
|
|||||||
offset1 >= 0 && offset1 <= (s->buf_end - s->buffer)) {
|
offset1 >= 0 && offset1 <= (s->buf_end - s->buffer)) {
|
||||||
/* can do the seek inside the buffer */
|
/* can do the seek inside the buffer */
|
||||||
s->buf_ptr = s->buffer + offset1;
|
s->buf_ptr = s->buffer + offset1;
|
||||||
} else if(s->is_streamed && !s->write_flag &&
|
} else if(s->is_streamed && !s->write_flag && offset1 >= 0 &&
|
||||||
offset1 >= 0 && offset1 < (s->buf_end - s->buffer) + (1<<16)){
|
( offset1 < (s->buf_end - s->buffer) + (1<<16)
|
||||||
|
|| (whence & AVSEEK_FORCE))){
|
||||||
while(s->pos < offset && !s->eof_reached)
|
while(s->pos < offset && !s->eof_reached)
|
||||||
fill_buffer(s);
|
fill_buffer(s);
|
||||||
if (s->eof_reached)
|
if (s->eof_reached)
|
||||||
|
Loading…
Reference in New Issue
Block a user