From 743ad5971608e491bd1d70a31e9bfdc496301eef Mon Sep 17 00:00:00 2001 From: Loren Merritt Date: Fri, 13 Jan 2006 06:54:10 +0000 Subject: [PATCH] cli: large file support git-svn-id: svn://svn.videolan.org/x264/trunk@399 df754926-b1dd-0310-bc7b-ec298dee348c --- Makefile | 3 --- configure | 18 +++++++++++++----- matroska.c | 3 +++ version.sh | 4 ++-- x264.c | 15 +++++++++------ 5 files changed, 27 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index a6016db4..b026e32d 100644 --- 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) diff --git a/configure b/configure index 1faa1136..3b696f8d 100755 --- 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 diff --git a/matroska.c b/matroska.c index 430f5168..fb7e4d0c 100644 --- a/matroska.c +++ b/matroska.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 #include #include diff --git a/version.sh b/version.sh index 75422f57..a91c48bc 100755 --- a/version.sh +++ b/version.sh @@ -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 cf0055cb..0cb14ab9 100644 --- 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 #include #include @@ -36,6 +39,10 @@ #include /* _O_BINARY */ #endif +#ifndef _MSC_VER +#include "config.h" +#endif + #ifdef AVIS_INPUT #include #include @@ -49,10 +56,6 @@ #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 -- 2.47.3