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
445445 [PKG_CHECK_MODULES([FLAC], [flac], [], [using_flac=no])])
446446
447447
448−dnl When enable_dl_amrbw, do not let add libraries to be linked in
449−dnl since they will be dlopen()'ed instead.
450−ac_sox_save_AMRWB_LIBS="$AMRWB_LIBS"
451448 tmp_using_amrwb=no
452449 AC_CHECK_HEADERS(opencore-amrwb/dec_if.h,
453450 [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])])
455452 AC_CHECK_HEADERS(vo-amrwbenc/enc_if.h,
456453 [AC_CHECK_LIB(vo-amrwbenc, E_IF_init,
457− AMRWB_LIBS="$AMRWB_LIBS -lvo-amrwbenc"; tmp_using_amrwb=$opt_default)])
458−AC_ARG_ENABLE(dl_amrwb,
459− AS_HELP_STRING([--enable-dl-amrwb],
460− [Dlopen amrbw instead of linking in.]),
461− enable_dl_amrwb=$enableval, enable_dl_amrwb=no)
462−if test "x$using_libltdl" = "xyes" -a "x$enable_dl_amrwb" = "xyes"; then
463− AC_DEFINE(DL_AMRWB, 1, [Define to dlopen() amrwb.])
464− dnl When enable_dl_amrwb, do not let SOX_PATH_AMRWB add libraries
465− dnl to be linked in (since they will be dlopen()'ed instead).
466− AMRWB_LIBS="$ac_sox_save_AMRWB_LIBS"
467− dnl Force to using regardless if headers or libraries were found.
468− tmp_using_amrwb=yes
454+ [VO_AMRWBENC_LIBS="$VO_AMRWBENC_LIBS -lvo-amrwbenc"; tmp_using_amrwb=$opt_default])])
455+AC_ARG_ENABLE(dl_opencore_amrwb,
456+ AS_HELP_STRING([--enable-dl-opencore-amrwb],
457+ [Dlopen opencore-amrbw instead of linking in.]))
458+AC_ARG_ENABLE(dl_vo_amrwbenc,
459+ AS_HELP_STRING([--enable-dl-vo-amrwbenc],
460+ [Dlopen vo-amrbwenc instead of linking in.]))
461+if test "$using_libltdl" != "yes"; then
462+ enable_dl_opencore_amrwb=no
463+ enable_dl_vo_amrwbenc=no
464+fi
465+if test "$enable_dl_opencore_amrwb" = "yes"; then
466+ AC_DEFINE(DL_OPENCORE_AMRWB, 1, [Define to dlopen() opencore-amrwb.])
467+else
468+ AMRWB_LIBS="$AMRWB_LIBS $OPENCORE_AMRWB_LIBS"
469+fi
470+if test "$enable_dl_vo_amrwbenc" = "yes"; then
471+ AC_DEFINE(DL_VO_AMRWBENC, 1, [Define to dlopen() vo-amrwbenc.])
469472 else
470− enable_dl_amrwb="no"
473+ AMRWB_LIBS="$AMRWB_LIBS $VO_AMRWBENC_LIBS"
471474 fi
472475 AC_OPTIONAL_FORMAT(amrwb, AMRWB, [using_amrwb=$tmp_using_amrwb])
473476
@@ -479,19 +482,18 @@ AC_CHECK_HEADERS(opencore-amrnb/interf_dec.h, · 5 unmodified lines
479482 [AC_CHECK_LIB(opencore-amrnb, Decoder_Interface_init,
480483 AMRNB_LIBS="$AMRNB_LIBS -lopencore-amrnb", tmp_using_amrnb=no)],
481484 [tmp_using_amrnb=no])
482−AC_ARG_ENABLE(dl_amrnb,
483− AS_HELP_STRING([--enable-dl-amrnb],
484− [Dlopen amrnb instead of linking in.]),
485− enable_dl_amrnb=$enableval, enable_dl_amrnb=no)
486−if test "x$using_libltdl" = "xyes" -a "x$enable_dl_amrnb" = "xyes"; then
487− AC_DEFINE(DL_AMRNB, 1, [Define to dlopen() amrnb.])
485+AC_ARG_ENABLE(dl_opencore_amrnb,
486+ AS_HELP_STRING([--enable-dl-opencore-amrnb],
487+ [Dlopen opencore-amrnb instead of linking in.]))
488+if test "$using_libltdl" = "yes" -a "$enable_dl_opencore_amrnb" = "yes"; then
489+ AC_DEFINE(DL_OPENCORE_AMRNB, 1, [Define to dlopen() opencore-amrnb.])
488490 dnl When enable_dl_amrnb, do not let SOX_PATH_AMRNB add libraries
489491 dnl to be linked in (since they will be dlopen()'ed instead).
490492 AMRNB_LIBS="$ac_sox_save_AMRNB_LIBS"
491493 dnl Force to using regardless if headers or libraries were found.
492494 tmp_using_amrnb=yes
493495 else
494− enable_dl_amrnb="no"
496+ enable_dl_opencore_amrnb="no"
495497 fi
496498 AC_OPTIONAL_FORMAT(amrnb, AMRNB, [using_amrnb=$tmp_using_amrnb])
497499
@@ -638,11 +640,12 @@ echo · 140 unmodified lines
638640 echo "OPTIONAL FILE FORMATS"
639641 echo "amrnb......................$using_amrnb"
640642 if test "x$using_amrnb" = "xyes"; then
641−echo " dlopen amrnb..............$enable_dl_amrnb"
643+echo " dlopen amrnb..............${enable_dl_opencore_amrnb:-no}"
642644 fi
643645 echo "amrwb......................$using_amrwb"
644646 if test "x$using_amrwb" = "xyes"; then
645−echo " dlopen amrwb..............$enable_dl_amrwb"
647+echo " dlopen opencore-amrwb.....${enable_dl_opencore_amrwb:-no}"
648+echo " dlopen vo-amrwbenc........${enable_dl_vo_amrwbenc:-no}"
646649 fi
647650 echo "flac.......................$using_flac"
648651 echo "gsm........................$using_gsm"
src/amr-nb.c+2−2
@@ -45,7 +45,7 @@ static char const amrnb_magic[] = "#!AMR\n"; · 44 unmodified lines
4545 #define AMR_RATE 8000
4646 #define AMR_DESC "3GPP Adaptive Multi Rate Narrow-Band (AMR-NB) lossy speech compressor"
4747
48−#ifdef DL_AMRNB
48+#ifdef DL_OPENCORE_AMRNB
4949 #define AMR_FUNC LSX_DLENTRY_DYNAMIC
5050 #else
5151 #define AMR_FUNC LSX_DLENTRY_STATIC
@@ -80,7 +80,7 @@ static char const amrnb_magic[] = "#!AMR\n"; · 28 unmodified lines
8080 #define AMR_OPENCORE_DESC "amr-nb OpenCore library"
8181 static const char* const amr_opencore_library_names[] =
8282 {
83−#ifdef DL_AMRWB
83+#ifdef DL_OPENCORE_AMRNB
8484 "libopencore-amrnb",
8585 "libopencore-amrnb-0",
8686 #endif
src/amr-wb.c+22−16
@@ -43,23 +43,23 @@ static char const amrwb_magic[] = "#!AMR-WB\n"; · 42 unmodified lines
4343 #define AMR_RATE 16000
4444 #define AMR_DESC "3GPP Adaptive Multi Rate Wide-Band (AMR-WB) lossy speech compressor"
4545
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−
5246 /* OpenCore definitions: */
5347
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)
5555 #define AMR_OPENCORE 1
5656 #define AMR_OPENCORE_ENABLE_ENCODE 0
5757 #endif
5858
5959 #define AMR_OPENCORE_FUNC_ENTRIES(f,x) \
60− AMR_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)) \
62− AMR_FUNC(f,x, void, D_IF_exit, (void* state)) \
60+ AMR_OC_FUNC(f,x, void*, D_IF_init, (void)) \
61+ AMR_OC_FUNC(f,x, void, D_IF_decode, (void* state, const unsigned char* in, short* out, int bfi)) \
62+ AMR_OC_FUNC(f,x, void, D_IF_exit, (void* state)) \
6363
6464 #define AmrDecoderInit() \
6565 D_IF_init()
@@ -71,7 +71,7 @@ static char const amrwb_magic[] = "#!AMR-WB\n"; · 5 unmodified lines
7171 #define AMR_OPENCORE_DESC "amr-wb OpenCore library"
7272 static const char* const amr_opencore_library_names[] =
7373 {
74−#ifdef DL_AMRWB
74+#ifdef DL_OPENCORE_AMRWB
7575 "libopencore-amrwb",
7676 "libopencore-amrwb-0",
7777 #endif
@@ -80,14 +80,20 @@ static const char* const amr_opencore_library_names[] = · 2 unmodified lines
8080
8181 /* VO definitions: */
8282
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)
8490 #define AMR_VO 1
8591 #endif
8692
8793 #define AMR_VO_FUNC_ENTRIES(f,x) \
88− AMR_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)) \
90− AMR_FUNC(f,x, void, E_IF_exit, (void* state)) \
94+ AMR_VO_FUNC(f,x, void*, E_IF_init, (void)) \
95+ AMR_VO_FUNC(f,x, int, E_IF_encode,(void* state, int16_t mode, int16_t* in, uint8_t* out, int16_t dtx)) \
96+ AMR_VO_FUNC(f,x, void, E_IF_exit, (void* state)) \
9197
9298 #define AmrEncoderInit() \
9399 E_IF_init()
@@ -99,7 +105,7 @@ static const char* const amr_opencore_library_names[] = · 5 unmodified lines
99105 #define AMR_VO_DESC "amr-wb VisualOn library"
100106 static const char* const amr_vo_library_names[] =
101107 {
102−#ifdef DL_AMRWB
108+#ifdef DL_VO_AMRWBENC
103109 "libvo-amrwbenc",
104110 "libvo-amrwbenc-0",
105111 #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