* using liba52

Originally committed as revision 417 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Zdenek Kabelac 2002-04-22 19:57:45 +00:00
parent 623563c04a
commit 5751432312
4 changed files with 57 additions and 30 deletions

View File

@ -29,6 +29,9 @@ EXTRALIBS+=-lmp3lame
endif
endif
OBJS = ffmpeg.o ffserver.o
SRCS = $(OBJS:.o=.c) $(ASM_OBJS:.o=.s)
all: lib $(PROG)
lib:
@ -52,6 +55,11 @@ install: all
install -s -m 755 $(PROG) $(prefix)/bin
ln -sf ffmpeg $(prefix)/bin/ffplay
dep: depend
depend:
$(CC) -MM $(CFLAGS) $(SRCS) 1>.depend
clean:
$(MAKE) -C libavcodec clean
$(MAKE) -C libav clean
@ -63,3 +71,7 @@ distclean: clean
TAGS:
etags *.[ch] libav/*.[ch] libavcodec/*.[ch]
ifneq ($(wildcard .depend),)
include .depend
endif

48
configure vendored
View File

@ -5,13 +5,13 @@ TMPO="ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
TMPS="ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
TMPH="ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
if [ ! -z "$TMPDIR" ]; then
if test ! -z "$TMPDIR" ; then
TMPC="${TMPDIR}/${TMPC}"
TMPCPP="${TMPDIR}/${TMPCPP}"
TMPO="${TMPDIR}/${TMPO}"
TMPS="${TMPDIR}/${TMPS}"
TMPH="${TMPDIR}/${TMPH}"
elif [ ! -z "$TEMPDIR" ]; then
elif test ! -z "$TEMPDIR" ; then
TMPC="${TEMPDIR}/${TMPC}"
TMPCPP="${TEMPDIR}/${TMPCPP}"
TMPO="${TEMPDIR}/${TMPO}"
@ -50,6 +50,7 @@ esac
gprof="no"
grab="yes"
mp3lame="no"
a52bin="no"
win32="no"
extralibs="-lm"
@ -72,7 +73,7 @@ fi ;;
*) ;;
esac
if [ "$1" = "-h" -o "$1" = "--help" ] ; then
if test "$1" = "-h" -o "$1" = "--help" ; then
cat << EOF
Usage: configure [options]
@ -86,9 +87,10 @@ echo " --cpu=CPU force cpu to CPU [$cpu]"
echo " --disable-mmx disable mmx usage"
echo " --enable-gprof enable profiling with gprof [$gprof]"
echo " --disable-grab disable audio/video grabbing code"
echo " --enable-simple_idct use simple IDCT routines"
echo " --enable-mp3lame enable mp3 encoding via libmp3lame"
echo " --enable-simple_idct use simple IDCT routines [default=no]"
echo " --enable-mp3lame enable mp3 encoding via libmp3lame [default=no]"
echo " --enable-win32 enable win32 cross compile"
echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
echo " --enable-shared build shared libraries [default=no]"
exit 1
fi
@ -108,6 +110,8 @@ for opt do
;;
--disable-grab) grab="no"
;;
--enable-a52bin) a52bin="yes" ; extralibs="-ldl $extralibs"
;;
--enable-mp3lame) mp3lame="yes"
;;
--enable-simple_idct) simpleidct="yes"
@ -124,7 +128,7 @@ if test -z "$CFLAGS"; then
CFLAGS="-O2"
fi
if [ "$win32" = "yes" ] ; then
if test "$win32" = "yes" ; then
cross_prefix="i386-mingw32msvc-"
cc="${cross_prefix}gcc"
ar="${cross_prefix}ar"
@ -163,6 +167,7 @@ echo "MMX enabled $mmx"
echo "gprof enabled $gprof"
echo "grab enabled $grab"
echo "mp3lame enabled $mp3lame"
echo "a52 dlopened $a52bin"
echo "Creating config.mak and config.h"
@ -174,27 +179,27 @@ echo "MAKE=make" >> config.mak
echo "CC=$cc" >> config.mak
echo "AR=$ar" >> config.mak
echo "OPTFLAGS=$CFLAGS" >> config.mak
if [ "$cpu" = "x86" ] ; then
if test "$cpu" = "x86" ; then
echo "TARGET_ARCH_X86=yes" >> config.mak
echo "#define ARCH_X86 1" >> $TMPH
fi
if [ "$cpu" = "armv4l" ]; then
if test "$cpu" = "armv4l" ; then
echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
echo "#define ARCH_ARMV4L 1" >> $TMPH
fi
if [ "$cpu" = "alpha" ]; then
if test "$cpu" = "alpha" ; then
echo "TARGET_ARCH_ALPHA=yes" >> config.mak
echo "#define ARCH_ALPHA 1" >> $TMPH
fi
if [ "$mmx" = "yes" ] ; then
if test "$mmx" = "yes" ; then
echo "TARGET_MMX=yes" >> config.mak
echo "#define HAVE_MMX 1" >> $TMPH
fi
if [ "$gprof" = "yes" ] ; then
if test "$gprof" = "yes" ; then
echo "TARGET_GPROF=yes" >> config.mak
echo "#define HAVE_GPROF 1" >> $TMPH
fi
if [ "$lshared" = "yes" ] ; then
if test "$lshared" = "yes" ; then
echo "BUILD_SHARED=yes" >> config.mak
else
echo "BUILD_SHARED=no" >> config.mak
@ -216,34 +221,41 @@ echo "CONFIG_DECODERS=yes" >> config.mak
echo "#define CONFIG_AC3 1" >> $TMPH
echo "CONFIG_AC3=yes" >> config.mak
if [ "$grab" = "yes" ] ; then
if test "$a52bin" = "yes" ; then
echo "#define CONFIG_A52BIN 1" >> $TMPH
echo "CONFIG_A52BIN=yes" >> config.mak
else
echo "CONFIG_A52BIN=no" >> config.mak
fi
if test "$grab" = "yes" ; then
echo "#define CONFIG_GRAB 1" >> $TMPH
echo "CONFIG_GRAB=yes" >> config.mak
fi
if [ "$mp3lame" = "yes" ] ; then
if test "$mp3lame" = "yes" ; then
echo "#define CONFIG_MP3LAME 1" >> $TMPH
echo "CONFIG_MP3LAME=yes" >> config.mak
fi
if [ "$win32" = "yes" ] ; then
if test "$win32" = "yes" ; then
echo "#define CONFIG_WIN32 1" >> $TMPH
echo "CONFIG_WIN32=yes" >> config.mak
fi
if [ "$_malloc_h" = "yes" ]; then
if test "$_malloc_h" = "yes" ; then
echo "#define HAVE_MALLOC_H 1" >> $TMPH
else
echo "#undef HAVE_MALLOC_H" >> $TMPH
fi
if [ "$_memalign" = "yes" ]; then
if test "$_memalign" = "yes" ; then
echo "#define HAVE_MEMALIGN 1" >> $TMPH
else
echo "#undef HAVE_MEMALIGN" >> $TMPH
fi
if [ "$simpleidct" = "yes" ]; then
if test "$simpleidct" = "yes" ; then
echo "#define SIMPLE_IDCT 1" >> $TMPH
fi

View File

@ -10,11 +10,15 @@ OBJS= common.o utils.o mpegvideo.o h263.o jrevdct.o jfdctfst.o \
ratecontrol.o
ASM_OBJS=
# currently using libac3 for ac3 decoding
# currently using liba52 for ac3 decoding
ifeq ($(CONFIG_AC3),yes)
OBJS+= ac3dec.o \
libac3/bit_allocate.o libac3/bitstream.o libac3/downmix.o \
libac3/imdct.o libac3/parse.o
OBJS+= a52dec.o
endif
# using builtin liba52 or runtime linked liba52.so.0
ifeq ($(CONFIG_A52BIN),no)
OBJS+= liba52/bit_allocate.o liba52/bitstream.o liba52/downmix.o \
liba52/imdct.o liba52/parse.o
endif
ifeq ($(CONFIG_MP3LAME),yes)
@ -30,7 +34,7 @@ endif
ifeq ($(TARGET_MMX),yes)
OBJS += i386/fdct_mmx.o i386/cputest.o \
i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
i386/idct_mmx.o i386/motion_est_mmx.o \
i386/idct_mmx.o i386/motion_est_mmx.o \
i386/simple_idct_mmx.o
endif
@ -91,8 +95,8 @@ clean:
armv4l/*.o armv4l/*~ \
mlib/*.o mlib/*~ \
alpha/*.o alpha/*~ \
libac3/*.o libac3/*~ \
apiexample $(TESTS)
liba52/*.o liba52/*~ \
apiexample $(TESTS)
distclean: clean
rm -f Makefile.bak .depend

View File

@ -19,7 +19,7 @@
#include "avcodec.h"
#include "liba52/a52.h"
#ifdef LIBAVCODEC_A52BIN
#ifdef CONFIG_A52BIN
#include <dlfcn.h>
static const char* liba52name = "liba52.so.0";
#endif
@ -62,7 +62,7 @@ typedef struct AC3DecodeState {
} AC3DecodeState;
#ifdef LIBAVCODEC_A52BIN
#ifdef CONFIG_A52BIN
static void* dlsymm(void* handle, const char* symbol)
{
void* f = dlsym(handle, symbol);
@ -76,7 +76,7 @@ static int a52_decode_init(AVCodecContext *avctx)
{
AC3DecodeState *s = avctx->priv_data;
#ifdef LIBAVCODEC_A52BIN
#ifdef CONFIG_A52BIN
s->handle = dlopen(liba52name, RTLD_LAZY);
if (!s->handle)
{
@ -95,7 +95,6 @@ static int a52_decode_init(AVCodecContext *avctx)
dlclose(s->handle);
return -1;
}
printf("INITIALIZED\n");
#else
/* static linked version */
s->handle = 0;
@ -233,7 +232,7 @@ static int a52_decode_end(AVCodecContext *avctx)
{
AC3DecodeState *s = avctx->priv_data;
s->a52_free(s->state);
#ifdef LIBAVCODEC_A52BIN
#ifdef CONFIG_A52BIN
dlclose(s->handle);
#endif
return 0;