Commit 743ad597 authored by Loren Merritt's avatar Loren Merritt

cli: large file support



git-svn-id: svn://svn.videolan.org/x264/trunk@399 df754926-b1dd-0310-bc7b-ec298dee348c
parent 0abf15d2
...@@ -51,9 +51,6 @@ endif ...@@ -51,9 +51,6 @@ endif
ifneq ($(HAVE_GETOPT_LONG),1) ifneq ($(HAVE_GETOPT_LONG),1)
SRCS += extras/getopt.c SRCS += extras/getopt.c
CFLAGS += -DHAVE_GETOPT_LONG=0
else
CFLAGS += -DHAVE_GETOPT_LONG=1
endif endif
OBJS = $(SRCS:%.c=%.o) OBJS = $(SRCS:%.c=%.o)
......
...@@ -25,7 +25,7 @@ cc_check() { ...@@ -25,7 +25,7 @@ cc_check() {
rm -f conftest* rm -f conftest*
cat > conftest.c << EOF cat > conftest.c << EOF
#include <$1> #include <$1>
int main () { return 0; } int main () { $3 return 0; }
EOF EOF
$CC $CFLAGS $LDFLAGS $2 conftest.c -o conftest 2>$DEVNULL $CC $CFLAGS $LDFLAGS $2 conftest.c -o conftest 2>$DEVNULL
TMP="$?" TMP="$?"
...@@ -33,6 +33,8 @@ EOF ...@@ -33,6 +33,8 @@ EOF
return $TMP return $TMP
} }
rm -f config.h config.mak x264.pc
prefix='/usr/local' prefix='/usr/local'
exec_prefix='${prefix}' exec_prefix='${prefix}'
bindir='${exec_prefix}/bin' bindir='${exec_prefix}/bin'
...@@ -277,7 +279,7 @@ if [ "$mp4_output" = "auto" ] ; then ...@@ -277,7 +279,7 @@ if [ "$mp4_output" = "auto" ] ; then
cc_check gpac/isomedia.h "$MP4_LDFLAGS" && mp4_output="yes" cc_check gpac/isomedia.h "$MP4_LDFLAGS" && mp4_output="yes"
fi fi
if [ "$mp4_output" = "yes" ] ; then if [ "$mp4_output" = "yes" ] ; then
CFLAGS="$CFLAGS -DMP4_OUTPUT" echo "#define MP4_OUTPUT" >> config.h
LDFLAGS="$LDFLAGS $MP4_LDFLAGS" LDFLAGS="$LDFLAGS $MP4_LDFLAGS"
fi fi
...@@ -289,7 +291,7 @@ if [ "$avis_input" = "auto" ] ; then ...@@ -289,7 +291,7 @@ if [ "$avis_input" = "auto" ] ; then
fi fi
fi fi
if [ "$avis_input" = "yes" ] ; then if [ "$avis_input" = "yes" ] ; then
CFLAGS="$CFLAGS -DAVIS_INPUT" echo "#define AVIS_INPUT" >> config.h
LDFLAGS="$LDFLAGS -lvfw32" LDFLAGS="$LDFLAGS -lvfw32"
fi fi
...@@ -299,9 +301,16 @@ if [ "$debug" != "yes" -a "$gprof" != "yes" ]; then ...@@ -299,9 +301,16 @@ if [ "$debug" != "yes" -a "$gprof" != "yes" ]; then
VFW_LDFLAGS="$VFW_LDFLAGS -s" VFW_LDFLAGS="$VFW_LDFLAGS -s"
fi 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 # generate config files
rm -f config.mak
cat > config.mak << EOF cat > config.mak << EOF
prefix=$prefix prefix=$prefix
exec_prefix=$exec_prefix exec_prefix=$exec_prefix
...@@ -334,7 +343,6 @@ fi ...@@ -334,7 +343,6 @@ fi
./version.sh ./version.sh
rm -f x264.pc
cat > x264.pc << EOF cat > x264.pc << EOF
prefix=$prefix prefix=$prefix
exec_prefix=$exec_prefix exec_prefix=$exec_prefix
......
...@@ -21,6 +21,9 @@ ...@@ -21,6 +21,9 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/ *****************************************************************************/
#define _LARGEFILE_SOURCE
#define _FILE_OFFSET_BITS 64
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
......
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
VER=`svnversion .` VER=`svnversion .`
if [ "x$VER" != x -a "$VER" != exported ] if [ "x$VER" != x -a "$VER" != exported ]
then 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].*//'` VER=`echo $VER | sed -e 's/[^0-9].*//'`
else else
echo "#define X264_VERSION \"\"" > config.h echo "#define X264_VERSION \"\"" >> config.h
VER="x" VER="x"
fi fi
API=`grep '#define X264_BUILD' < x264.h | sed -e 's/.* \([1-9][0-9]*\).*/\1/'` API=`grep '#define X264_BUILD' < x264.h | sed -e 's/.* \([1-9][0-9]*\).*/\1/'`
......
...@@ -21,6 +21,9 @@ ...@@ -21,6 +21,9 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/ *****************************************************************************/
#define _LARGEFILE_SOURCE
#define _FILE_OFFSET_BITS 64
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
...@@ -36,6 +39,10 @@ ...@@ -36,6 +39,10 @@
#include <fcntl.h> /* _O_BINARY */ #include <fcntl.h> /* _O_BINARY */
#endif #endif
#ifndef _MSC_VER
#include "config.h"
#endif
#ifdef AVIS_INPUT #ifdef AVIS_INPUT
#include <windows.h> #include <windows.h>
#include <vfw.h> #include <vfw.h>
...@@ -49,10 +56,6 @@ ...@@ -49,10 +56,6 @@
#include "common/common.h" #include "common/common.h"
#include "x264.h" #include "x264.h"
#ifndef _MSC_VER
#include "config.h"
#endif
#include "matroska.h" #include "matroska.h"
#define DATA_MAX 3000000 #define DATA_MAX 3000000
...@@ -1182,7 +1185,7 @@ static int get_frame_total_yuv( hnd_t handle, int i_width, int i_height ) ...@@ -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 ) ) if( !fseek( f, 0, SEEK_END ) )
{ {
int64_t i_size = ftell( f ); off_t i_size = ftell( f );
fseek( f, 0, SEEK_SET ); fseek( f, 0, SEEK_SET );
i_frame_total = (int)(i_size / ( i_width * i_height * 3 / 2 )); 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 ...@@ -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; FILE *f = (FILE *)handle;
if( i_frame != prev_frame+1 ) 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; return -1;
if( fread( p_pic->img.plane[0], 1, i_width * i_height, f ) <= 0 if( fread( p_pic->img.plane[0], 1, i_width * i_height, f ) <= 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment