[FFmpeg-devel] [PATCH] Fix pcm_read_seek for positions larger than 2 GB

Daniel Verkamp daniel
Fri Oct 2 02:32:00 CEST 2009


Hi,

Attached is a patch to fix pcm_read_seek() when the position it
calculates is greater than 2 GB.

Currently, it puts the return value of url_fseek() in an int and then
compares < 0 to see if an error occurred; if the position is greater
than 2 GB, the 32-bit signed int result will be < 0.

The patch just changes the type of ret to int64_t to avoid the wraparound.

This fixes seeking of large audio files; tested in ffplay with a ~4 GB
RF64 file and a ~8GB SoX file.

Thanks,
-- Daniel Verkamp
-------------- next part --------------
>From 7312cd64b2aadd704f0f501b8e65c32dc66fc05b Mon Sep 17 00:00:00 2001
From: Daniel Verkamp <daniel at drv.nu>
Date: Thu, 1 Oct 2009 20:27:35 -0400
Subject: [PATCH] Fix pcm_read_seek for positions larger than 2 GB

---
 libavformat/raw.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/raw.c b/libavformat/raw.c
index 260b690..4d4878d 100644
--- a/libavformat/raw.c
+++ b/libavformat/raw.c
@@ -220,8 +220,8 @@ int pcm_read_seek(AVFormatContext *s,
                   int stream_index, int64_t timestamp, int flags)
 {
     AVStream *st;
-    int block_align, byte_rate, ret;
-    int64_t pos;
+    int block_align, byte_rate;
+    int64_t pos, ret;
 
     st = s->streams[0];
 
-- 
1.6.4.2



More information about the ffmpeg-devel mailing list