Commit 7990beed authored by Michael Niedermayer's avatar Michael Niedermayer

avformat/http: require seekability only when seeking to position != 0

Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 1956cfba
...@@ -1427,7 +1427,7 @@ static int64_t http_seek_internal(URLContext *h, int64_t off, int whence, int fo ...@@ -1427,7 +1427,7 @@ static int64_t http_seek_internal(URLContext *h, int64_t off, int whence, int fo
((whence == SEEK_CUR && off == 0) || ((whence == SEEK_CUR && off == 0) ||
(whence == SEEK_SET && off == s->off))) (whence == SEEK_SET && off == s->off)))
return s->off; return s->off;
else if ((s->filesize == -1 && whence == SEEK_END) || h->is_streamed) else if ((s->filesize == -1 && whence == SEEK_END))
return AVERROR(ENOSYS); return AVERROR(ENOSYS);
if (whence == SEEK_CUR) if (whence == SEEK_CUR)
...@@ -1440,6 +1440,9 @@ static int64_t http_seek_internal(URLContext *h, int64_t off, int whence, int fo ...@@ -1440,6 +1440,9 @@ static int64_t http_seek_internal(URLContext *h, int64_t off, int whence, int fo
return AVERROR(EINVAL); return AVERROR(EINVAL);
s->off = off; s->off = off;
if (s->off && h->is_streamed)
return AVERROR(ENOSYS);
/* we save the old context in case the seek fails */ /* we save the old context in case the seek fails */
old_buf_size = s->buf_end - s->buf_ptr; old_buf_size = s->buf_end - s->buf_ptr;
memcpy(old_buf, s->buf_ptr, old_buf_size); memcpy(old_buf, s->buf_ptr, old_buf_size);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment