You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
3.5 KiB

  1. From ffb9b7a6bab6c6bfd3dd9a7c32e3724209824999 Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
  3. Date: Tue, 4 Sep 2018 11:29:37 +0300
  4. Subject: [PATCH] libfdk-aac: Consistently use a proper version check macro for
  5. detecting features
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. The previous version checks checked explicitly for the version
  10. where the version define was added to the installed headers,
  11. making an "#ifdef AACDECODER_LIB_VL0" enough. Now that we have
  12. a need for more diverse version checks than this, convert all checks
  13. to such checks.
  14. Signed-off-by: Martin Storsjö <martin@martin.st>
  15. ---
  16. libavcodec/libfdk-aacdec.c | 13 ++++++++-----
  17. libavcodec/libfdk-aacenc.c | 6 +++---
  18. 2 files changed, 11 insertions(+), 8 deletions(-)
  19. diff --git a/libavcodec/libfdk-aacdec.c b/libavcodec/libfdk-aacdec.c
  20. index 3be65155b5f..c3d3b70fc93 100644
  21. --- a/libavcodec/libfdk-aacdec.c
  22. +++ b/libavcodec/libfdk-aacdec.c
  23. @@ -25,9 +25,12 @@
  24. #include "avcodec.h"
  25. #include "internal.h"
  26. -/* The version macro is introduced the same time as the setting enum was
  27. - * changed, so this check should suffice. */
  28. -#ifndef AACDECODER_LIB_VL0
  29. +#define FDKDEC_VER_AT_LEAST(vl0, vl1) \
  30. + (defined(AACDECODER_LIB_VL0) && \
  31. + ((AACDECODER_LIB_VL0 > vl0) || \
  32. + (AACDECODER_LIB_VL0 == vl0 && AACDECODER_LIB_VL1 >= vl1)))
  33. +
  34. +#if !FDKDEC_VER_AT_LEAST(2, 5) // < 2.5.10
  35. #define AAC_PCM_MAX_OUTPUT_CHANNELS AAC_PCM_OUTPUT_CHANNELS
  36. #endif
  37. @@ -72,7 +75,7 @@ static const AVOption fdk_aac_dec_options[] = {
  38. OFFSET(drc_level), AV_OPT_TYPE_INT, { .i64 = -1}, -1, 127, AD, NULL },
  39. { "drc_heavy", "Dynamic Range Control: heavy compression, where [1] is on (RF mode) and [0] is off",
  40. OFFSET(drc_heavy), AV_OPT_TYPE_INT, { .i64 = -1}, -1, 1, AD, NULL },
  41. -#ifdef AACDECODER_LIB_VL0
  42. +#if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10
  43. { "level_limit", "Signal level limiting", OFFSET(level_limit), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, 1, AD },
  44. #endif
  45. { NULL }
  46. @@ -293,7 +296,7 @@ static av_cold int fdk_aac_decode_init(AVCodecContext *avctx)
  47. }
  48. }
  49. -#ifdef AACDECODER_LIB_VL0
  50. +#if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10
  51. if (aacDecoder_SetParam(s->handle, AAC_PCM_LIMITER_ENABLE, s->level_limit) != AAC_DEC_OK) {
  52. av_log(avctx, AV_LOG_ERROR, "Unable to set in signal level limiting in the decoder\n");
  53. return AVERROR_UNKNOWN;
  54. diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c
  55. index 2ad768ed44e..92ad1762aea 100644
  56. --- a/libavcodec/libfdk-aacenc.c
  57. +++ b/libavcodec/libfdk-aacenc.c
  58. @@ -156,7 +156,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
  59. case 6: mode = MODE_1_2_2_1; sce = 2; cpe = 2; break;
  60. /* The version macro is introduced the same time as the 7.1 support, so this
  61. should suffice. */
  62. -#ifdef AACENCODER_LIB_VL0
  63. +#if FDKENC_VER_AT_LEAST(3, 4) // 3.4.12
  64. case 8:
  65. sce = 2;
  66. cpe = 3;
  67. @@ -291,7 +291,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
  68. }
  69. avctx->frame_size = info.frameLength;
  70. -#if FDKENC_VER_AT_LEAST(4, 0)
  71. +#if FDKENC_VER_AT_LEAST(4, 0) // 4.0.0
  72. avctx->initial_padding = info.nDelay;
  73. #else
  74. avctx->initial_padding = info.encoderDelay;
  75. @@ -412,7 +412,7 @@ static const uint64_t aac_channel_layout[] = {
  76. AV_CH_LAYOUT_4POINT0,
  77. AV_CH_LAYOUT_5POINT0_BACK,
  78. AV_CH_LAYOUT_5POINT1_BACK,
  79. -#ifdef AACENCODER_LIB_VL0
  80. +#if FDKENC_VER_AT_LEAST(3, 4) // 3.4.12
  81. AV_CH_LAYOUT_7POINT1_WIDE_BACK,
  82. AV_CH_LAYOUT_7POINT1,
  83. #endif