]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
authormichaelni <michaelni@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Sat, 11 Jan 2003 20:34:38 +0000 (20:34 +0000)
committermichaelni <michaelni@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Sat, 11 Jan 2003 20:34:38 +0000 (20:34 +0000)
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@1447 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

Makefile
configure
ffmpeg.c
libavcodec/Makefile
libavcodec/common.h
libavformat/Makefile
libavformat/file.c
libavformat/img.c
libavformat/utils.c

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