blob: fc1834c00b2300138a15c8ae9d458fe47f381ac8 [file] [log] [blame]
Andrew Geissler82c905d2020-04-13 13:39:40 -05001SUMMARY = "A complete, cross-platform solution to record, convert and stream audio and video."
2DESCRIPTION = "FFmpeg is the leading multimedia framework, able to decode, encode, transcode, \
3 mux, demux, stream, filter and play pretty much anything that humans and machines \
4 have created. It supports the most obscure ancient formats up to the cutting edge."
5HOMEPAGE = "https://www.ffmpeg.org/"
6SECTION = "libs"
7
Andrew Geissler5199d832021-09-24 16:47:35 -05008LICENSE = "GPLv2+ & LGPLv2.1+ & ISC & MIT & BSD-2-Clause & BSD-3-Clause & IJG"
Patrick Williams213cb262021-08-07 19:21:33 -05009LICENSE:${PN} = "GPLv2+"
10LICENSE:libavcodec = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPLv2+', 'LGPLv2.1+', d)}"
11LICENSE:libavdevice = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPLv2+', 'LGPLv2.1+', d)}"
12LICENSE:libavfilter = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPLv2+', 'LGPLv2.1+', d)}"
13LICENSE:libavformat = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPLv2+', 'LGPLv2.1+', d)}"
14LICENSE:libavresample = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPLv2+', 'LGPLv2.1+', d)}"
15LICENSE:libavutil = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPLv2+', 'LGPLv2.1+', d)}"
16LICENSE:libpostproc = "GPLv2+"
17LICENSE:libswresample = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPLv2+', 'LGPLv2.1+', d)}"
18LICENSE:libswscale = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPLv2+', 'LGPLv2.1+', d)}"
Andrew Geissler82c905d2020-04-13 13:39:40 -050019LICENSE_FLAGS = "commercial"
20
21LIC_FILES_CHKSUM = "file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
22 file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \
23 file://COPYING.LGPLv2.1;md5=bd7a443320af8c812e4c18d1b79df004 \
24 file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02"
25
26SRC_URI = "https://www.ffmpeg.org/releases/${BP}.tar.xz \
Andrew Geissler09209ee2020-12-13 08:44:15 -060027 file://0001-libavutil-include-assembly-with-full-path-from-sourc.patch \
Patrick Williams213cb262021-08-07 19:21:33 -050028 file://fix-CVE-2020-20446.patch \
29 file://fix-CVE-2020-20453.patch \
30 file://fix-CVE-2020-22015.patch \
31 file://fix-CVE-2020-22021.patch \
32 file://fix-CVE-2020-22033-CVE-2020-22019.patch \
33 file://fix-CVE-2021-33815.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050034 "
William A. Kennington IIIac69b482021-06-02 12:28:27 -070035SRC_URI[sha256sum] = "06b10a183ce5371f915c6bb15b7b1fffbe046e8275099c96affc29e17645d909"
Andrew Geissler82c905d2020-04-13 13:39:40 -050036
37# Build fails when thumb is enabled: https://bugzilla.yoctoproject.org/show_bug.cgi?id=7717
Patrick Williams213cb262021-08-07 19:21:33 -050038ARM_INSTRUCTION_SET:armv4 = "arm"
39ARM_INSTRUCTION_SET:armv5 = "arm"
40ARM_INSTRUCTION_SET:armv6 = "arm"
Andrew Geissler82c905d2020-04-13 13:39:40 -050041
42# Should be API compatible with libav (which was a fork of ffmpeg)
43# libpostproc was previously packaged from a separate recipe
44PROVIDES = "libav libpostproc"
45
46DEPENDS = "nasm-native"
47
48inherit autotools pkgconfig
49
50PACKAGECONFIG ??= "avdevice avfilter avcodec avformat swresample swscale postproc avresample \
Andrew Geissler95ac1b82021-03-31 14:34:31 -050051 alsa bzlib lzma pic pthreads shared theora zlib \
Andrew Geissler9b4d8b02021-02-19 12:26:16 -060052 ${@bb.utils.contains('AVAILTUNES', 'mips32r2', 'mips32r2', '', d)} \
Andrew Geissler82c905d2020-04-13 13:39:40 -050053 ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xv xcb', '', d)}"
54
55# libraries to build in addition to avutil
56PACKAGECONFIG[avdevice] = "--enable-avdevice,--disable-avdevice"
57PACKAGECONFIG[avfilter] = "--enable-avfilter,--disable-avfilter"
58PACKAGECONFIG[avcodec] = "--enable-avcodec,--disable-avcodec"
59PACKAGECONFIG[avformat] = "--enable-avformat,--disable-avformat"
60PACKAGECONFIG[swresample] = "--enable-swresample,--disable-swresample"
61PACKAGECONFIG[swscale] = "--enable-swscale,--disable-swscale"
62PACKAGECONFIG[postproc] = "--enable-postproc,--disable-postproc"
63PACKAGECONFIG[avresample] = "--enable-avresample,--disable-avresample"
64
65# features to support
66PACKAGECONFIG[alsa] = "--enable-alsa,--disable-alsa,alsa-lib"
Andrew Geissler475cb722020-07-10 16:00:51 -050067PACKAGECONFIG[altivec] = "--enable-altivec,--disable-altivec,"
Andrew Geissler82c905d2020-04-13 13:39:40 -050068PACKAGECONFIG[bzlib] = "--enable-bzlib,--disable-bzlib,bzip2"
69PACKAGECONFIG[fdk-aac] = "--enable-libfdk-aac --enable-nonfree,--disable-libfdk-aac,fdk-aac"
70PACKAGECONFIG[gpl] = "--enable-gpl,--disable-gpl"
71PACKAGECONFIG[gsm] = "--enable-libgsm,--disable-libgsm,libgsm"
72PACKAGECONFIG[jack] = "--enable-indev=jack,--disable-indev=jack,jack"
William A. Kennington IIIac69b482021-06-02 12:28:27 -070073PACKAGECONFIG[libopus] = "--enable-libopus,--disable-libopus,libopus"
Andrew Geissler82c905d2020-04-13 13:39:40 -050074PACKAGECONFIG[libvorbis] = "--enable-libvorbis,--disable-libvorbis,libvorbis"
75PACKAGECONFIG[lzma] = "--enable-lzma,--disable-lzma,xz"
76PACKAGECONFIG[mfx] = "--enable-libmfx,--disable-libmfx,intel-mediasdk"
77PACKAGECONFIG[mp3lame] = "--enable-libmp3lame,--disable-libmp3lame,lame"
78PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl"
79PACKAGECONFIG[sdl2] = "--enable-sdl2,--disable-sdl2,virtual/libsdl2"
80PACKAGECONFIG[speex] = "--enable-libspeex,--disable-libspeex,speex"
Andrew Geissler6ce62a22020-11-30 19:58:47 -060081PACKAGECONFIG[srt] = "--enable-libsrt,--disable-libsrt,srt"
Andrew Geissler82c905d2020-04-13 13:39:40 -050082PACKAGECONFIG[theora] = "--enable-libtheora,--disable-libtheora,libtheora libogg"
83PACKAGECONFIG[vaapi] = "--enable-vaapi,--disable-vaapi,libva"
84PACKAGECONFIG[vdpau] = "--enable-vdpau,--disable-vdpau,libvdpau"
85PACKAGECONFIG[vpx] = "--enable-libvpx,--disable-libvpx,libvpx"
86PACKAGECONFIG[x264] = "--enable-libx264,--disable-libx264,x264"
87PACKAGECONFIG[x265] = "--enable-libx265,--disable-libx265,x265"
88PACKAGECONFIG[xcb] = "--enable-libxcb,--disable-libxcb,libxcb"
89PACKAGECONFIG[xv] = "--enable-outdev=xv,--disable-outdev=xv,libxv"
90PACKAGECONFIG[zlib] = "--enable-zlib,--disable-zlib,zlib"
91
Andrew Geissler9b4d8b02021-02-19 12:26:16 -060092# other configuration options
93PACKAGECONFIG[mips32r2] = ",--disable-mipsdsp --disable-mipsdspr2"
94PACKAGECONFIG[pic] = "--enable-pic"
95PACKAGECONFIG[pthreads] = "--enable-pthreads,--disable-pthreads"
96PACKAGECONFIG[shared] = "--enable-shared"
97PACKAGECONFIG[strip] = ",--disable-stripping"
98
Andrew Geissler82c905d2020-04-13 13:39:40 -050099# Check codecs that require --enable-nonfree
100USE_NONFREE = "${@bb.utils.contains_any('PACKAGECONFIG', [ 'openssl' ], 'yes', '', d)}"
101
102def cpu(d):
103 for arg in (d.getVar('TUNE_CCARGS') or '').split():
104 if arg.startswith('-mcpu='):
105 return arg[6:]
106 return 'generic'
107
108EXTRA_OECONF = " \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500109 ${@bb.utils.contains('USE_NONFREE', 'yes', '--enable-nonfree', '', d)} \
110 \
111 --cross-prefix=${TARGET_PREFIX} \
112 \
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700113 --ld='${CCLD}' \
114 --cc='${CC}' \
115 --cxx='${CXX}' \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500116 --arch=${TARGET_ARCH} \
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700117 --target-os='linux' \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500118 --enable-cross-compile \
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700119 --extra-cflags='${CFLAGS} ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}' \
120 --extra-ldflags='${LDFLAGS}' \
121 --sysroot='${STAGING_DIR_TARGET}' \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500122 ${EXTRA_FFCONF} \
123 --libdir=${libdir} \
124 --shlibdir=${libdir} \
125 --datadir=${datadir}/ffmpeg \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500126 --cpu=${@cpu(d)} \
127 --pkg-config=pkg-config \
128"
129
Patrick Williams213cb262021-08-07 19:21:33 -0500130EXTRA_OECONF:append:linux-gnux32 = " --disable-asm"
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700131
132EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mipsisa64r6', '--disable-mips64r2 --disable-mips32r2', '', d)}"
133EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mipsisa64r2', '--disable-mips64r6 --disable-mips32r6', '', d)}"
134EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mips32r2', '--disable-mips64r6 --disable-mips32r6', '', d)}"
135EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mips32r6', '--disable-mips64r2 --disable-mips32r2', '', d)}"
Patrick Williams213cb262021-08-07 19:21:33 -0500136EXTRA_OECONF:append:mips = " --extra-libs=-latomic --disable-mips32r5 --disable-mipsdsp --disable-mipsdspr2 \
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700137 --disable-loongson2 --disable-loongson3 --disable-mmi --disable-msa --disable-msa2"
Patrick Williams213cb262021-08-07 19:21:33 -0500138EXTRA_OECONF:append:riscv32 = " --extra-libs=-latomic"
139EXTRA_OECONF:append:armv5 = " --extra-libs=-latomic"
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700140
Andrew Geissler82c905d2020-04-13 13:39:40 -0500141# gold crashes on x86, another solution is to --disable-asm but thats more hacky
142# ld.gold: internal error in relocate_section, at ../../gold/i386.cc:3684
143
Patrick Williams213cb262021-08-07 19:21:33 -0500144LDFLAGS:append:x86 = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500145
146EXTRA_OEMAKE = "V=1"
147
148do_configure() {
149 ${S}/configure ${EXTRA_OECONF}
150}
151
Andrew Geissler09209ee2020-12-13 08:44:15 -0600152# patch out build host paths for reproducibility
Patrick Williams213cb262021-08-07 19:21:33 -0500153do_compile:prepend:class-target() {
Andrew Geissler09209ee2020-12-13 08:44:15 -0600154 sed -i -e "s,${WORKDIR},,g" ${B}/config.h
155}
156
Andrew Geissler82c905d2020-04-13 13:39:40 -0500157PACKAGES =+ "libavcodec \
158 libavdevice \
159 libavfilter \
160 libavformat \
161 libavresample \
162 libavutil \
163 libpostproc \
164 libswresample \
165 libswscale"
166
Patrick Williams213cb262021-08-07 19:21:33 -0500167FILES:libavcodec = "${libdir}/libavcodec${SOLIBS}"
168FILES:libavdevice = "${libdir}/libavdevice${SOLIBS}"
169FILES:libavfilter = "${libdir}/libavfilter${SOLIBS}"
170FILES:libavformat = "${libdir}/libavformat${SOLIBS}"
171FILES:libavresample = "${libdir}/libavresample${SOLIBS}"
172FILES:libavutil = "${libdir}/libavutil${SOLIBS}"
173FILES:libpostproc = "${libdir}/libpostproc${SOLIBS}"
174FILES:libswresample = "${libdir}/libswresample${SOLIBS}"
175FILES:libswscale = "${libdir}/libswscale${SOLIBS}"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500176
177# ffmpeg disables PIC on some platforms (e.g. x86-32)
Patrick Williams213cb262021-08-07 19:21:33 -0500178INSANE_SKIP:${MLPREFIX}libavcodec = "textrel"
179INSANE_SKIP:${MLPREFIX}libavdevice = "textrel"
180INSANE_SKIP:${MLPREFIX}libavfilter = "textrel"
181INSANE_SKIP:${MLPREFIX}libavformat = "textrel"
182INSANE_SKIP:${MLPREFIX}libavutil = "textrel"
183INSANE_SKIP:${MLPREFIX}libavresample = "textrel"
184INSANE_SKIP:${MLPREFIX}libswscale = "textrel"
185INSANE_SKIP:${MLPREFIX}libswresample = "textrel"
186INSANE_SKIP:${MLPREFIX}libpostproc = "textrel"