Commit de010d22 authored by Andreas Rheinhardt's avatar Andreas Rheinhardt Committed by Nicolas George

libavformat/subfile: Fix SEEK_CUR and SEEK_END seeking

Up until now, when performing a SEEK_END seek, the subfile protocol
ignored the desired position (relative to EOF) and used the current
absolute offset in the input file instead.

And when performing a SEEK_CUR seek, the current position has been
ignored.
Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
parent 3add65e0
......@@ -116,7 +116,7 @@ static int subfile_read(URLContext *h, unsigned char *buf, int size)
static int64_t subfile_seek(URLContext *h, int64_t pos, int whence)
{
SubfileContext *c = h->priv_data;
int64_t new_pos = -1, end;
int64_t new_pos, end;
int ret;
if (whence == AVSEEK_SIZE || whence == SEEK_END) {
......@@ -132,10 +132,10 @@ static int64_t subfile_seek(URLContext *h, int64_t pos, int whence)
new_pos = c->start + pos;
break;
case SEEK_CUR:
new_pos += pos;
new_pos = c->pos + pos;
break;
case SEEK_END:
new_pos = end + c->pos;
new_pos = end + pos;
break;
}
if (new_pos < c->start)
......
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