Browse Source

* using liba52

Originally committed as revision 417 to svn://svn.ffmpeg.org/ffmpeg/trunk
tags/v0.5
Zdenek Kabelac 23 years ago
parent
commit
5751432312
4 changed files with 57 additions and 30 deletions
  1. +12
    -0
      Makefile
  2. +30
    -18
      configure
  3. +11
    -7
      libavcodec/Makefile
  4. +4
    -5
      libavcodec/a52dec.c

+ 12
- 0
Makefile View File

@@ -29,6 +29,9 @@ EXTRALIBS+=-lmp3lame
endif endif
endif endif


OBJS = ffmpeg.o ffserver.o
SRCS = $(OBJS:.o=.c) $(ASM_OBJS:.o=.s)

all: lib $(PROG) all: lib $(PROG)


lib: lib:
@@ -52,6 +55,11 @@ install: all
install -s -m 755 $(PROG) $(prefix)/bin install -s -m 755 $(PROG) $(prefix)/bin
ln -sf ffmpeg $(prefix)/bin/ffplay ln -sf ffmpeg $(prefix)/bin/ffplay


dep: depend

depend:
$(CC) -MM $(CFLAGS) $(SRCS) 1>.depend

clean: clean:
$(MAKE) -C libavcodec clean $(MAKE) -C libavcodec clean
$(MAKE) -C libav clean $(MAKE) -C libav clean
@@ -63,3 +71,7 @@ distclean: clean


TAGS: TAGS:
etags *.[ch] libav/*.[ch] libavcodec/*.[ch] etags *.[ch] libav/*.[ch] libavcodec/*.[ch]

ifneq ($(wildcard .depend),)
include .depend
endif

+ 30
- 18
configure View File

@@ -5,13 +5,13 @@ TMPO="ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
TMPS="ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S" TMPS="ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
TMPH="ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h" TMPH="ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"


if [ ! -z "$TMPDIR" ]; then
if test ! -z "$TMPDIR" ; then
TMPC="${TMPDIR}/${TMPC}" TMPC="${TMPDIR}/${TMPC}"
TMPCPP="${TMPDIR}/${TMPCPP}" TMPCPP="${TMPDIR}/${TMPCPP}"
TMPO="${TMPDIR}/${TMPO}" TMPO="${TMPDIR}/${TMPO}"
TMPS="${TMPDIR}/${TMPS}" TMPS="${TMPDIR}/${TMPS}"
TMPH="${TMPDIR}/${TMPH}" TMPH="${TMPDIR}/${TMPH}"
elif [ ! -z "$TEMPDIR" ]; then
elif test ! -z "$TEMPDIR" ; then
TMPC="${TEMPDIR}/${TMPC}" TMPC="${TEMPDIR}/${TMPC}"
TMPCPP="${TEMPDIR}/${TMPCPP}" TMPCPP="${TEMPDIR}/${TMPCPP}"
TMPO="${TEMPDIR}/${TMPO}" TMPO="${TEMPDIR}/${TMPO}"
@@ -50,6 +50,7 @@ esac
gprof="no" gprof="no"
grab="yes" grab="yes"
mp3lame="no" mp3lame="no"
a52bin="no"
win32="no" win32="no"
extralibs="-lm" extralibs="-lm"


@@ -72,7 +73,7 @@ fi ;;
*) ;; *) ;;
esac esac


if [ "$1" = "-h" -o "$1" = "--help" ] ; then
if test "$1" = "-h" -o "$1" = "--help" ; then
cat << EOF cat << EOF


Usage: configure [options] Usage: configure [options]
@@ -86,9 +87,10 @@ echo " --cpu=CPU force cpu to CPU [$cpu]"
echo " --disable-mmx disable mmx usage" echo " --disable-mmx disable mmx usage"
echo " --enable-gprof enable profiling with gprof [$gprof]" echo " --enable-gprof enable profiling with gprof [$gprof]"
echo " --disable-grab disable audio/video grabbing code" 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-win32 enable win32 cross compile"
echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
echo " --enable-shared build shared libraries [default=no]" echo " --enable-shared build shared libraries [default=no]"
exit 1 exit 1
fi fi
@@ -108,6 +110,8 @@ for opt do
;; ;;
--disable-grab) grab="no" --disable-grab) grab="no"
;; ;;
--enable-a52bin) a52bin="yes" ; extralibs="-ldl $extralibs"
;;
--enable-mp3lame) mp3lame="yes" --enable-mp3lame) mp3lame="yes"
;; ;;
--enable-simple_idct) simpleidct="yes" --enable-simple_idct) simpleidct="yes"
@@ -124,7 +128,7 @@ if test -z "$CFLAGS"; then
CFLAGS="-O2" CFLAGS="-O2"
fi fi


if [ "$win32" = "yes" ] ; then
if test "$win32" = "yes" ; then
cross_prefix="i386-mingw32msvc-" cross_prefix="i386-mingw32msvc-"
cc="${cross_prefix}gcc" cc="${cross_prefix}gcc"
ar="${cross_prefix}ar" ar="${cross_prefix}ar"
@@ -163,6 +167,7 @@ echo "MMX enabled $mmx"
echo "gprof enabled $gprof" echo "gprof enabled $gprof"
echo "grab enabled $grab" echo "grab enabled $grab"
echo "mp3lame enabled $mp3lame" echo "mp3lame enabled $mp3lame"
echo "a52 dlopened $a52bin"


echo "Creating config.mak and config.h" echo "Creating config.mak and config.h"


@@ -174,27 +179,27 @@ echo "MAKE=make" >> config.mak
echo "CC=$cc" >> config.mak echo "CC=$cc" >> config.mak
echo "AR=$ar" >> config.mak echo "AR=$ar" >> config.mak
echo "OPTFLAGS=$CFLAGS" >> config.mak echo "OPTFLAGS=$CFLAGS" >> config.mak
if [ "$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
fi fi
if [ "$cpu" = "armv4l" ]; then
if test "$cpu" = "armv4l" ; then
echo "TARGET_ARCH_ARMV4L=yes" >> config.mak echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
echo "#define ARCH_ARMV4L 1" >> $TMPH echo "#define ARCH_ARMV4L 1" >> $TMPH
fi fi
if [ "$cpu" = "alpha" ]; then
if test "$cpu" = "alpha" ; then
echo "TARGET_ARCH_ALPHA=yes" >> config.mak echo "TARGET_ARCH_ALPHA=yes" >> config.mak
echo "#define ARCH_ALPHA 1" >> $TMPH echo "#define ARCH_ALPHA 1" >> $TMPH
fi fi
if [ "$mmx" = "yes" ] ; then
if test "$mmx" = "yes" ; then
echo "TARGET_MMX=yes" >> config.mak echo "TARGET_MMX=yes" >> config.mak
echo "#define HAVE_MMX 1" >> $TMPH echo "#define HAVE_MMX 1" >> $TMPH
fi fi
if [ "$gprof" = "yes" ] ; then
if test "$gprof" = "yes" ; then
echo "TARGET_GPROF=yes" >> config.mak echo "TARGET_GPROF=yes" >> config.mak
echo "#define HAVE_GPROF 1" >> $TMPH echo "#define HAVE_GPROF 1" >> $TMPH
fi fi
if [ "$lshared" = "yes" ] ; then
if test "$lshared" = "yes" ; then
echo "BUILD_SHARED=yes" >> config.mak echo "BUILD_SHARED=yes" >> config.mak
else else
echo "BUILD_SHARED=no" >> config.mak echo "BUILD_SHARED=no" >> config.mak
@@ -216,34 +221,41 @@ echo "CONFIG_DECODERS=yes" >> config.mak
echo "#define CONFIG_AC3 1" >> $TMPH echo "#define CONFIG_AC3 1" >> $TMPH
echo "CONFIG_AC3=yes" >> config.mak 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 "#define CONFIG_GRAB 1" >> $TMPH
echo "CONFIG_GRAB=yes" >> config.mak echo "CONFIG_GRAB=yes" >> config.mak
fi fi


if [ "$mp3lame" = "yes" ] ; then
if test "$mp3lame" = "yes" ; then
echo "#define CONFIG_MP3LAME 1" >> $TMPH echo "#define CONFIG_MP3LAME 1" >> $TMPH
echo "CONFIG_MP3LAME=yes" >> config.mak echo "CONFIG_MP3LAME=yes" >> config.mak
fi fi


if [ "$win32" = "yes" ] ; then
if test "$win32" = "yes" ; then
echo "#define CONFIG_WIN32 1" >> $TMPH echo "#define CONFIG_WIN32 1" >> $TMPH
echo "CONFIG_WIN32=yes" >> config.mak echo "CONFIG_WIN32=yes" >> config.mak
fi fi


if [ "$_malloc_h" = "yes" ]; then
if test "$_malloc_h" = "yes" ; then
echo "#define HAVE_MALLOC_H 1" >> $TMPH echo "#define HAVE_MALLOC_H 1" >> $TMPH
else else
echo "#undef HAVE_MALLOC_H" >> $TMPH echo "#undef HAVE_MALLOC_H" >> $TMPH
fi fi


if [ "$_memalign" = "yes" ]; then
if test "$_memalign" = "yes" ; then
echo "#define HAVE_MEMALIGN 1" >> $TMPH echo "#define HAVE_MEMALIGN 1" >> $TMPH
else else
echo "#undef HAVE_MEMALIGN" >> $TMPH echo "#undef HAVE_MEMALIGN" >> $TMPH
fi fi


if [ "$simpleidct" = "yes" ]; then
if test "$simpleidct" = "yes" ; then
echo "#define SIMPLE_IDCT 1" >> $TMPH echo "#define SIMPLE_IDCT 1" >> $TMPH
fi fi




+ 11
- 7
libavcodec/Makefile View File

@@ -10,11 +10,15 @@ OBJS= common.o utils.o mpegvideo.o h263.o jrevdct.o jfdctfst.o \
ratecontrol.o ratecontrol.o
ASM_OBJS= ASM_OBJS=


# currently using libac3 for ac3 decoding
# currently using liba52 for ac3 decoding
ifeq ($(CONFIG_AC3),yes) 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 endif


ifeq ($(CONFIG_MP3LAME),yes) ifeq ($(CONFIG_MP3LAME),yes)
@@ -30,7 +34,7 @@ endif
ifeq ($(TARGET_MMX),yes) ifeq ($(TARGET_MMX),yes)
OBJS += i386/fdct_mmx.o i386/cputest.o \ OBJS += i386/fdct_mmx.o i386/cputest.o \
i386/dsputil_mmx.o i386/mpegvideo_mmx.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 i386/simple_idct_mmx.o
endif endif


@@ -91,8 +95,8 @@ clean:
armv4l/*.o armv4l/*~ \ armv4l/*.o armv4l/*~ \
mlib/*.o mlib/*~ \ mlib/*.o mlib/*~ \
alpha/*.o alpha/*~ \ alpha/*.o alpha/*~ \
libac3/*.o libac3/*~ \
apiexample $(TESTS)
liba52/*.o liba52/*~ \
apiexample $(TESTS)


distclean: clean distclean: clean
rm -f Makefile.bak .depend rm -f Makefile.bak .depend


+ 4
- 5
libavcodec/a52dec.c View File

@@ -19,7 +19,7 @@
#include "avcodec.h" #include "avcodec.h"
#include "liba52/a52.h" #include "liba52/a52.h"


#ifdef LIBAVCODEC_A52BIN
#ifdef CONFIG_A52BIN
#include <dlfcn.h> #include <dlfcn.h>
static const char* liba52name = "liba52.so.0"; static const char* liba52name = "liba52.so.0";
#endif #endif
@@ -62,7 +62,7 @@ typedef struct AC3DecodeState {


} AC3DecodeState; } AC3DecodeState;


#ifdef LIBAVCODEC_A52BIN
#ifdef CONFIG_A52BIN
static void* dlsymm(void* handle, const char* symbol) static void* dlsymm(void* handle, const char* symbol)
{ {
void* f = dlsym(handle, symbol); void* f = dlsym(handle, symbol);
@@ -76,7 +76,7 @@ static int a52_decode_init(AVCodecContext *avctx)
{ {
AC3DecodeState *s = avctx->priv_data; AC3DecodeState *s = avctx->priv_data;


#ifdef LIBAVCODEC_A52BIN
#ifdef CONFIG_A52BIN
s->handle = dlopen(liba52name, RTLD_LAZY); s->handle = dlopen(liba52name, RTLD_LAZY);
if (!s->handle) if (!s->handle)
{ {
@@ -95,7 +95,6 @@ static int a52_decode_init(AVCodecContext *avctx)
dlclose(s->handle); dlclose(s->handle);
return -1; return -1;
} }
printf("INITIALIZED\n");
#else #else
/* static linked version */ /* static linked version */
s->handle = 0; s->handle = 0;
@@ -233,7 +232,7 @@ static int a52_decode_end(AVCodecContext *avctx)
{ {
AC3DecodeState *s = avctx->priv_data; AC3DecodeState *s = avctx->priv_data;
s->a52_free(s->state); s->a52_free(s->state);
#ifdef LIBAVCODEC_A52BIN
#ifdef CONFIG_A52BIN
dlclose(s->handle); dlclose(s->handle);
#endif #endif
return 0; return 0;


Loading…
Cancel
Save