Commit a3fb27d5 authored by michaelni's avatar michaelni

os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@1447 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 39f7b0f7
...@@ -18,21 +18,26 @@ ifeq ($(CONFIG_WIN32),yes) ...@@ -18,21 +18,26 @@ ifeq ($(CONFIG_WIN32),yes)
EXE=.exe EXE=.exe
PROG=ffmpeg$(EXE) PROG=ffmpeg$(EXE)
else else
EXT= ifeq ($(CONFIG_OS2),yes)
EXE=.exe
PROG=ffmpeg$(EXE)
else
EXE=
PROG=ffmpeg ffplay PROG=ffmpeg ffplay
ifeq ($(CONFIG_FFSERVER),yes) ifeq ($(CONFIG_FFSERVER),yes)
PROG+=ffserver PROG+=ffserver
endif endif
endif endif
endif
ifeq ($(CONFIG_AUDIO_BEOS),yes) ifeq ($(CONFIG_AUDIO_BEOS),yes)
EXTRALIBS+=-lmedia -lbe EXTRALIBS+=-lmedia -lbe
endif endif
ifeq ($(BUILD_SHARED),yes) ifeq ($(BUILD_SHARED),yes)
DEP_LIBS=libavcodec/libavcodec.so libavformat/libavformat.a DEP_LIBS=libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF)
else else
DEP_LIBS=libavcodec/libavcodec.a libavformat/libavformat.a DEP_LIBS=libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF)
ifeq ($(CONFIG_MP3LAME),yes) ifeq ($(CONFIG_MP3LAME),yes)
EXTRALIBS+=-lmp3lame EXTRALIBS+=-lmp3lame
endif endif
...@@ -61,7 +66,8 @@ ffmpeg_g$(EXE): ffmpeg.o $(DEP_LIBS) ...@@ -61,7 +66,8 @@ ffmpeg_g$(EXE): ffmpeg.o $(DEP_LIBS)
-lavformat -lavcodec $(EXTRALIBS) -lavformat -lavcodec $(EXTRALIBS)
ffmpeg$(EXE): ffmpeg_g$(EXE) ffmpeg$(EXE): ffmpeg_g$(EXE)
cp -p $< $@ ; $(STRIP) $@ cp -p $< $@
$(STRIP) $@
ffserver$(EXE): ffserver.o $(DEP_LIBS) ffserver$(EXE): ffserver.o $(DEP_LIBS)
$(CC) $(LDFLAGS) $(FFSLDFLAGS) \ $(CC) $(LDFLAGS) $(FFSLDFLAGS) \
......
...@@ -13,6 +13,7 @@ fi ...@@ -13,6 +13,7 @@ fi
TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c" TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o" TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S" TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h" TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
...@@ -61,6 +62,7 @@ a52bin="no" ...@@ -61,6 +62,7 @@ a52bin="no"
win32="no" win32="no"
mingw32="no" mingw32="no"
cygwin="no" cygwin="no"
os2="no"
lshared="no" lshared="no"
extralibs="-lm" extralibs="-lm"
simpleidct="yes" simpleidct="yes"
...@@ -75,6 +77,10 @@ need_inet_aton="no" ...@@ -75,6 +77,10 @@ need_inet_aton="no"
ffserver="yes" ffserver="yes"
LDFLAGS=-Wl,--warn-common LDFLAGS=-Wl,--warn-common
FFSLDFLAGS=-Wl,-E FFSLDFLAGS=-Wl,-E
LIBPREF="lib"
LIBSUF=".a"
SLIBPREF="lib"
SLIBSUF=".so"
# OS specific # OS specific
targetos=`uname -s` targetos=`uname -s`
...@@ -169,6 +175,25 @@ echo "Missing inttypes.h, please copy cygwin_inttypes.h to" \ ...@@ -169,6 +175,25 @@ echo "Missing inttypes.h, please copy cygwin_inttypes.h to" \
Linux) Linux)
LDFLAGS="$LDFLAGS -rdynamic" LDFLAGS="$LDFLAGS -rdynamic"
;; ;;
OS/2)
TMPE=$TMPE".exe"
ar="emxomfar -p32"
strip="echo ignore strip"
CFLAGS="-Zomf"
LDFLAGS="-Zomf -Zstack 16384"
SHFLAGS=""
FFSLDFLAGS=""
LIBPREF=""
LIBSUF=".lib"
SLIBPREF=""
SLIBSUF=".dll"
extralibs=""
v4l="no"
audio_oss="no"
network="no"
ffserver="no"
os2="yes"
;;
*) ;; *) ;;
esac esac
...@@ -190,13 +215,13 @@ EOF ...@@ -190,13 +215,13 @@ EOF
ldl=-ldl ldl=-ldl
if $cc -o $TMPO $TMPC -ldl 2> /dev/null ; then if $cc -o $TMPE $TMPC -ldl 2> /dev/null ; then
vhook=yes vhook=yes
dlfcn=yes dlfcn=yes
dlopen=yes dlopen=yes
fi fi
if $cc -o $TMPO $TMPC 2> /dev/null ; then if $cc -o $TMPE $TMPC 2> /dev/null ; then
vhook=yes vhook=yes
dlfcn=yes dlfcn=yes
dlopen=yes dlopen=yes
...@@ -207,12 +232,12 @@ cat > $TMPC << EOF ...@@ -207,12 +232,12 @@ cat > $TMPC << EOF
int main( void ) { return (int) dlopen("foo", 0); } int main( void ) { return (int) dlopen("foo", 0); }
EOF EOF
if $cc -o $TMPO $TMPC -ldl 2> /dev/null ; then if $cc -o $TMPE $TMPC -ldl 2> /dev/null ; then
vhook=yes vhook=yes
dlopen=yes dlopen=yes
fi fi
if $cc -o $TMPO $TMPC 2> /dev/null ; then if $cc -o $TMPE $TMPC 2> /dev/null ; then
vhook=yes vhook=yes
dlopen=yes dlopen=yes
ldl="" ldl=""
...@@ -226,7 +251,7 @@ int main( void ) { return (int) imlib_load_font("foo"); } ...@@ -226,7 +251,7 @@ int main( void ) { return (int) imlib_load_font("foo"); }
EOF EOF
imlib2=no imlib2=no
if $cc -o $TMPO $TMPC -lImlib2 2> /dev/null ; then if $cc -o $TMPE $TMPC -lImlib2 2> /dev/null ; then
imlib2=yes imlib2=yes
fi fi
...@@ -318,7 +343,7 @@ int main(void) { ...@@ -318,7 +343,7 @@ int main(void) {
return 0; return 0;
} }
EOF EOF
$cc -o $TMPO $TMPC -faltivec 2> /dev/null || altivec="no" $cc -o $TMPE $TMPC -faltivec 2> /dev/null || altivec="no"
fi fi
# Can only do mmi on mips # Can only do mmi on mips
...@@ -338,7 +363,7 @@ int main(void) { ...@@ -338,7 +363,7 @@ int main(void) {
return 0; return 0;
} }
EOF EOF
$cc -o $TMPO $TMPC 2> /dev/null || mmi="no" $cc -o $TMPE $TMPC 2> /dev/null || mmi="no"
fi fi
# Checking for CFLAGS # Checking for CFLAGS
...@@ -377,8 +402,8 @@ int main(int argc, char ** argv){ ...@@ -377,8 +402,8 @@ int main(int argc, char ** argv){
} }
EOF EOF
if $cc -o $TMPO $TMPC 2>/dev/null ; then if $cc -o $TMPE $TMPC 2>/dev/null ; then
$TMPO && bigendian="yes" $TMPE && bigendian="yes"
else else
echo big/little test failed echo big/little test failed
fi fi
...@@ -402,7 +427,7 @@ EOF ...@@ -402,7 +427,7 @@ EOF
_memalign=no _memalign=no
_malloc_h=no _malloc_h=no
if $cc -o $TMPO $TMPC 2> /dev/null ; then if $cc -o $TMPE $TMPC 2> /dev/null ; then
_malloc_h=yes _malloc_h=yes
_memalign=yes _memalign=yes
# check for memalign - atmos # check for memalign - atmos
...@@ -414,7 +439,7 @@ string = memalign(64, sizeof(char)); ...@@ -414,7 +439,7 @@ string = memalign(64, sizeof(char));
return 0; return 0;
} }
EOF EOF
$cc -o $TMPO $TMPC 2> /dev/null || _memalign=no $cc -o $TMPE $TMPC 2> /dev/null || _memalign=no
fi fi
cat > $TMPC << EOF cat > $TMPC << EOF
...@@ -424,7 +449,7 @@ int main( void ) { return *strptime("", "", 0); } ...@@ -424,7 +449,7 @@ int main( void ) { return *strptime("", "", 0); }
EOF EOF
strptime=no strptime=no
if $cc -o $TMPO $TMPC 2> /dev/null ; then if $cc -o $TMPE $TMPC 2> /dev/null ; then
strptime=yes strptime=yes
fi fi
...@@ -439,8 +464,8 @@ if (zlibVersion() != ZLIB_VERSION) ...@@ -439,8 +464,8 @@ if (zlibVersion() != ZLIB_VERSION)
return 0; return 0;
} }
EOF EOF
$cc -o $TMPO $TMPC -lz 2> /dev/null || zlib="no" $cc -o $TMPE $TMPC -lz 2> /dev/null || zlib="no"
# $TMPO 2> /dev/null > /dev/null || zlib="no" # $TMPE 2> /dev/null > /dev/null || zlib="no"
# XXX: more tests needed - runtime test # XXX: more tests needed - runtime test
fi fi
if test "$zlib" = "yes"; then if test "$zlib" = "yes"; then
...@@ -455,9 +480,9 @@ int main( void ) { return (lrintf(3.999f) > 0)?0:1; } ...@@ -455,9 +480,9 @@ int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
EOF EOF
have_lrintf="no" have_lrintf="no"
if $cc $extralibs -o $TMPO $TMPC 2> /dev/null ; then if $cc $extralibs -o $TMPE $TMPC 2> /dev/null ; then
have_lrintf="yes" have_lrintf="yes"
$TMPO 2> /dev/null > /dev/null || have_lrintf="no" $TMPE 2> /dev/null > /dev/null || have_lrintf="no"
fi fi
_restrict= _restrict=
...@@ -577,6 +602,10 @@ echo "OPTFLAGS=$CFLAGS" >> config.mak ...@@ -577,6 +602,10 @@ echo "OPTFLAGS=$CFLAGS" >> config.mak
echo "LDFLAGS=$LDFLAGS" >> config.mak echo "LDFLAGS=$LDFLAGS" >> config.mak
echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
echo "SHFLAGS=$SHFLAGS" >> config.mak echo "SHFLAGS=$SHFLAGS" >> config.mak
echo "LIBPREF=$LIBPREF" >> config.mak
echo "LIBSUF=$LIBSUF" >> config.mak
echo "SLIBPREF=$SLIBPREF" >> config.mak
echo "SLIBSUF=$SLIBSUF" >> config.mak
if test "$cpu" = "x86" ; then if test "$cpu" = "x86" ; then
echo "TARGET_ARCH_X86=yes" >> config.mak echo "TARGET_ARCH_X86=yes" >> config.mak
echo "#define ARCH_X86 1" >> $TMPH echo "#define ARCH_X86 1" >> $TMPH
...@@ -728,6 +757,11 @@ if test "$cygwin" = "yes" ; then ...@@ -728,6 +757,11 @@ if test "$cygwin" = "yes" ; then
echo "CONFIG_WIN32=yes" >> config.mak echo "CONFIG_WIN32=yes" >> config.mak
fi fi
if test "$os2" = "yes" ; then
echo "#define CONFIG_OS2 1" >> $TMPH
echo "CONFIG_OS2=yes" >> config.mak
fi
if test "$darwin" = "yes"; then if test "$darwin" = "yes"; then
echo "#define CONFIG_DARWIN 1" >> $TMPH echo "#define CONFIG_DARWIN 1" >> $TMPH
echo "CONFIG_DARWIN=yes" >> config.mak echo "CONFIG_DARWIN=yes" >> config.mak
...@@ -786,4 +820,4 @@ else ...@@ -786,4 +820,4 @@ else
echo "config.h is unchanged" echo "config.h is unchanged"
fi fi
rm -f $TMPO $TMPC $TMPS $TMPH rm -f $TMPO $TMPC $TMPE $TMPS $TMPH
...@@ -28,6 +28,11 @@ ...@@ -28,6 +28,11 @@
#include <termios.h> #include <termios.h>
#include <sys/resource.h> #include <sys/resource.h>
#endif #endif
#ifdef CONFIG_OS2
#include <sys/types.h>
#include <sys/select.h>
#include <stdlib.h>
#endif
#include <time.h> #include <time.h>
#include <ctype.h> #include <ctype.h>
...@@ -2497,18 +2502,18 @@ void opt_pass(const char *pass_str) ...@@ -2497,18 +2502,18 @@ void opt_pass(const char *pass_str)
do_pass = pass; do_pass = pass;
} }
#ifndef CONFIG_WIN32 #if defined(CONFIG_WIN32) || defined(CONFIG_OS2)
INT64 getutime(void) INT64 getutime(void)
{ {
struct rusage rusage; return av_gettime();
getrusage(RUSAGE_SELF, &rusage);
return (rusage.ru_utime.tv_sec * 1000000LL) + rusage.ru_utime.tv_usec;
} }
#else #else
INT64 getutime(void) INT64 getutime(void)
{ {
return av_gettime(); struct rusage rusage;
getrusage(RUSAGE_SELF, &rusage);
return (rusage.ru_utime.tv_sec * 1000000LL) + rusage.ru_utime.tv_usec;
} }
#endif #endif
......
...@@ -91,9 +91,9 @@ endif ...@@ -91,9 +91,9 @@ endif
SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S) SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
OBJS := $(OBJS) $(ASM_OBJS) OBJS := $(OBJS) $(ASM_OBJS)
LIB= libavcodec.a LIB= $(LIBPREF)avcodec$(LIBSUF)
ifeq ($(BUILD_SHARED),yes) ifeq ($(BUILD_SHARED),yes)
SLIB= libavcodec.so SLIB= $(SLIBPREF)avcodec$(SLIBSUF)
endif endif
TESTS= imgresample-test dct-test motion-test fft-test TESTS= imgresample-test dct-test motion-test fft-test
...@@ -104,7 +104,9 @@ tests: apiexample cpuid_test $(TESTS) ...@@ -104,7 +104,9 @@ tests: apiexample cpuid_test $(TESTS)
$(LIB): $(OBJS) $(LIB): $(OBJS)
rm -f $@ rm -f $@
$(AR) rc $@ $(OBJS) $(AR) rc $@ $(OBJS)
ifneq ($(CONFIG_OS2),yes)
$(RANLIB) $@ $(RANLIB) $@
endif
$(SLIB): $(OBJS) $(SLIB): $(OBJS)
$(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS) $(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS)
......
...@@ -89,7 +89,38 @@ typedef INT64 int64_t; ...@@ -89,7 +89,38 @@ typedef INT64 int64_t;
# define snprintf _snprintf # define snprintf _snprintf
#else /* CONFIG_WIN32 */ /* CONFIG_WIN32 end */
#elif defined (CONFIG_OS2)
/* OS/2 EMX */
#include <inttypes.h>
typedef unsigned char UINT8;
typedef unsigned short UINT16;
typedef unsigned int UINT32;
typedef unsigned long long UINT64;
typedef signed char INT8;
typedef signed short INT16;
typedef signed int INT32;
typedef signed long long INT64;
#ifdef HAVE_AV_CONFIG_H
#ifndef INT64_C
#define INT64_C(c) (c ## LL)
#define UINT64_C(c) (c ## ULL)
#endif
#ifdef USE_FASTMEMCPY
#include "fastmemcpy.h"
#endif
#include <float.h>
#endif /* HAVE_AV_CONFIG_H */
/* CONFIG_OS2 end */
#else
/* unix */ /* unix */
...@@ -119,7 +150,7 @@ typedef signed long long INT64; ...@@ -119,7 +150,7 @@ typedef signed long long INT64;
# endif # endif
# endif /* HAVE_AV_CONFIG_H */ # endif /* HAVE_AV_CONFIG_H */
#endif /* !CONFIG_WIN32 */ #endif /* !CONFIG_WIN32 && !CONFIG_OS2 */
#ifdef HAVE_AV_CONFIG_H #ifdef HAVE_AV_CONFIG_H
......
...@@ -48,14 +48,16 @@ ifeq ($(CONFIG_VORBIS),yes) ...@@ -48,14 +48,16 @@ ifeq ($(CONFIG_VORBIS),yes)
OBJS+= ogg.o OBJS+= ogg.o
endif endif
LIB= libavformat.a LIB= $(LIBPREF)avformat$(LIBSUF)
all: $(LIB) all: $(LIB)
$(LIB): $(OBJS) $(LIB): $(OBJS)
rm -f $@ rm -f $@
$(AR) rc $@ $(OBJS) $(AR) rc $@ $(OBJS)
ifneq ($(CONFIG_OS2),yes)
$(RANLIB) $@ $(RANLIB) $@
endif
installlib: all installlib: all
install -m 644 $(LIB) $(prefix)/lib install -m 644 $(LIB) $(prefix)/lib
...@@ -73,4 +75,4 @@ installlib: all ...@@ -73,4 +75,4 @@ installlib: all
g++ $(subst -Wall,,$(CFLAGS)) -c -o $@ $< g++ $(subst -Wall,,$(CFLAGS)) -c -o $@ $<
clean: clean:
rm -f *.o *~ *.a rm -f *.o *~ *.a $(LIB)
...@@ -42,7 +42,7 @@ static int file_open(URLContext *h, const char *filename, int flags) ...@@ -42,7 +42,7 @@ static int file_open(URLContext *h, const char *filename, int flags)
} else { } else {
access = O_RDONLY; access = O_RDONLY;
} }
#ifdef CONFIG_WIN32 #if defined(CONFIG_WIN32) || defined(CONFIG_OS2)
access |= O_BINARY; access |= O_BINARY;
#endif #endif
fd = open(filename, access, 0666); fd = open(filename, access, 0666);
......
...@@ -26,9 +26,13 @@ ...@@ -26,9 +26,13 @@
#ifdef __BEOS__ #ifdef __BEOS__
# ifndef usleep # ifndef usleep
# include <OS.h> # include <OS.h>
# define usleep(t) snooze((bigtime_t)(t)) # define usleep(t) snooze((bigtime_t)(t))
# endif # endif
#endif #endif
#if defined(CONFIG_OS2)
# include <stdlib.h>
# define usleep(t) _sleep2((t) / 1000)
#endif
typedef struct { typedef struct {
int width; int width;
......
...@@ -18,14 +18,18 @@ ...@@ -18,14 +18,18 @@
*/ */
#include "avformat.h" #include "avformat.h"
#include <ctype.h> #include <ctype.h>
#ifndef CONFIG_WIN32 #ifdef CONFIG_WIN32
#include <unistd.h>
#include <fcntl.h>
#include <sys/time.h>
#else
#define strcasecmp _stricmp #define strcasecmp _stricmp
#include <sys/types.h> #include <sys/types.h>
#include <sys/timeb.h> #include <sys/timeb.h>
#elif defined(CONFIG_OS2)
#include <string.h>
#define strcasecmp stricmp
#include <sys/time.h>
#else
#include <unistd.h>
#include <fcntl.h>
#include <sys/time.h>
#endif #endif
#include <time.h> #include <time.h>
...@@ -362,7 +366,7 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, ...@@ -362,7 +366,7 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
} }
/* XXX: suppress this hack for redirectors */ /* XXX: suppress this hack for redirectors */
#ifndef __MINGW32__ #ifdef CONFIG_NETWORK
if (fmt == &redir_demux) { if (fmt == &redir_demux) {
err = redir_open(ic_ptr, &ic->pb); err = redir_open(ic_ptr, &ic->pb);
url_fclose(&ic->pb); url_fclose(&ic->pb);
......
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