Browse Source

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

Originally committed as revision 1447 to svn://svn.ffmpeg.org/ffmpeg/trunk
tags/v0.5
Slavik Gnatenko Michael Niedermayer 23 years ago
parent
commit
f3ec2d46ba
9 changed files with 129 additions and 41 deletions
  1. +10
    -4
      Makefile
  2. +51
    -17
      configure
  3. +11
    -6
      ffmpeg.c
  4. +4
    -2
      libavcodec/Makefile
  5. +33
    -2
      libavcodec/common.h
  6. +4
    -2
      libavformat/Makefile
  7. +1
    -1
      libavformat/file.c
  8. +5
    -1
      libavformat/img.c
  9. +10
    -6
      libavformat/utils.c

+ 10
- 4
Makefile View File

@@ -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) \


+ 51
- 17
configure View File

@@ -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

+ 11
- 6
ffmpeg.c View File

@@ -28,6 +28,11 @@
#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



+ 4
- 2
libavcodec/Makefile View 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)


+ 33
- 2
libavcodec/common.h View 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



+ 4
- 2
libavformat/Makefile View 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)

+ 1
- 1
libavformat/file.c View 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);


+ 5
- 1
libavformat/img.c View File

@@ -26,9 +26,13 @@
#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;


+ 10
- 6
libavformat/utils.c View File

@@ -18,14 +18,18 @@
*/
#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);


Loading…
Cancel
Save