[Libav-user] Building with MSVC toolchain resulting in seeking problem?
John Orr
john.orr at scala.com
Tue Mar 12 16:04:07 CET 2013
On 3/12/2013 5:47 AM, Bjoern Drabeck wrote:
> Hi,
>
> as described in the ffmpeg documentation
> http://ffmpeg.org/platform.html#Windows under 4.2, I have set up
> MinGW/MSys to compile using the MSVC toolchain and c99-to-c89 tool. I
> have got that to build, however compared to builds from the zeranoe
> site (and also builds I have asked a friend of mine to make for me
> using mingw with gcc), I always end up with seeking problems.
>
I think the MSVC builds use 32-bit fstat and lseek functions, so they
don't play or seek correctly with files > 2GB.
I modified file_seek in libavformat/file.c locally like this:
/* XXX: use llseek */
static int64_t file_seek(URLContext *h, int64_t pos, int whence)
{
FileContext *c = h->priv_data;
int64_t ret;
if (whence == AVSEEK_SIZE) {
#ifndef _MSC_VER
struct stat st;
ret = fstat(c->fd, &st);
#else
struct _stat64 st;
ret = _fstati64( c->fd, &st );
#endif
return ret < 0 ? AVERROR(errno) : (S_ISFIFO(st.st_mode) ? 0 :
st.st_size);
}
#ifndef _MSC_VER
ret = lseek(c->fd, pos, whence);
#else
ret = _lseeki64(c->fd, pos, whence);
#endif
return ret < 0 ? AVERROR(errno) : ret;
}
--Johno
More information about the Libav-user
mailing list