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
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)
......
......@@ -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
......
......@@ -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>
......
......@@ -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/'`
......
......@@ -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>
......@@ -36,6 +39,10 @@
#include <fcntl.h> /* _O_BINARY */
#endif
#ifndef _MSC_VER
#include "config.h"
#endif
#ifdef AVIS_INPUT
#include <windows.h>
#include <vfw.h>
......@@ -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
......
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