From 7bc5f2a8a438568803fdd1dc20efdd7a856f4636 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Mon, 12 Feb 2007 10:05:19 +0000 Subject: [PATCH] Restore the possibility to link liba52 instead of dlopening. Originally committed as revision 7945 to svn://svn.ffmpeg.org/ffmpeg/trunk --- configure | 11 +++++++++-- libavcodec/Makefile | 2 +- libavcodec/a52dec.c | 15 +++++++++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 2ed763ae98..4ef17393d9 100755 --- a/configure +++ b/configure @@ -78,6 +78,7 @@ show_help(){ echo " --enable-x11grab enable X11 grabbing [default=no]" echo " --enable-dc1394 enable IIDC-1394 grabbing using libdc1394" echo " and libraw1394 [default=no]" + echo " --enable-a52 enable GPLed liba52 support [default=no]" echo " --enable-a52bin open liba52.so.0 at runtime [default=no]" echo " --enable-avisynth allow reading AVISynth script files [default=no]" echo " --enable-dts enable GPLed libdts support [default=no]" @@ -486,6 +487,7 @@ CONFIG_LIST=' gpl gprof ipv6 + liba52 liba52bin libdts libfaac @@ -595,7 +597,7 @@ amr_wb_decoder_deps="amr_wb" amr_wb_encoder_deps="amr_wb" dts_decoder_deps="libdts" faac_encoder_deps="libfaac" -liba52_decoder_deps="liba52bin" +liba52_decoder_deps="liba52" libgsm_decoder_deps="libgsm" libgsm_encoder_deps="libgsm" libtheora_encoder_deps="libtheora" @@ -754,6 +756,7 @@ avisynth="no" dc1394="no" dlfcn_h="no" dlopen="no" +liba52="no" liba52bin="no" libdts="no" libfaac="no" @@ -1032,6 +1035,8 @@ for opt do ;; --disable-v4l2) video4linux2="no" ;; + --enable-a52) liba52="yes" + ;; --enable-a52bin) liba52bin="yes" ;; --enable-dts) libdts="yes" @@ -1182,7 +1187,7 @@ if disabled gpl ; then enabled_any $@ && die "$name is under GPL and --enable-gpl is not specified." } die_gpl_disabled "The Postprocessing code" pp - die_gpl_disabled "liba52" liba52bin + die_gpl_disabled "liba52" liba52 die_gpl_disabled "libxvidcore" xvid die_gpl_disabled "x264" x264 die_gpl_disabled "libdts" libdts @@ -1494,6 +1499,7 @@ enabled_all amr_nb amr_nb_fixed && die "Only one of amr_nb and amr_nb_fixed may be enabled." # these are off by default, so fail if requested and not available +enabled liba52 && require liba52 a52dec/a52.h a52_init -la52 enabled libdts && require libdts dts.h dts_init -ldts -lm enabled libgsm && require libgsm gsm.h gsm_create -lgsm enabled libmp3lame && require LAME lame/lame.h lame_init -lmp3lame -lm @@ -1815,6 +1821,7 @@ if enabled sdl_too_old; then fi echo "Sun medialib support $mlib" echo "AVISynth enabled $avisynth" +echo "liba52 support $liba52" echo "liba52 dlopened $liba52bin" echo "libdts support $libdts" echo "libfaac enabled $libfaac" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 5e1d2f3453..4784fcb14b 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -248,7 +248,7 @@ OBJS-$(CONFIG_ADPCM_YAMAHA_DECODER) += adpcm.o OBJS-$(CONFIG_ADPCM_YAMAHA_ENCODER) += adpcm.o # external codec libraries -OBJS-$(CONFIG_LIBA52BIN) += a52dec.o +OBJS-$(CONFIG_LIBA52) += a52dec.o OBJS-$(CONFIG_LIBDTS) += dtsdec.o OBJS-$(CONFIG_LIBFAAC) += faac.o OBJS-$(CONFIG_LIBFAAD) += faad.o diff --git a/libavcodec/a52dec.c b/libavcodec/a52dec.c index 9f3948eb43..96cb67e51a 100644 --- a/libavcodec/a52dec.c +++ b/libavcodec/a52dec.c @@ -26,8 +26,11 @@ #include "avcodec.h" #include + +#ifdef CONFIG_LIBA52BIN #include static const char* liba52name = "liba52.so.0"; +#endif /** * liba52 - Copyright (C) Aaron Holtzman @@ -79,6 +82,7 @@ static int a52_decode_init(AVCodecContext *avctx) { AC3DecodeState *s = avctx->priv_data; +#ifdef CONFIG_LIBA52BIN s->handle = dlopen(liba52name, RTLD_LAZY); if (!s->handle) { @@ -97,6 +101,15 @@ static int a52_decode_init(AVCodecContext *avctx) dlclose(s->handle); return -1; } +#else + s->handle = 0; + s->a52_init = a52_init; + s->a52_samples = a52_samples; + s->a52_syncinfo = a52_syncinfo; + s->a52_frame = a52_frame; + s->a52_block = a52_block; + s->a52_free = a52_free; +#endif s->state = s->a52_init(0); /* later use CPU flags */ s->samples = s->a52_samples(s->state); s->inbuf_ptr = s->inbuf; @@ -226,7 +239,9 @@ static int a52_decode_end(AVCodecContext *avctx) { AC3DecodeState *s = avctx->priv_data; s->a52_free(s->state); +#ifdef CONFIG_LIBA52BIN dlclose(s->handle); +#endif return 0; }