[FFmpeg-devel] [PATCH] lavf/file: prefer lseek64 to lseek
Yu Xiaolei
dreifachstein at gmail.com
Thu Oct 9 03:59:53 CEST 2014
This fixes 2GB seek limit on Android, because NDK does not handle _FILE_OFFSET_BITS (https://code.google.com/p/android/issues/detail?id=64613).
---
configure | 2 ++
libavformat/file.c | 4 ++++
2 files changed, 6 insertions(+)
diff --git a/configure b/configure
index 2a20d03..e8dc71d 100755
--- a/configure
+++ b/configure
@@ -1719,6 +1719,7 @@ SYSTEM_FUNCS="
jack_port_get_latency_range
kbhit
localtime_r
+ lseek64
lzo1x_999_compress
mach_absolute_time
MapViewOfFile
@@ -4704,6 +4705,7 @@ check_func strerror_r
check_func sysconf
check_func sysctl
check_func usleep
+check_func lseek64
check_func_headers conio.h kbhit
check_func_headers io.h setmode
diff --git a/libavformat/file.c b/libavformat/file.c
index 6511328..b30cde2 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -178,7 +178,11 @@ static int64_t file_seek(URLContext *h, int64_t pos, int whence)
return ret < 0 ? AVERROR(errno) : (S_ISFIFO(st.st_mode) ? 0 : st.st_size);
}
+#if HAVE_LSEEK64
+ ret = lseek64(c->fd, pos, whence);
+#else
ret = lseek(c->fd, pos, whence);
+#endif
return ret < 0 ? AVERROR(errno) : ret;
}
--
2.1.1
More information about the ffmpeg-devel
mailing list