[FFmpeg-devel] Fix for seek issues with files >2GB
Sean Soria
sean.soria
Tue Dec 1 23:21:43 CET 2009
In av_seek_frame_generic there are many calls to url_fseek that look like this:
if ((ret = url_fseek(s->pb, ie->pos, SEEK_SET)) < 0)
return ret;
Unfortunately, ret is declared as int, while url_fseek returns
int64_t, so the return value will be truncated before being compared
with zero. Since url_fseek returns the current position on success,
certain values (2GB-4GB for instance) will be interpreted as negative
values despite being positive 64-bit values. This patch declares ret
as an int64_t so that truncation does not occur until the value is
actually returned.
--- libavformat/utils.c (revision 20690)
+++ libavformat/utils.c (working copy)
@@ -1513,7 +1513,8 @@ static int av_seek_frame_byte(AVFormatCo
static int av_seek_frame_generic(AVFormatContext *s,
int stream_index, int64_t timestamp,
int flags)
{
- int index, ret;
+ int index;
+ int64_t ret;
AVStream *st;
AVIndexEntry *ie;
-------------- next part --------------
LS0tIGxpYmF2Zm9ybWF0L3V0aWxzLmMgKHJldmlzaW9uIDIwNjkwKQorKysgbGli
YXZmb3JtYXQvdXRpbHMuYyAod29ya2luZyBjb3B5KQpAQCAtMTUxMyw3ICsxNTEz
LDggQEAgc3RhdGljIGludCBhdl9zZWVrX2ZyYW1lX2J5dGUoQVZGb3JtYXRDbwog
c3RhdGljIGludCBhdl9zZWVrX2ZyYW1lX2dlbmVyaWMoQVZGb3JtYXRDb250ZXh0
ICpzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHN0cmVh
bV9pbmRleCwgaW50NjRfdCB0aW1lc3RhbXAsIGludCBmbGFncykKIHsKLSAgICBp
bnQgaW5kZXgsIHJldDsKKyAgICBpbnQgaW5kZXg7CisgICAgaW50NjRfdCByZXQ7
CiAgICAgQVZTdHJlYW0gKnN0OwogICAgIEFWSW5kZXhFbnRyeSAqaWU7Cgo=
More information about the ffmpeg-devel
mailing list