]> git.sesse.net Git - x264/commitdiff
cli: large file support
authorLoren Merritt <pengvado@videolan.org>
Fri, 13 Jan 2006 06:54:10 +0000 (06:54 +0000)
committerLoren Merritt <pengvado@videolan.org>
Fri, 13 Jan 2006 06:54:10 +0000 (06:54 +0000)
git-svn-id: svn://svn.videolan.org/x264/trunk@399 df754926-b1dd-0310-bc7b-ec298dee348c

Makefile
configure
matroska.c
version.sh
x264.c

index a6016db45a2f8c6e6ec0542f037d2c78a013c668..b026e32d822c78cd1bacd6b014c1b7a79b170032 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -51,9 +51,6 @@ endif
 
 ifneq ($(HAVE_GETOPT_LONG),1)
 SRCS += extras/getopt.c
-CFLAGS += -DHAVE_GETOPT_LONG=0
-else
-CFLAGS += -DHAVE_GETOPT_LONG=1
 endif
 
 OBJS = $(SRCS:%.c=%.o)
index 1faa11363dada98f51d3939043935f6ed13d4d0d..3b696f8d6bc0fe51f68f7b15aafa6811755bb016 100755 (executable)
--- a/configure
+++ b/configure
@@ -25,7 +25,7 @@ cc_check() {
     rm -f conftest*
     cat > conftest.c << EOF
 #include <$1>
-int main () { return 0; }
+int main () { $3 return 0; }
 EOF
     $CC $CFLAGS $LDFLAGS $2 conftest.c -o conftest 2>$DEVNULL
     TMP="$?"
@@ -33,6 +33,8 @@ EOF
     return $TMP
 }
 
+rm -f config.h config.mak x264.pc
+
 prefix='/usr/local'
 exec_prefix='${prefix}'
 bindir='${exec_prefix}/bin'
@@ -277,7 +279,7 @@ if [ "$mp4_output" = "auto" ] ; then
     cc_check gpac/isomedia.h "$MP4_LDFLAGS" && mp4_output="yes"
 fi
 if [ "$mp4_output" = "yes" ] ; then
-    CFLAGS="$CFLAGS -DMP4_OUTPUT"
+    echo "#define MP4_OUTPUT" >> config.h
     LDFLAGS="$LDFLAGS $MP4_LDFLAGS"
 fi
 
@@ -289,7 +291,7 @@ if [ "$avis_input" = "auto" ] ; then
     fi
 fi
 if [ "$avis_input" = "yes" ] ; then
-    CFLAGS="$CFLAGS -DAVIS_INPUT"
+    echo "#define AVIS_INPUT" >> config.h
     LDFLAGS="$LDFLAGS -lvfw32"
 fi
 
@@ -299,9 +301,16 @@ if [ "$debug" != "yes" -a "$gprof" != "yes" ]; then
     VFW_LDFLAGS="$VFW_LDFLAGS -s"
 fi
 
+if cc_check "stdio.h" "" "fseeko(stdin,0,0);" ; then
+    echo "#define fseek fseeko" >> config.h
+    echo "#define ftell ftello" >> config.h
+elif cc_check "stdio.h" "" "fseeko64(stdin,0,0);" ; then
+    echo "#define fseek fseeko64" >> config.h
+    echo "#define ftell ftello64" >> config.h
+fi
+
 # generate config files
 
-rm -f config.mak
 cat > config.mak << EOF
 prefix=$prefix
 exec_prefix=$exec_prefix
@@ -334,7 +343,6 @@ fi
 
 ./version.sh
 
-rm -f x264.pc
 cat > x264.pc << EOF
 prefix=$prefix
 exec_prefix=$exec_prefix
index 430f51684e9c515235744f608fc3ab54eeac132d..fb7e4d0ca893e95f943e814639dc8127bcc01abf 100644 (file)
@@ -21,6 +21,9 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  *****************************************************************************/
 
+#define _LARGEFILE_SOURCE
+#define _FILE_OFFSET_BITS 64
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index 75422f579674d8fdb39ef509cef80ba0b153febd..a91c48bc0119aa9a84ca0ebf709d65aff1e93800 100755 (executable)
@@ -2,10 +2,10 @@
 VER=`svnversion .`
 if [ "x$VER" != x -a "$VER" != exported ]
 then
-  echo "#define X264_VERSION \" svn-$VER\"" > config.h
+  echo "#define X264_VERSION \" svn-$VER\"" >> config.h
   VER=`echo $VER | sed -e 's/[^0-9].*//'`
 else
-  echo "#define X264_VERSION \"\"" > config.h
+  echo "#define X264_VERSION \"\"" >> config.h
   VER="x"
 fi
 API=`grep '#define X264_BUILD' < x264.h | sed -e 's/.* \([1-9][0-9]*\).*/\1/'`
diff --git a/x264.c b/x264.c
index cf0055cbd2a040a4775ea63da511c5589ccd2cd6..0cb14ab9d7bf00cc80b7bf3ad34e4b1b3584c303 100644 (file)
--- a/x264.c
+++ b/x264.c
@@ -21,6 +21,9 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  *****************************************************************************/
 
+#define _LARGEFILE_SOURCE
+#define _FILE_OFFSET_BITS 64
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <fcntl.h>  /* _O_BINARY */
 #endif
 
+#ifndef _MSC_VER
+#include "config.h"
+#endif
+
 #ifdef AVIS_INPUT
 #include <windows.h>
 #include <vfw.h>
 #include "common/common.h"
 #include "x264.h"
 
-#ifndef _MSC_VER
-#include "config.h"
-#endif
-
 #include "matroska.h"
 
 #define DATA_MAX 3000000
@@ -1182,7 +1185,7 @@ static int get_frame_total_yuv( hnd_t handle, int i_width, int i_height )
 
     if( !fseek( f, 0, SEEK_END ) )
     {
-        int64_t i_size = ftell( f );
+        off_t i_size = ftell( f );
         fseek( f, 0, SEEK_SET );
         i_frame_total = (int)(i_size / ( i_width * i_height * 3 / 2 ));
     }
@@ -1196,7 +1199,7 @@ static int read_frame_yuv( x264_picture_t *p_pic, hnd_t handle, int i_frame, int
     FILE *f = (FILE *)handle;
 
     if( i_frame != prev_frame+1 )
-        if( fseek( f, i_frame * i_width * i_height * 3 / 2, SEEK_SET ) )
+        if( fseek( f, (off_t)i_frame * i_width * i_height * 3 / 2, SEEK_SET ) )
             return -1;
 
     if( fread( p_pic->img.plane[0], 1, i_width * i_height, f ) <= 0