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.

63 lines
2.2 KiB

  1. From 2a9e1c122eed66be1b26b747342b848300b226c7 Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
  3. Date: Wed, 12 Sep 2018 23:03:12 +0300
  4. Subject: [PATCH] libfdk-aac: Don't use defined() in a #define
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. MSVC expands the preprocessor directives differently, making the
  9. version check fail in the previous form.
  10. Clang can warn about this with -Wexpansion-to-defined (not currently
  11. enabled by default):
  12. warning: macro expansion producing 'defined' has undefined behavior [-Wexpansion-to-defined]
  13. Signed-off-by: Martin Storsjö <martin@martin.st>
  14. ---
  15. libavcodec/libfdk-aacdec.c | 9 ++++++---
  16. libavcodec/libfdk-aacenc.c | 9 ++++++---
  17. 2 files changed, 12 insertions(+), 6 deletions(-)
  18. diff --git a/libavcodec/libfdk-aacdec.c b/libavcodec/libfdk-aacdec.c
  19. index ca70a49ad46..63856232d9e 100644
  20. --- a/libavcodec/libfdk-aacdec.c
  21. +++ b/libavcodec/libfdk-aacdec.c
  22. @@ -25,10 +25,13 @@
  23. #include "avcodec.h"
  24. #include "internal.h"
  25. +#ifdef AACDECODER_LIB_VL0
  26. #define FDKDEC_VER_AT_LEAST(vl0, vl1) \
  27. - (defined(AACDECODER_LIB_VL0) && \
  28. - ((AACDECODER_LIB_VL0 > vl0) || \
  29. - (AACDECODER_LIB_VL0 == vl0 && AACDECODER_LIB_VL1 >= vl1)))
  30. + ((AACDECODER_LIB_VL0 > vl0) || \
  31. + (AACDECODER_LIB_VL0 == vl0 && AACDECODER_LIB_VL1 >= vl1))
  32. +#else
  33. +#define FDKDEC_VER_AT_LEAST(vl0, vl1) 0
  34. +#endif
  35. #if !FDKDEC_VER_AT_LEAST(2, 5) // < 2.5.10
  36. #define AAC_PCM_MAX_OUTPUT_CHANNELS AAC_PCM_OUTPUT_CHANNELS
  37. diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c
  38. index f71a276403e..3b492ef8f48 100644
  39. --- a/libavcodec/libfdk-aacenc.c
  40. +++ b/libavcodec/libfdk-aacenc.c
  41. @@ -26,10 +26,13 @@
  42. #include "audio_frame_queue.h"
  43. #include "internal.h"
  44. +#ifdef AACENCODER_LIB_VL0
  45. #define FDKENC_VER_AT_LEAST(vl0, vl1) \
  46. - (defined(AACENCODER_LIB_VL0) && \
  47. - ((AACENCODER_LIB_VL0 > vl0) || \
  48. - (AACENCODER_LIB_VL0 == vl0 && AACENCODER_LIB_VL1 >= vl1)))
  49. + ((AACENCODER_LIB_VL0 > vl0) || \
  50. + (AACENCODER_LIB_VL0 == vl0 && AACENCODER_LIB_VL1 >= vl1))
  51. +#else
  52. +#define FDKENC_VER_AT_LEAST(vl0, vl1) 0
  53. +#endif
  54. typedef struct AACContext {
  55. const AVClass *class;