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.

316 lines
12 KiB

  1. From 9969fbafe2c83aee196c115acdaafbb623727927 Mon Sep 17 00:00:00 2001
  2. From: Bernd Kuhls <bernd.kuhls@t-online.de>
  3. Date: Mon, 28 Jan 2019 21:55:19 +0100
  4. Subject: package/ffmpeg: fix build with libfdk-aac 2.0.0
  5. Add upstream patches to fix
  6. http://autobuild.buildroot.net/results/909/9097a2b190f4032ff51eda531f4379a99da5181a/
  7. after fdk-aac was bumped to 2.0.0:
  8. https://git.buildroot.net/buildroot/commit/package/fdk-aac?id=31ff32824a4f3d09351367c3418b5605f9c40521
  9. Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
  10. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
  11. ---
  12. ...dk-aacenc-Fix-building-with-libfdk-aac-v2.patch | 100 +++++++++++++++++++++
  13. ...Consistently-use-a-proper-version-check-m.patch | 99 ++++++++++++++++++++
  14. ...-libfdk-aac-Don-t-use-defined-in-a-define.patch | 72 +++++++++++++++
  15. 3 files changed, 271 insertions(+)
  16. create mode 100644 package/ffmpeg/0002-libfdk-aacenc-Fix-building-with-libfdk-aac-v2.patch
  17. create mode 100644 package/ffmpeg/0003-libfdk-aac-Consistently-use-a-proper-version-check-m.patch
  18. create mode 100644 package/ffmpeg/0004-libfdk-aac-Don-t-use-defined-in-a-define.patch
  19. (limited to 'package')
  20. diff --git a/package/ffmpeg/0002-libfdk-aacenc-Fix-building-with-libfdk-aac-v2.patch b/package/ffmpeg/0002-libfdk-aacenc-Fix-building-with-libfdk-aac-v2.patch
  21. new file mode 100644
  22. index 0000000000..3f452242fa
  23. --- /dev/null
  24. +++ b/package/ffmpeg/0002-libfdk-aacenc-Fix-building-with-libfdk-aac-v2.patch
  25. @@ -0,0 +1,100 @@
  26. +From c60fb550302878aba7e86037451f7996e8069289 Mon Sep 17 00:00:00 2001
  27. +From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
  28. +Date: Fri, 31 Aug 2018 14:25:30 +0300
  29. +Subject: [PATCH] libfdk-aacenc: Fix building with libfdk-aac v2
  30. +MIME-Version: 1.0
  31. +Content-Type: text/plain; charset=UTF-8
  32. +Content-Transfer-Encoding: 8bit
  33. +
  34. +When flushing the encoder, we now need to provide non-null buffer
  35. +parameters for everything, even if they are unused.
  36. +
  37. +The encoderDelay parameter has been replaced by two, nDelay and
  38. +nDelayCore.
  39. +
  40. +Downloaded from
  41. +http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=141c960e21d2860e354f9b90df136184dd00a9a8
  42. +
  43. +Signed-off-by: Martin Storsjö <martin@martin.st>
  44. +[Bernd: rebased for ffmpeg 3.4.5]
  45. +Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
  46. +---
  47. + libavcodec/libfdk-aacenc.c | 34 +++++++++++++++++++++++++---------
  48. + 1 file changed, 25 insertions(+), 9 deletions(-)
  49. +
  50. +diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c
  51. +index 0e2051b468..f5adb407ed 100644
  52. +--- a/libavcodec/libfdk-aacenc.c
  53. ++++ b/libavcodec/libfdk-aacenc.c
  54. +@@ -26,6 +26,11 @@
  55. + #include "audio_frame_queue.h"
  56. + #include "internal.h"
  57. +
  58. ++#define FDKENC_VER_AT_LEAST(vl0, vl1) \
  59. ++ (defined(AACENCODER_LIB_VL0) && \
  60. ++ ((AACENCODER_LIB_VL0 > vl0) || \
  61. ++ (AACENCODER_LIB_VL0 == vl0 && AACENCODER_LIB_VL1 >= vl1)))
  62. ++
  63. + typedef struct AACContext {
  64. + const AVClass *class;
  65. + HANDLE_AACENCODER handle;
  66. +@@ -286,7 +291,11 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
  67. + }
  68. +
  69. + avctx->frame_size = info.frameLength;
  70. ++#if FDKENC_VER_AT_LEAST(4, 0)
  71. ++ avctx->initial_padding = info.nDelay;
  72. ++#else
  73. + avctx->initial_padding = info.encoderDelay;
  74. ++#endif
  75. + ff_af_queue_init(avctx, &s->afq);
  76. +
  77. + if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
  78. +@@ -319,28 +328,35 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
  79. + int out_buffer_size, out_buffer_element_size;
  80. + void *in_ptr, *out_ptr;
  81. + int ret;
  82. ++ uint8_t dummy_buf[1];
  83. + AACENC_ERROR err;
  84. +
  85. + /* handle end-of-stream small frame and flushing */
  86. + if (!frame) {
  87. ++ /* Must be a non-null pointer, even if it's a dummy. We could use
  88. ++ * the address of anything else on the stack as well. */
  89. ++ in_ptr = dummy_buf;
  90. ++ in_buffer_size = 0;
  91. ++
  92. + in_args.numInSamples = -1;
  93. + } else {
  94. +- in_ptr = frame->data[0];
  95. +- in_buffer_size = 2 * avctx->channels * frame->nb_samples;
  96. +- in_buffer_element_size = 2;
  97. ++ in_ptr = frame->data[0];
  98. ++ in_buffer_size = 2 * avctx->channels * frame->nb_samples;
  99. +
  100. +- in_args.numInSamples = avctx->channels * frame->nb_samples;
  101. +- in_buf.numBufs = 1;
  102. +- in_buf.bufs = &in_ptr;
  103. +- in_buf.bufferIdentifiers = &in_buffer_identifier;
  104. +- in_buf.bufSizes = &in_buffer_size;
  105. +- in_buf.bufElSizes = &in_buffer_element_size;
  106. ++ in_args.numInSamples = avctx->channels * frame->nb_samples;
  107. +
  108. + /* add current frame to the queue */
  109. + if ((ret = ff_af_queue_add(&s->afq, frame)) < 0)
  110. + return ret;
  111. + }
  112. +
  113. ++ in_buffer_element_size = 2;
  114. ++ in_buf.numBufs = 1;
  115. ++ in_buf.bufs = &in_ptr;
  116. ++ in_buf.bufferIdentifiers = &in_buffer_identifier;
  117. ++ in_buf.bufSizes = &in_buffer_size;
  118. ++ in_buf.bufElSizes = &in_buffer_element_size;
  119. ++
  120. + /* The maximum packet size is 6144 bits aka 768 bytes per channel. */
  121. + if ((ret = ff_alloc_packet2(avctx, avpkt, FFMAX(8192, 768 * avctx->channels), 0)) < 0)
  122. + return ret;
  123. +--
  124. +2.20.1
  125. +
  126. diff --git a/package/ffmpeg/0003-libfdk-aac-Consistently-use-a-proper-version-check-m.patch b/package/ffmpeg/0003-libfdk-aac-Consistently-use-a-proper-version-check-m.patch
  127. new file mode 100644
  128. index 0000000000..c358a045d1
  129. --- /dev/null
  130. +++ b/package/ffmpeg/0003-libfdk-aac-Consistently-use-a-proper-version-check-m.patch
  131. @@ -0,0 +1,99 @@
  132. +From 48be4c81e0ad081edab65e133e6e1bdec7de3b55 Mon Sep 17 00:00:00 2001
  133. +From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
  134. +Date: Tue, 4 Sep 2018 08:29:37 +0300
  135. +Subject: [PATCH] libfdk-aac: Consistently use a proper version check macro for
  136. + detecting features
  137. +MIME-Version: 1.0
  138. +Content-Type: text/plain; charset=UTF-8
  139. +Content-Transfer-Encoding: 8bit
  140. +
  141. +libfdk-aac: Consistently use a proper version check macro for detecting features
  142. +
  143. +The previous version checks checked explicitly for the version
  144. +where the version define was added to the installed headers,
  145. +making an "#ifdef AACDECODER_LIB_VL0" enough. Now that we have
  146. +a need for more diverse version checks than this, convert all checks
  147. +to such checks.
  148. +
  149. +Downloaded from
  150. +http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=ffb9b7a6bab6c6bfd3dd9a7c32e3724209824999
  151. +
  152. +Signed-off-by: Martin Storsjö <martin@martin.st>
  153. +Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
  154. +---
  155. + libavcodec/libfdk-aacdec.c | 13 ++++++++-----
  156. + libavcodec/libfdk-aacenc.c | 6 +++---
  157. + 2 files changed, 11 insertions(+), 8 deletions(-)
  158. +
  159. +diff --git a/libavcodec/libfdk-aacdec.c b/libavcodec/libfdk-aacdec.c
  160. +index 2857b9453f..ef51184ebd 100644
  161. +--- a/libavcodec/libfdk-aacdec.c
  162. ++++ b/libavcodec/libfdk-aacdec.c
  163. +@@ -25,9 +25,12 @@
  164. + #include "avcodec.h"
  165. + #include "internal.h"
  166. +
  167. +-/* The version macro is introduced the same time as the setting enum was
  168. +- * changed, so this check should suffice. */
  169. +-#ifndef AACDECODER_LIB_VL0
  170. ++#define FDKDEC_VER_AT_LEAST(vl0, vl1) \
  171. ++ (defined(AACDECODER_LIB_VL0) && \
  172. ++ ((AACDECODER_LIB_VL0 > vl0) || \
  173. ++ (AACDECODER_LIB_VL0 == vl0 && AACDECODER_LIB_VL1 >= vl1)))
  174. ++
  175. ++#if !FDKDEC_VER_AT_LEAST(2, 5) // < 2.5.10
  176. + #define AAC_PCM_MAX_OUTPUT_CHANNELS AAC_PCM_OUTPUT_CHANNELS
  177. + #endif
  178. +
  179. +@@ -72,7 +75,7 @@ static const AVOption fdk_aac_dec_options[] = {
  180. + OFFSET(drc_level), AV_OPT_TYPE_INT, { .i64 = -1}, -1, 127, AD, NULL },
  181. + { "drc_heavy", "Dynamic Range Control: heavy compression, where [1] is on (RF mode) and [0] is off",
  182. + OFFSET(drc_heavy), AV_OPT_TYPE_INT, { .i64 = -1}, -1, 1, AD, NULL },
  183. +-#ifdef AACDECODER_LIB_VL0
  184. ++#if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10
  185. + { "level_limit", "Signal level limiting", OFFSET(level_limit), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, 1, AD },
  186. + #endif
  187. + { NULL }
  188. +@@ -293,7 +296,7 @@ static av_cold int fdk_aac_decode_init(AVCodecContext *avctx)
  189. + }
  190. + }
  191. +
  192. +-#ifdef AACDECODER_LIB_VL0
  193. ++#if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10
  194. + if (aacDecoder_SetParam(s->handle, AAC_PCM_LIMITER_ENABLE, s->level_limit) != AAC_DEC_OK) {
  195. + av_log(avctx, AV_LOG_ERROR, "Unable to set in signal level limiting in the decoder\n");
  196. + return AVERROR_UNKNOWN;
  197. +diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c
  198. +index f5adb407ed..91dcb5a1b9 100644
  199. +--- a/libavcodec/libfdk-aacenc.c
  200. ++++ b/libavcodec/libfdk-aacenc.c
  201. +@@ -156,7 +156,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
  202. + case 6: mode = MODE_1_2_2_1; sce = 2; cpe = 2; break;
  203. + /* The version macro is introduced the same time as the 7.1 support, so this
  204. + should suffice. */
  205. +-#ifdef AACENCODER_LIB_VL0
  206. ++#if FDKENC_VER_AT_LEAST(3, 4) // 3.4.12
  207. + case 8:
  208. + sce = 2;
  209. + cpe = 3;
  210. +@@ -291,7 +291,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
  211. + }
  212. +
  213. + avctx->frame_size = info.frameLength;
  214. +-#if FDKENC_VER_AT_LEAST(4, 0)
  215. ++#if FDKENC_VER_AT_LEAST(4, 0) // 4.0.0
  216. + avctx->initial_padding = info.nDelay;
  217. + #else
  218. + avctx->initial_padding = info.encoderDelay;
  219. +@@ -412,7 +412,7 @@ static const uint64_t aac_channel_layout[] = {
  220. + AV_CH_LAYOUT_4POINT0,
  221. + AV_CH_LAYOUT_5POINT0_BACK,
  222. + AV_CH_LAYOUT_5POINT1_BACK,
  223. +-#ifdef AACENCODER_LIB_VL0
  224. ++#if FDKENC_VER_AT_LEAST(3, 4) // 3.4.12
  225. + AV_CH_LAYOUT_7POINT1_WIDE_BACK,
  226. + AV_CH_LAYOUT_7POINT1,
  227. + #endif
  228. +--
  229. +2.20.1
  230. +
  231. diff --git a/package/ffmpeg/0004-libfdk-aac-Don-t-use-defined-in-a-define.patch b/package/ffmpeg/0004-libfdk-aac-Don-t-use-defined-in-a-define.patch
  232. new file mode 100644
  233. index 0000000000..30357b91e1
  234. --- /dev/null
  235. +++ b/package/ffmpeg/0004-libfdk-aac-Don-t-use-defined-in-a-define.patch
  236. @@ -0,0 +1,72 @@
  237. +From 452746d80fdaaaf1b546860eb78449c6de3678d7 Mon Sep 17 00:00:00 2001
  238. +From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
  239. +Date: Wed, 12 Sep 2018 20:03:12 +0300
  240. +Subject: [PATCH] libfdk-aac: Don't use defined() in a #define
  241. +MIME-Version: 1.0
  242. +Content-Type: text/plain; charset=UTF-8
  243. +Content-Transfer-Encoding: 8bit
  244. +
  245. +libfdk-aac: Don't use defined() in a #define
  246. +
  247. +MSVC expands the preprocessor directives differently, making the
  248. +version check fail in the previous form.
  249. +
  250. +Clang can warn about this with -Wexpansion-to-defined (not currently
  251. +enabled by default):
  252. +warning: macro expansion producing 'defined' has undefined behavior [-Wexpansion-to-defined]
  253. +
  254. +Downloaded from
  255. +http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=2a9e1c122eed66be1b26b747342b848300b226c7
  256. +
  257. +Signed-off-by: Martin Storsjö <martin@martin.st>
  258. +Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
  259. +---
  260. + libavcodec/libfdk-aacdec.c | 9 ++++++---
  261. + libavcodec/libfdk-aacenc.c | 9 ++++++---
  262. + 2 files changed, 12 insertions(+), 6 deletions(-)
  263. +
  264. +diff --git a/libavcodec/libfdk-aacdec.c b/libavcodec/libfdk-aacdec.c
  265. +index ef51184ebd..0fbab36463 100644
  266. +--- a/libavcodec/libfdk-aacdec.c
  267. ++++ b/libavcodec/libfdk-aacdec.c
  268. +@@ -25,10 +25,13 @@
  269. + #include "avcodec.h"
  270. + #include "internal.h"
  271. +
  272. ++#ifdef AACDECODER_LIB_VL0
  273. + #define FDKDEC_VER_AT_LEAST(vl0, vl1) \
  274. +- (defined(AACDECODER_LIB_VL0) && \
  275. +- ((AACDECODER_LIB_VL0 > vl0) || \
  276. +- (AACDECODER_LIB_VL0 == vl0 && AACDECODER_LIB_VL1 >= vl1)))
  277. ++ ((AACDECODER_LIB_VL0 > vl0) || \
  278. ++ (AACDECODER_LIB_VL0 == vl0 && AACDECODER_LIB_VL1 >= vl1))
  279. ++#else
  280. ++#define FDKDEC_VER_AT_LEAST(vl0, vl1) 0
  281. ++#endif
  282. +
  283. + #if !FDKDEC_VER_AT_LEAST(2, 5) // < 2.5.10
  284. + #define AAC_PCM_MAX_OUTPUT_CHANNELS AAC_PCM_OUTPUT_CHANNELS
  285. +diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c
  286. +index 91dcb5a1b9..8349e56dcb 100644
  287. +--- a/libavcodec/libfdk-aacenc.c
  288. ++++ b/libavcodec/libfdk-aacenc.c
  289. +@@ -26,10 +26,13 @@
  290. + #include "audio_frame_queue.h"
  291. + #include "internal.h"
  292. +
  293. ++#ifdef AACENCODER_LIB_VL0
  294. + #define FDKENC_VER_AT_LEAST(vl0, vl1) \
  295. +- (defined(AACENCODER_LIB_VL0) && \
  296. +- ((AACENCODER_LIB_VL0 > vl0) || \
  297. +- (AACENCODER_LIB_VL0 == vl0 && AACENCODER_LIB_VL1 >= vl1)))
  298. ++ ((AACENCODER_LIB_VL0 > vl0) || \
  299. ++ (AACENCODER_LIB_VL0 == vl0 && AACENCODER_LIB_VL1 >= vl1))
  300. ++#else
  301. ++#define FDKENC_VER_AT_LEAST(vl0, vl1) 0
  302. ++#endif
  303. +
  304. + typedef struct AACContext {
  305. + const AVClass *class;
  306. +--
  307. +2.20.1
  308. +
  309. --
  310. cgit v1.2.1