[FFmpeg-devel] [PATCH] lavf/file: prefer lseek64 to lseek

Michael Niedermayer michaelni at gmx.at
Thu Oct 9 04:18:17 CEST 2014


On Wed, Oct 08, 2014 at 11:06:46PM -0300, James Almer wrote:
> On 08/10/14 10:59 PM, Yu Xiaolei wrote:
> > 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;
> >  }
> > 
> 
> This should probably be handled in os_support.h

+1

also there are more uses of lseek() in the codebase. a solution in
os_support.h would fix all of them, this just fixes one

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

The worst form of inequality is to try to make unequal things equal.
-- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141009/1f1dff8a/attachment.asc>


More information about the ffmpeg-devel mailing list