[MPlayer-dev-eng] [PATCH] Support large files (>2GiB) on mingw32

Zuxy Meng zuxy.meng at gmail.com
Sat Jan 27 15:14:44 CET 2007


Hi,

For some reason MinGW provides off64_t, lseek64, fseeko64 and ftello64
instead of FILE_OFFSET_BITS dependent off_t, lseek, fseeko and ftello.
Hence the patch. Tested with a 2.3GB avi file and it worked OK: file
length were reported correctly and file seeking became usable.

BTW I don't know the situation for cygwin so correct the patch if
cygwin doesn't support large files either.

-- 
Zuxy
Beauty is truth,
While truth is beauty.
PGP KeyID: E8555ED6
-------------- next part --------------
Index: configure
===================================================================
--- configure	???????? 22024??
+++ configure	????????????
@@ -3446,6 +3446,13 @@
 EOF
 _fseeko=no
 cc_check && _fseeko=yes
+if test "$_fseeko" = no ; then
+ cat > $TMPC << EOF
+#include <stdio.h>
+int main (void) { int i; i = fseeko64(stdin, 0, 0); return 0; }
+EOF
+ cc_check && _fseeko=yes
+fi
 if test "$_fseeko" = yes ; then
  _def_fseeko='#define HAVE_FSEEKO 1'
  _need_fseeko=no
@@ -7249,6 +7256,14 @@
 EOF
 _ftello=no
 cc_check && _ftello=yes
+if test "$_ftello" = no ; then
+ cat > $TMPC << EOF
+#include <stdio.h>
+#include <sys/types.h>
+int main (void) { ftello64(stdin); return 0; }
+EOF
+ cc_check && _ftello=yes
+fi
 if test "$_ftello" = yes ; then
  _def_ftello='#define HAVE_FTELLO 1'
  _need_ftello=no
@@ -8391,6 +8406,18 @@
 #define X11_FULLSCREEN 1
 #endif
 
+/* hack to support large file on mingw32 */
+#if defined(__MINGW32__) && !defined(__CYGWIN__)
+#define _UWIN 1
+#include <unistd.h>
+#include <fcntl.h>
+#undef _UWIN
+#define off_t off64_t
+#define fseeko fseeko64
+#define lseek lseek64
+#define ftello ftello64
+#endif
+
 #endif /* MPLAYER_CONFIG_H */
 EOF
 


More information about the MPlayer-dev-eng mailing list