[FFmpeg-devel] [PATCH] libavformat/subfile: Fix SEEK_END seeking

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Mon Jul 15 20:09:04 EEST 2019


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.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
A situation affected by this is a concatenation of concat and subfile:
For some reason, SEEK_SIZE is not implemented for the concat protocol,
so that SEEK_END is used as a fallback. Depending on parameter
combinations, this can mean that the duration of e.g. transport streams
can't be estimated.
Sorry for not spotting this in 4877b586; the bug here was already
present in the initial commit of this protocol.

 libavformat/subfile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/subfile.c b/libavformat/subfile.c
index 2f162e0a34..8210dfb6b3 100644
--- a/libavformat/subfile.c
+++ b/libavformat/subfile.c
@@ -135,7 +135,7 @@ static int64_t subfile_seek(URLContext *h, int64_t pos, int whence)
         new_pos += pos;
         break;
     case SEEK_END:
-        new_pos = end + c->pos;
+        new_pos = end + pos;
         break;
     }
     if (new_pos < c->start)
-- 
2.21.0



More information about the ffmpeg-devel mailing list