[FFmpeg-devel] Fix for seek issues with files >2GB

Michael Niedermayer michaelni
Tue Dec 1 23:53:31 CET 2009


On Tue, Dec 01, 2009 at 02:21:43PM -0800, Sean Soria wrote:
> 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;

ok

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091201/1a605ca2/attachment.pgp>



More information about the ffmpeg-devel mailing list