diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2019-07-15 19:48:35 +0200 |
---|---|---|
committer | Nicolas George <george@nsup.org> | 2019-08-13 16:00:23 +0200 |
commit | de010d229a18fec9af0052af51615b0831945ae0 (patch) | |
tree | 2847419ee11eeda5698e6615eaaea71c0fab6a33 /libavformat/subfile.c | |
parent | 3add65e052cf3511b284d53e73f986a6768e5486 (diff) | |
download | ffmpeg-de010d229a18fec9af0052af51615b0831945ae0.tar.gz |
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: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavformat/subfile.c')
-rw-r--r-- | libavformat/subfile.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libavformat/subfile.c b/libavformat/subfile.c index 2f162e0a34..5d8659c8c4 100644 --- a/libavformat/subfile.c +++ b/libavformat/subfile.c @@ -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) |