History

amr: make dlopen options per library

Mans Rullgard committed 6 years ago

Commit b0460af1 parent 9abe8823 files · +53 −44Browse files

Unified · Split

3 files
  1. configure.ac +29 −26
  2. src/amr-nb.c +2 −2
  3. src/amr-wb.c +22 −16
configure.ac+29−26
@@ -445,29 +445,32 @@ AC_OPTIONAL_FORMAT(flac, FLAC, · 444 unmodified lines
445 [PKG_CHECK_MODULES([FLAC], [flac], [], [using_flac=no])])445 [PKG_CHECK_MODULES([FLAC], [flac], [], [using_flac=no])])
446 446
447 447
448dnl When enable_dl_amrbw, do not let add libraries to be linked in
449dnl since they will be dlopen()'ed instead.
450ac_sox_save_AMRWB_LIBS="$AMRWB_LIBS"
451tmp_using_amrwb=no448tmp_using_amrwb=no
452AC_CHECK_HEADERS(opencore-amrwb/dec_if.h,449AC_CHECK_HEADERS(opencore-amrwb/dec_if.h,
453 [AC_CHECK_LIB(opencore-amrwb, D_IF_init,450 [AC_CHECK_LIB(opencore-amrwb, D_IF_init,
454 [AMRWB_LIBS="$AMRWB_LIBS -lopencore-amrwb"; tmp_using_amrwb=$opt_default])])451 [OPENCORE_AMRWB_LIBS="$OPENCORE_AMRWB_LIBS -lopencore-amrwb"; tmp_using_amrwb=$opt_default])])
455AC_CHECK_HEADERS(vo-amrwbenc/enc_if.h,452AC_CHECK_HEADERS(vo-amrwbenc/enc_if.h,
456 [AC_CHECK_LIB(vo-amrwbenc, E_IF_init,453 [AC_CHECK_LIB(vo-amrwbenc, E_IF_init,
457 AMRWB_LIBS="$AMRWB_LIBS -lvo-amrwbenc"; tmp_using_amrwb=$opt_default)])454 [VO_AMRWBENC_LIBS="$VO_AMRWBENC_LIBS -lvo-amrwbenc"; tmp_using_amrwb=$opt_default])])
458AC_ARG_ENABLE(dl_amrwb,455AC_ARG_ENABLE(dl_opencore_amrwb,
459 AS_HELP_STRING([--enable-dl-amrwb], 456 AS_HELP_STRING([--enable-dl-opencore-amrwb],
460 [Dlopen amrbw instead of linking in.]),457 [Dlopen opencore-amrbw instead of linking in.]))
461 enable_dl_amrwb=$enableval, enable_dl_amrwb=no)458AC_ARG_ENABLE(dl_vo_amrwbenc,
462if test "x$using_libltdl" = "xyes" -a "x$enable_dl_amrwb" = "xyes"; then459 AS_HELP_STRING([--enable-dl-vo-amrwbenc],
463 AC_DEFINE(DL_AMRWB, 1, [Define to dlopen() amrwb.]) 460 [Dlopen vo-amrbwenc instead of linking in.]))
464 dnl When enable_dl_amrwb, do not let SOX_PATH_AMRWB add libraries461if test "$using_libltdl" != "yes"; then
465 dnl to be linked in (since they will be dlopen()'ed instead).462 enable_dl_opencore_amrwb=no
466 AMRWB_LIBS="$ac_sox_save_AMRWB_LIBS"463 enable_dl_vo_amrwbenc=no
467 dnl Force to using regardless if headers or libraries were found.464fi
468 tmp_using_amrwb=yes465if test "$enable_dl_opencore_amrwb" = "yes"; then
466 AC_DEFINE(DL_OPENCORE_AMRWB, 1, [Define to dlopen() opencore-amrwb.])
467else
468 AMRWB_LIBS="$AMRWB_LIBS $OPENCORE_AMRWB_LIBS"
469fi
470if test "$enable_dl_vo_amrwbenc" = "yes"; then
471 AC_DEFINE(DL_VO_AMRWBENC, 1, [Define to dlopen() vo-amrwbenc.])
469else472else
470 enable_dl_amrwb="no"473 AMRWB_LIBS="$AMRWB_LIBS $VO_AMRWBENC_LIBS"
471fi474fi
472AC_OPTIONAL_FORMAT(amrwb, AMRWB, [using_amrwb=$tmp_using_amrwb])475AC_OPTIONAL_FORMAT(amrwb, AMRWB, [using_amrwb=$tmp_using_amrwb])
473 476
@@ -479,19 +482,18 @@ AC_CHECK_HEADERS(opencore-amrnb/interf_dec.h, · 5 unmodified lines
479 [AC_CHECK_LIB(opencore-amrnb, Decoder_Interface_init, 482 [AC_CHECK_LIB(opencore-amrnb, Decoder_Interface_init,
480 AMRNB_LIBS="$AMRNB_LIBS -lopencore-amrnb", tmp_using_amrnb=no)],483 AMRNB_LIBS="$AMRNB_LIBS -lopencore-amrnb", tmp_using_amrnb=no)],
481 [tmp_using_amrnb=no])484 [tmp_using_amrnb=no])
482AC_ARG_ENABLE(dl_amrnb,485AC_ARG_ENABLE(dl_opencore_amrnb,
483 AS_HELP_STRING([--enable-dl-amrnb], 486 AS_HELP_STRING([--enable-dl-opencore-amrnb],
484 [Dlopen amrnb instead of linking in.]),487 [Dlopen opencore-amrnb instead of linking in.]))
485 enable_dl_amrnb=$enableval, enable_dl_amrnb=no)488if test "$using_libltdl" = "yes" -a "$enable_dl_opencore_amrnb" = "yes"; then
486if test "x$using_libltdl" = "xyes" -a "x$enable_dl_amrnb" = "xyes"; then489 AC_DEFINE(DL_OPENCORE_AMRNB, 1, [Define to dlopen() opencore-amrnb.])
487 AC_DEFINE(DL_AMRNB, 1, [Define to dlopen() amrnb.])
488 dnl When enable_dl_amrnb, do not let SOX_PATH_AMRNB add libraries490 dnl When enable_dl_amrnb, do not let SOX_PATH_AMRNB add libraries
489 dnl to be linked in (since they will be dlopen()'ed instead).491 dnl to be linked in (since they will be dlopen()'ed instead).
490 AMRNB_LIBS="$ac_sox_save_AMRNB_LIBS"492 AMRNB_LIBS="$ac_sox_save_AMRNB_LIBS"
491 dnl Force to using regardless if headers or libraries were found.493 dnl Force to using regardless if headers or libraries were found.
492 tmp_using_amrnb=yes494 tmp_using_amrnb=yes
493else495else
494 enable_dl_amrnb="no"496 enable_dl_opencore_amrnb="no"
495fi497fi
496AC_OPTIONAL_FORMAT(amrnb, AMRNB, [using_amrnb=$tmp_using_amrnb])498AC_OPTIONAL_FORMAT(amrnb, AMRNB, [using_amrnb=$tmp_using_amrnb])
497 499
@@ -638,11 +640,12 @@ echo · 140 unmodified lines
638echo "OPTIONAL FILE FORMATS"640echo "OPTIONAL FILE FORMATS"
639echo "amrnb......................$using_amrnb"641echo "amrnb......................$using_amrnb"
640if test "x$using_amrnb" = "xyes"; then642if test "x$using_amrnb" = "xyes"; then
641echo " dlopen amrnb..............$enable_dl_amrnb"643echo " dlopen amrnb..............${enable_dl_opencore_amrnb:-no}"
642fi644fi
643echo "amrwb......................$using_amrwb"645echo "amrwb......................$using_amrwb"
644if test "x$using_amrwb" = "xyes"; then646if test "x$using_amrwb" = "xyes"; then
645echo " dlopen amrwb..............$enable_dl_amrwb"647echo " dlopen opencore-amrwb.....${enable_dl_opencore_amrwb:-no}"
648echo " dlopen vo-amrwbenc........${enable_dl_vo_amrwbenc:-no}"
646fi649fi
647echo "flac.......................$using_flac"650echo "flac.......................$using_flac"
648echo "gsm........................$using_gsm"651echo "gsm........................$using_gsm"
src/amr-nb.c+2−2
@@ -45,7 +45,7 @@ static char const amrnb_magic[] = "#!AMR\n"; · 44 unmodified lines
45#define AMR_RATE 800045#define AMR_RATE 8000
46#define AMR_DESC "3GPP Adaptive Multi Rate Narrow-Band (AMR-NB) lossy speech compressor"46#define AMR_DESC "3GPP Adaptive Multi Rate Narrow-Band (AMR-NB) lossy speech compressor"
47 47
48#ifdef DL_AMRNB48#ifdef DL_OPENCORE_AMRNB
49 #define AMR_FUNC LSX_DLENTRY_DYNAMIC49 #define AMR_FUNC LSX_DLENTRY_DYNAMIC
50#else50#else
51 #define AMR_FUNC LSX_DLENTRY_STATIC51 #define AMR_FUNC LSX_DLENTRY_STATIC
@@ -80,7 +80,7 @@ static char const amrnb_magic[] = "#!AMR\n"; · 28 unmodified lines
80#define AMR_OPENCORE_DESC "amr-nb OpenCore library"80#define AMR_OPENCORE_DESC "amr-nb OpenCore library"
81static const char* const amr_opencore_library_names[] =81static const char* const amr_opencore_library_names[] =
82{82{
83#ifdef DL_AMRWB83#ifdef DL_OPENCORE_AMRNB
84 "libopencore-amrnb",84 "libopencore-amrnb",
85 "libopencore-amrnb-0",85 "libopencore-amrnb-0",
86#endif86#endif
src/amr-wb.c+22−16
@@ -43,23 +43,23 @@ static char const amrwb_magic[] = "#!AMR-WB\n"; · 42 unmodified lines
43#define AMR_RATE 1600043#define AMR_RATE 16000
44#define AMR_DESC "3GPP Adaptive Multi Rate Wide-Band (AMR-WB) lossy speech compressor"44#define AMR_DESC "3GPP Adaptive Multi Rate Wide-Band (AMR-WB) lossy speech compressor"
45 45
46#ifdef DL_AMRWB
47 #define AMR_FUNC LSX_DLENTRY_DYNAMIC
48#else
49 #define AMR_FUNC LSX_DLENTRY_STATIC
50#endif /* DL_AMRWB */
51
52/* OpenCore definitions: */46/* OpenCore definitions: */
53 47
54#if defined(HAVE_OPENCORE_AMRWB_DEC_IF_H) || defined(DL_AMRWB)48#ifdef DL_OPENCORE_AMRWB
49 #define AMR_OC_FUNC LSX_DLENTRY_DYNAMIC
50#else
51 #define AMR_OC_FUNC LSX_DLENTRY_STATIC
52#endif
53
54#if defined(HAVE_OPENCORE_AMRWB_DEC_IF_H) || defined(DL_OPENCORE_AMRWB)
55 #define AMR_OPENCORE 155 #define AMR_OPENCORE 1
56 #define AMR_OPENCORE_ENABLE_ENCODE 056 #define AMR_OPENCORE_ENABLE_ENCODE 0
57#endif57#endif
58 58
59#define AMR_OPENCORE_FUNC_ENTRIES(f,x) \59#define AMR_OPENCORE_FUNC_ENTRIES(f,x) \
60 AMR_FUNC(f,x, void*, D_IF_init, (void)) \60 AMR_OC_FUNC(f,x, void*, D_IF_init, (void)) \
61 AMR_FUNC(f,x, void, D_IF_decode, (void* state, const unsigned char* in, short* out, int bfi)) \61 AMR_OC_FUNC(f,x, void, D_IF_decode, (void* state, const unsigned char* in, short* out, int bfi)) \
62 AMR_FUNC(f,x, void, D_IF_exit, (void* state)) \62 AMR_OC_FUNC(f,x, void, D_IF_exit, (void* state)) \
63 63
64#define AmrDecoderInit() \64#define AmrDecoderInit() \
65 D_IF_init()65 D_IF_init()
@@ -71,7 +71,7 @@ static char const amrwb_magic[] = "#!AMR-WB\n"; · 5 unmodified lines
71#define AMR_OPENCORE_DESC "amr-wb OpenCore library"71#define AMR_OPENCORE_DESC "amr-wb OpenCore library"
72static const char* const amr_opencore_library_names[] =72static const char* const amr_opencore_library_names[] =
73{73{
74#ifdef DL_AMRWB74#ifdef DL_OPENCORE_AMRWB
75 "libopencore-amrwb",75 "libopencore-amrwb",
76 "libopencore-amrwb-0",76 "libopencore-amrwb-0",
77#endif77#endif
@@ -80,14 +80,20 @@ static const char* const amr_opencore_library_names[] = · 2 unmodified lines
80 80
81/* VO definitions: */81/* VO definitions: */
82 82
83#if defined(HAVE_VO_AMRWBENC_ENC_IF_H) || defined(DL_AMRWB)83#ifdef DL_VO_AMRWBENC
84 #define AMR_VO_FUNC LSX_DLENTRY_DYNAMIC
85#else
86 #define AMR_VO_FUNC LSX_DLENTRY_STATIC
87#endif
88
89#if defined(HAVE_VO_AMRWBENC_ENC_IF_H) || defined(DL_VO_AMRWBENC)
84 #define AMR_VO 190 #define AMR_VO 1
85#endif91#endif
86 92
87#define AMR_VO_FUNC_ENTRIES(f,x) \93#define AMR_VO_FUNC_ENTRIES(f,x) \
88 AMR_FUNC(f,x, void*, E_IF_init, (void)) \94 AMR_VO_FUNC(f,x, void*, E_IF_init, (void)) \
89 AMR_FUNC(f,x, int, E_IF_encode,(void* state, int16_t mode, int16_t* in, uint8_t* out, int16_t dtx)) \95 AMR_VO_FUNC(f,x, int, E_IF_encode,(void* state, int16_t mode, int16_t* in, uint8_t* out, int16_t dtx)) \
90 AMR_FUNC(f,x, void, E_IF_exit, (void* state)) \96 AMR_VO_FUNC(f,x, void, E_IF_exit, (void* state)) \
91 97
92#define AmrEncoderInit() \98#define AmrEncoderInit() \
93 E_IF_init()99 E_IF_init()
@@ -99,7 +105,7 @@ static const char* const amr_opencore_library_names[] = · 5 unmodified lines
99#define AMR_VO_DESC "amr-wb VisualOn library"105#define AMR_VO_DESC "amr-wb VisualOn library"
100static const char* const amr_vo_library_names[] =106static const char* const amr_vo_library_names[] =
101{107{
102#ifdef DL_AMRWB108#ifdef DL_VO_AMRWBENC
103 "libvo-amrwbenc",109 "libvo-amrwbenc",
104 "libvo-amrwbenc-0",110 "libvo-amrwbenc-0",
105#endif111#endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t