hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
################################################################################
#
# ffmpeg
#
################################################################################
 
FFMPEG_VERSION = 4.1.3
FFMPEG_SOURCE = ffmpeg-$(FFMPEG_VERSION).tar.xz
FFMPEG_SITE = http://ffmpeg.org/releases
FFMPEG_INSTALL_STAGING = YES
 
FFMPEG_LICENSE = LGPL-2.1+, libjpeg license
FFMPEG_LICENSE_FILES = LICENSE.md COPYING.LGPLv2.1
ifeq ($(BR2_PACKAGE_FFMPEG_GPL),y)
FFMPEG_LICENSE += and GPL-2.0+
FFMPEG_LICENSE_FILES += COPYING.GPLv2
endif
 
FFMPEG_CONF_OPTS = \
   --prefix=/usr \
   --enable-avfilter \
   --enable-version3 \
   --enable-logging \
   --enable-optimizations \
   --disable-extra-warnings \
   --enable-avdevice \
   --enable-avcodec \
   --enable-avformat \
   --enable-network \
   --disable-gray \
   --enable-swscale-alpha \
   --enable-dct \
   --enable-fft \
   --enable-mdct \
   --enable-rdft \
   --disable-crystalhd \
   --disable-dxva2 \
   --enable-runtime-cpudetect \
   --disable-hardcoded-tables \
   --disable-mipsdsp \
   --disable-mipsdspr2 \
   --disable-msa \
   --enable-hwaccels \
   --disable-cuda \
   --disable-cuvid \
   --disable-nvenc \
   --disable-avisynth \
   --disable-frei0r \
   --disable-libopencore-amrnb \
   --disable-libopencore-amrwb \
   --disable-libdc1394 \
   --disable-libgsm \
   --disable-libilbc \
   --disable-libvo-amrwbenc \
   --disable-symver \
   --disable-doc
 
FFMPEG_DEPENDENCIES += host-pkgconf
 
ifeq ($(BR2_PACKAGE_FFMPEG_GPL),y)
FFMPEG_CONF_OPTS += --enable-gpl
else
FFMPEG_CONF_OPTS += --disable-gpl
endif
 
ifeq ($(BR2_PACKAGE_FFMPEG_NONFREE),y)
FFMPEG_CONF_OPTS += --enable-nonfree
else
FFMPEG_CONF_OPTS += --disable-nonfree
endif
 
ifeq ($(BR2_PACKAGE_FFMPEG_DEBUG),y)
FFMPEG_CONF_OPTS += --enable-debug
else
FFMPEG_CONF_OPTS += --disable-debug
endif
 
ifeq ($(BR2_PACKAGE_FFMPEG_SMALL),y)
FFMPEG_CONF_OPTS += --enable-small
else
FFMPEG_CONF_OPTS += --disable-small
endif
 
ifeq ($(BR2_PACKAGE_FFMPEG_FFMPEG),y)
FFMPEG_CONF_OPTS += --enable-ffmpeg
else
FFMPEG_CONF_OPTS += --disable-ffmpeg
endif
 
ifeq ($(BR2_PACKAGE_FFMPEG_FFPLAY),y)
FFMPEG_DEPENDENCIES += sdl2
FFMPEG_CONF_OPTS += --enable-ffplay
FFMPEG_CONF_ENV += SDL_CONFIG=$(STAGING_DIR)/usr/bin/sdl2-config
else
FFMPEG_CONF_OPTS += --disable-ffplay
endif
 
ifeq ($(BR2_PACKAGE_FFMPEG_AVRESAMPLE),y)
FFMPEG_CONF_OPTS += --enable-avresample
else
FFMPEG_CONF_OPTS += --disable-avresample
endif
 
ifeq ($(BR2_PACKAGE_FFMPEG_FFPROBE),y)
FFMPEG_CONF_OPTS += --enable-ffprobe
else
FFMPEG_CONF_OPTS += --disable-ffprobe
endif
 
ifeq ($(BR2_PACKAGE_FFMPEG_POSTPROC),y)
FFMPEG_CONF_OPTS += --enable-postproc
else
FFMPEG_CONF_OPTS += --disable-postproc
endif
 
ifeq ($(BR2_PACKAGE_FFMPEG_SWSCALE),y)
FFMPEG_CONF_OPTS += --enable-swscale
else
FFMPEG_CONF_OPTS += --disable-swscale
endif
 
ifeq ($(BR2_PACKAGE_ROCKCHIP_RGA),y)
FFMPEG_CONF_OPTS += --enable-librga
FFMPEG_DEPENDENCIES += rockchip-rga
else
FFMPEG_CONF_OPTS += --disable-librga
endif
 
ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_ENCODERS)),all)
FFMPEG_CONF_OPTS += --disable-encoders \
   $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_ENCODERS)),--enable-encoder=$(x))
endif
 
ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_DISABLE_DECODERS)),)
FFMPEG_CONF_OPTS += $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_DISABLE_DECODERS)),--disable-encoder=$(x))
endif
 
ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_DECODERS)),all)
FFMPEG_CONF_OPTS += --disable-decoders \
   $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_DECODERS)),--enable-decoder=$(x))
endif
 
ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_MUXERS)),all)
FFMPEG_CONF_OPTS += --disable-muxers \
   $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_MUXERS)),--enable-muxer=$(x))
endif
 
ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_DEMUXERS)),all)
FFMPEG_CONF_OPTS += --disable-demuxers \
   $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_DEMUXERS)),--enable-demuxer=$(x))
endif
 
ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_PARSERS)),all)
FFMPEG_CONF_OPTS += --disable-parsers \
   $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_PARSERS)),--enable-parser=$(x))
endif
 
ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_BSFS)),all)
FFMPEG_CONF_OPTS += --disable-bsfs \
   $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_BSFS)),--enable-bsf=$(x))
endif
 
ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_PROTOCOLS)),all)
FFMPEG_CONF_OPTS += --disable-protocols \
   $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_PROTOCOLS)),--enable-protocol=$(x))
endif
 
ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_FILTERS)),all)
FFMPEG_CONF_OPTS += --disable-filters \
   $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_FILTERS)),--enable-filter=$(x))
endif
 
ifeq ($(BR2_PACKAGE_FFMPEG_INDEVS),y)
FFMPEG_CONF_OPTS += --enable-indevs
ifeq ($(BR2_PACKAGE_ALSA_LIB),y)
FFMPEG_CONF_OPTS += --enable-alsa
FFMPEG_DEPENDENCIES += alsa-lib
else
FFMPEG_CONF_OPTS += --disable-alsa
endif
else
FFMPEG_CONF_OPTS += --disable-indevs
endif
 
ifeq ($(BR2_PACKAGE_FFMPEG_OUTDEVS),y)
FFMPEG_CONF_OPTS += --enable-outdevs
ifeq ($(BR2_PACKAGE_ALSA_LIB),y)
FFMPEG_DEPENDENCIES += alsa-lib
endif
else
FFMPEG_CONF_OPTS += --disable-outdevs
endif
 
ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
FFMPEG_CONF_OPTS += --enable-pthreads
else
FFMPEG_CONF_OPTS += --disable-pthreads
endif
 
ifeq ($(BR2_PACKAGE_ZLIB),y)
FFMPEG_CONF_OPTS += --enable-zlib
FFMPEG_DEPENDENCIES += zlib
else
FFMPEG_CONF_OPTS += --disable-zlib
endif
 
ifeq ($(BR2_PACKAGE_BZIP2),y)
FFMPEG_CONF_OPTS += --enable-bzlib
FFMPEG_DEPENDENCIES += bzip2
else
FFMPEG_CONF_OPTS += --disable-bzlib
endif
 
ifeq ($(BR2_PACKAGE_FDK_AAC)$(BR2_PACKAGE_FFMPEG_NONFREE),yy)
FFMPEG_CONF_OPTS += --enable-libfdk-aac
FFMPEG_DEPENDENCIES += fdk-aac
else
FFMPEG_CONF_OPTS += --disable-libfdk-aac
endif
 
ifeq ($(BR2_PACKAGE_FFMPEG_GPL)$(BR2_PACKAGE_LIBCDIO_PARANOIA),yy)
FFMPEG_CONF_OPTS += --enable-libcdio
FFMPEG_DEPENDENCIES += libcdio-paranoia
else
FFMPEG_CONF_OPTS += --disable-libcdio
endif
 
ifeq ($(BR2_PACKAGE_GNUTLS),y)
FFMPEG_CONF_OPTS += --enable-gnutls --disable-openssl
FFMPEG_DEPENDENCIES += gnutls
else
FFMPEG_CONF_OPTS += --disable-gnutls
ifeq ($(BR2_PACKAGE_OPENSSL),y)
# openssl isn't license compatible with GPL
ifeq ($(BR2_PACKAGE_FFMPEG_GPL)x$(BR2_PACKAGE_FFMPEG_NONFREE),yx)
FFMPEG_CONF_OPTS += --disable-openssl
else
FFMPEG_CONF_OPTS += --enable-openssl
FFMPEG_DEPENDENCIES += openssl
endif
else
FFMPEG_CONF_OPTS += --disable-openssl
endif
endif
 
ifeq ($(BR2_PACKAGE_FFMPEG_GPL)$(BR2_PACKAGE_LIBEBUR128),yy)
FFMPEG_DEPENDENCIES += libebur128
endif
 
ifeq ($(BR2_PACKAGE_LIBDRM),y)
FFMPEG_CONF_OPTS += --enable-libdrm
FFMPEG_DEPENDENCIES += libdrm
else
FFMPEG_CONF_OPTS += --disable-libdrm
 
ifeq ($(BR2_PACKAGE_LIBION),y)
FFMPEG_CONF_OPTS += --enable-libion
FFMPEG_DEPENDENCIES += libion
endif
endif
 
ifeq ($(BR2_PACKAGE_LIBOPENH264),y)
FFMPEG_CONF_OPTS += --enable-libopenh264
FFMPEG_DEPENDENCIES += libopenh264
else
FFMPEG_CONF_OPTS += --disable-libopenh264
endif
 
ifeq ($(BR2_PACKAGE_LIBVORBIS),y)
FFMPEG_DEPENDENCIES += libvorbis
FFMPEG_CONF_OPTS += \
   --enable-libvorbis \
   --enable-muxer=ogg \
   --enable-encoder=libvorbis
endif
 
ifeq ($(BR2_PACKAGE_LIBVA),y)
FFMPEG_CONF_OPTS += --enable-vaapi
FFMPEG_DEPENDENCIES += libva
else
FFMPEG_CONF_OPTS += --disable-vaapi
endif
 
ifeq ($(BR2_PACKAGE_LIBVDPAU),y)
FFMPEG_CONF_OPTS += --enable-vdpau
FFMPEG_DEPENDENCIES += libvdpau
else
FFMPEG_CONF_OPTS += --disable-vdpau
endif
 
ifeq ($(BR2_PACKAGE_ROCKCHIP_MPP),y)
ifeq ($(BR2_PACKAGE_RV1108),y)
FFMPEG_DEPENDENCIES += rockchip-mpp libion
FFMPEG_CONF_OPTS += --enable-rkmpp --extra-cflags="-D CONFIG_ION"
else
FFMPEG_DEPENDENCIES += rockchip-mpp libdrm
FFMPEG_CONF_OPTS += --enable-rkmpp --enable-libdrm
endif
# --disable-v4l2-m2m seems no effect, disable each v4l2m2m
FFMPEG_CONF_OPTS += \
   --disable-decoder=h264_v4l2m2m \
   --disable-decoder=vp8_v4l2m2m \
   --disable-decoder=mpeg2_v4l2m2m \
   --disable-decoder=mpeg4_v4l2m2m
FFMPEG_CONF_OPTS += \
   --disable-encoder=h264_v4l2m2m \
   --disable-encoder=vp8_v4l2m2m \
   --disable-encoder=mpeg2_v4l2m2m \
   --disable-encoder=mpeg4_v4l2m2m
else
FFMPEG_CONF_OPTS += --disable-rkmpp
endif
 
ifeq ($(BR2_PACKAGE_RPI_USERLAND),y)
FFMPEG_CONF_OPTS += --enable-mmal --enable-omx --enable-omx-rpi \
   --extra-cflags=-I$(STAGING_DIR)/usr/include/IL
FFMPEG_DEPENDENCIES += rpi-userland
else
FFMPEG_CONF_OPTS += --disable-mmal --disable-omx --disable-omx-rpi
endif
 
# To avoid a circular dependency only use opencv if opencv itself does
# not depend on ffmpeg.
ifeq ($(BR2_PACKAGE_OPENCV_LIB_IMGPROC)x$(BR2_PACKAGE_OPENCV_WITH_FFMPEG),yx)
FFMPEG_CONF_OPTS += --enable-libopencv
FFMPEG_DEPENDENCIES += opencv
else ifeq ($(BR2_PACKAGE_OPENCV3_LIB_IMGPROC)x$(BR2_PACKAGE_OPENCV3_WITH_FFMPEG),yx)
FFMPEG_CONF_OPTS += --enable-libopencv
FFMPEG_DEPENDENCIES += opencv3
else
FFMPEG_CONF_OPTS += --disable-libopencv
endif
 
ifeq ($(BR2_PACKAGE_OPUS),y)
FFMPEG_CONF_OPTS += --enable-libopus
FFMPEG_DEPENDENCIES += opus
else
FFMPEG_CONF_OPTS += --disable-libopus
endif
 
ifeq ($(BR2_PACKAGE_LIBVPX),y)
FFMPEG_CONF_OPTS += --enable-libvpx
FFMPEG_DEPENDENCIES += libvpx
else
FFMPEG_CONF_OPTS += --disable-libvpx
endif
 
ifeq ($(BR2_PACKAGE_LIBASS),y)
FFMPEG_CONF_OPTS += --enable-libass
FFMPEG_DEPENDENCIES += libass
else
FFMPEG_CONF_OPTS += --disable-libass
endif
 
ifeq ($(BR2_PACKAGE_LIBBLURAY),y)
FFMPEG_CONF_OPTS += --enable-libbluray
FFMPEG_DEPENDENCIES += libbluray
else
FFMPEG_CONF_OPTS += --disable-libbluray
endif
 
ifeq ($(BR2_PACKAGE_INTEL_MEDIASDK),y)
FFMPEG_CONF_OPTS += --enable-libmfx
FFMPEG_DEPENDENCIES += intel-mediasdk
else
FFMPEG_CONF_OPTS += --disable-libmfx
endif
 
ifeq ($(BR2_PACKAGE_RTMPDUMP),y)
FFMPEG_CONF_OPTS += --enable-librtmp
FFMPEG_DEPENDENCIES += rtmpdump
else
FFMPEG_CONF_OPTS += --disable-librtmp
endif
 
ifeq ($(BR2_PACKAGE_LAME),y)
FFMPEG_CONF_OPTS += --enable-libmp3lame
FFMPEG_DEPENDENCIES += lame
else
FFMPEG_CONF_OPTS += --disable-libmp3lame
endif
 
ifeq ($(BR2_PACKAGE_LIBMODPLUG),y)
FFMPEG_CONF_OPTS += --enable-libmodplug
FFMPEG_DEPENDENCIES += libmodplug
else
FFMPEG_CONF_OPTS += --disable-libmodplug
endif
 
ifeq ($(BR2_PACKAGE_SPEEX),y)
FFMPEG_CONF_OPTS += --enable-libspeex
FFMPEG_DEPENDENCIES += speex
else
FFMPEG_CONF_OPTS += --disable-libspeex
endif
 
ifeq ($(BR2_PACKAGE_LIBTHEORA),y)
FFMPEG_CONF_OPTS += --enable-libtheora
FFMPEG_DEPENDENCIES += libtheora
else
FFMPEG_CONF_OPTS += --disable-libtheora
endif
 
ifeq ($(BR2_PACKAGE_WAVPACK),y)
FFMPEG_CONF_OPTS += --enable-libwavpack
FFMPEG_DEPENDENCIES += wavpack
else
FFMPEG_CONF_OPTS += --disable-libwavpack
endif
 
ifeq ($(BR2_PACKAGE_LIBICONV),y)
FFMPEG_CONF_OPTS += --enable-iconv
FFMPEG_DEPENDENCIES += libiconv
else
FFMPEG_CONF_OPTS += --disable-iconv
endif
 
# ffmpeg freetype support require fenv.h which is only
# available/working on glibc.
# The microblaze variant doesn't provide the needed exceptions
ifeq ($(BR2_PACKAGE_FREETYPE)$(BR2_TOOLCHAIN_USES_GLIBC)x$(BR2_microblaze),yyx)
FFMPEG_CONF_OPTS += --enable-libfreetype
FFMPEG_DEPENDENCIES += freetype
else
FFMPEG_CONF_OPTS += --disable-libfreetype
endif
 
ifeq ($(BR2_PACKAGE_FONTCONFIG),y)
FFMPEG_CONF_OPTS += --enable-fontconfig
FFMPEG_DEPENDENCIES += fontconfig
else
FFMPEG_CONF_OPTS += --disable-fontconfig
endif
 
ifeq ($(BR2_PACKAGE_OPENJPEG),y)
FFMPEG_CONF_OPTS += --enable-libopenjpeg
FFMPEG_DEPENDENCIES += openjpeg
else
FFMPEG_CONF_OPTS += --disable-libopenjpeg
endif
 
ifeq ($(BR2_PACKAGE_X264)$(BR2_PACKAGE_FFMPEG_GPL),yy)
FFMPEG_CONF_OPTS += --enable-libx264
FFMPEG_DEPENDENCIES += x264
else
FFMPEG_CONF_OPTS += --disable-libx264
endif
 
ifeq ($(BR2_PACKAGE_X265)$(BR2_PACKAGE_FFMPEG_GPL),yy)
FFMPEG_CONF_OPTS += --enable-libx265
FFMPEG_DEPENDENCIES += x265
else
FFMPEG_CONF_OPTS += --disable-libx265
endif
 
ifeq ($(BR2_X86_CPU_HAS_MMX),y)
FFMPEG_CONF_OPTS += --enable-x86asm
FFMPEG_DEPENDENCIES += host-nasm
else
FFMPEG_CONF_OPTS += --disable-x86asm
FFMPEG_CONF_OPTS += --disable-mmx
endif
 
ifeq ($(BR2_X86_CPU_HAS_SSE),y)
FFMPEG_CONF_OPTS += --enable-sse
else
FFMPEG_CONF_OPTS += --disable-sse
endif
 
ifeq ($(BR2_X86_CPU_HAS_SSE2),y)
FFMPEG_CONF_OPTS += --enable-sse2
else
FFMPEG_CONF_OPTS += --disable-sse2
endif
 
ifeq ($(BR2_X86_CPU_HAS_SSE3),y)
FFMPEG_CONF_OPTS += --enable-sse3
else
FFMPEG_CONF_OPTS += --disable-sse3
endif
 
ifeq ($(BR2_X86_CPU_HAS_SSSE3),y)
FFMPEG_CONF_OPTS += --enable-ssse3
else
FFMPEG_CONF_OPTS += --disable-ssse3
endif
 
ifeq ($(BR2_X86_CPU_HAS_SSE4),y)
FFMPEG_CONF_OPTS += --enable-sse4
else
FFMPEG_CONF_OPTS += --disable-sse4
endif
 
ifeq ($(BR2_X86_CPU_HAS_SSE42),y)
FFMPEG_CONF_OPTS += --enable-sse42
else
FFMPEG_CONF_OPTS += --disable-sse42
endif
 
ifeq ($(BR2_X86_CPU_HAS_AVX),y)
FFMPEG_CONF_OPTS += --enable-avx
else
FFMPEG_CONF_OPTS += --disable-avx
endif
 
ifeq ($(BR2_X86_CPU_HAS_AVX2),y)
FFMPEG_CONF_OPTS += --enable-avx2
else
FFMPEG_CONF_OPTS += --disable-avx2
endif
 
# Explicitly disable everything that doesn't match for ARM
# FFMPEG "autodetects" by compiling an extended instruction via AS
# This works on compilers that aren't built for generic by default
ifeq ($(BR2_ARM_CPU_ARMV4),y)
FFMPEG_CONF_OPTS += --disable-armv5te
endif
ifeq ($(BR2_ARM_CPU_ARMV6)$(BR2_ARM_CPU_ARMV7A),y)
FFMPEG_CONF_OPTS += --enable-armv6
else
FFMPEG_CONF_OPTS += --disable-armv6 --disable-armv6t2
endif
ifeq ($(BR2_ARM_CPU_HAS_VFPV2),y)
FFMPEG_CONF_OPTS += --enable-vfp
else
FFMPEG_CONF_OPTS += --disable-vfp
endif
ifeq ($(BR2_ARM_CPU_HAS_NEON),y)
FFMPEG_CONF_OPTS += --enable-neon
else ifeq ($(BR2_aarch64),y)
FFMPEG_CONF_OPTS += --enable-neon
else
FFMPEG_CONF_OPTS += --disable-neon
endif
 
ifeq ($(BR2_mips)$(BR2_mipsel)$(BR2_mips64)$(BR2_mips64el),y)
ifeq ($(BR2_MIPS_SOFT_FLOAT),y)
FFMPEG_CONF_OPTS += --disable-mipsfpu
else
FFMPEG_CONF_OPTS += --enable-mipsfpu
endif
 
# Fix build failure on "addi opcode not supported"
ifeq ($(BR2_mips_32r6)$(BR2_mips_64r6),y)
FFMPEG_CONF_OPTS += --disable-asm
endif
endif # MIPS
 
ifeq ($(BR2_POWERPC_CPU_HAS_ALTIVEC),y)
FFMPEG_CONF_OPTS += --enable-altivec
else
FFMPEG_CONF_OPTS += --disable-altivec
endif
 
# Uses __atomic_fetch_add_4
ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
FFMPEG_CONF_OPTS += --extra-libs=-latomic
endif
 
ifeq ($(BR2_STATIC_LIBS),)
FFMPEG_CONF_OPTS += --enable-pic
else
FFMPEG_CONF_OPTS += --disable-pic
endif
 
# Default to --cpu=generic for MIPS architecture, in order to avoid a
# warning from ffmpeg's configure script.
ifeq ($(BR2_mips)$(BR2_mipsel)$(BR2_mips64)$(BR2_mips64el),y)
FFMPEG_CONF_OPTS += --cpu=generic
else ifneq ($(GCC_TARGET_CPU),)
FFMPEG_CONF_OPTS += --cpu="$(GCC_TARGET_CPU)"
else ifneq ($(GCC_TARGET_ARCH),)
FFMPEG_CONF_OPTS += --cpu="$(GCC_TARGET_ARCH)"
endif
 
FFMPEG_CFLAGS = $(TARGET_CFLAGS)
 
ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_85180),y)
FFMPEG_CONF_OPTS += --disable-optimizations
FFMPEG_CFLAGS += -O0
endif
 
FFMPEG_CONF_ENV += CFLAGS="$(FFMPEG_CFLAGS)"
FFMPEG_CONF_OPTS += $(call qstrip,$(BR2_PACKAGE_FFMPEG_EXTRACONF))
 
# Override FFMPEG_CONFIGURE_CMDS: FFmpeg does not support --target and others
define FFMPEG_CONFIGURE_CMDS
   (cd $(FFMPEG_SRCDIR) && rm -rf config.cache && \
   $(TARGET_CONFIGURE_OPTS) \
   $(TARGET_CONFIGURE_ARGS) \
   $(FFMPEG_CONF_ENV) \
   ./configure \
       --enable-cross-compile \
       --cross-prefix=$(TARGET_CROSS) \
       --sysroot=$(STAGING_DIR) \
       --host-cc="$(HOSTCC)" \
       --arch=$(BR2_ARCH) \
       --target-os="linux" \
       --disable-stripping \
       --pkg-config="$(PKG_CONFIG_HOST_BINARY)" \
       $(SHARED_STATIC_LIBS_OPTS) \
       $(FFMPEG_CONF_OPTS) \
   )
endef
 
define FFMPEG_REMOVE_EXAMPLE_SRC_FILES
   rm -rf $(TARGET_DIR)/usr/share/ffmpeg/examples
endef
FFMPEG_POST_INSTALL_TARGET_HOOKS += FFMPEG_REMOVE_EXAMPLE_SRC_FILES
 
$(eval $(autotools-package))