blob: c0318ef01db35295e83ce88284e56534fa13e1b6 [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 Geisslereff27472021-10-29 15:35:00 -050034 file://fix-CVE-2021-38171.patch \
35 file://fix-CVE-2021-38114.patch \
Patrick Williams93c203f2021-10-06 16:15:23 -050036 "
William A. Kennington IIIac69b482021-06-02 12:28:27 -070037SRC_URI[sha256sum] = "06b10a183ce5371f915c6bb15b7b1fffbe046e8275099c96affc29e17645d909"
Andrew Geissler82c905d2020-04-13 13:39:40 -050038
39# Build fails when thumb is enabled: https://bugzilla.yoctoproject.org/show_bug.cgi?id=7717
Patrick Williams213cb262021-08-07 19:21:33 -050040ARM_INSTRUCTION_SET:armv4 = "arm"
41ARM_INSTRUCTION_SET:armv5 = "arm"
42ARM_INSTRUCTION_SET:armv6 = "arm"
Andrew Geissler82c905d2020-04-13 13:39:40 -050043
44# Should be API compatible with libav (which was a fork of ffmpeg)
45# libpostproc was previously packaged from a separate recipe
46PROVIDES = "libav libpostproc"
47
48DEPENDS = "nasm-native"
49
50inherit autotools pkgconfig
51
52PACKAGECONFIG ??= "avdevice avfilter avcodec avformat swresample swscale postproc avresample \
Andrew Geissler95ac1b82021-03-31 14:34:31 -050053 alsa bzlib lzma pic pthreads shared theora zlib \
Andrew Geissler9b4d8b02021-02-19 12:26:16 -060054 ${@bb.utils.contains('AVAILTUNES', 'mips32r2', 'mips32r2', '', d)} \
Andrew Geissler82c905d2020-04-13 13:39:40 -050055 ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xv xcb', '', d)}"
56
57# libraries to build in addition to avutil
58PACKAGECONFIG[avdevice] = "--enable-avdevice,--disable-avdevice"
59PACKAGECONFIG[avfilter] = "--enable-avfilter,--disable-avfilter"
60PACKAGECONFIG[avcodec] = "--enable-avcodec,--disable-avcodec"
61PACKAGECONFIG[avformat] = "--enable-avformat,--disable-avformat"
62PACKAGECONFIG[swresample] = "--enable-swresample,--disable-swresample"
63PACKAGECONFIG[swscale] = "--enable-swscale,--disable-swscale"
64PACKAGECONFIG[postproc] = "--enable-postproc,--disable-postproc"
65PACKAGECONFIG[avresample] = "--enable-avresample,--disable-avresample"
66
67# features to support
68PACKAGECONFIG[alsa] = "--enable-alsa,--disable-alsa,alsa-lib"
Andrew Geissler475cb722020-07-10 16:00:51 -050069PACKAGECONFIG[altivec] = "--enable-altivec,--disable-altivec,"
Andrew Geissler82c905d2020-04-13 13:39:40 -050070PACKAGECONFIG[bzlib] = "--enable-bzlib,--disable-bzlib,bzip2"
71PACKAGECONFIG[fdk-aac] = "--enable-libfdk-aac --enable-nonfree,--disable-libfdk-aac,fdk-aac"
72PACKAGECONFIG[gpl] = "--enable-gpl,--disable-gpl"
73PACKAGECONFIG[gsm] = "--enable-libgsm,--disable-libgsm,libgsm"
74PACKAGECONFIG[jack] = "--enable-indev=jack,--disable-indev=jack,jack"
William A. Kennington IIIac69b482021-06-02 12:28:27 -070075PACKAGECONFIG[libopus] = "--enable-libopus,--disable-libopus,libopus"
Andrew Geissler82c905d2020-04-13 13:39:40 -050076PACKAGECONFIG[libvorbis] = "--enable-libvorbis,--disable-libvorbis,libvorbis"
77PACKAGECONFIG[lzma] = "--enable-lzma,--disable-lzma,xz"
78PACKAGECONFIG[mfx] = "--enable-libmfx,--disable-libmfx,intel-mediasdk"
79PACKAGECONFIG[mp3lame] = "--enable-libmp3lame,--disable-libmp3lame,lame"
80PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl"
81PACKAGECONFIG[sdl2] = "--enable-sdl2,--disable-sdl2,virtual/libsdl2"
82PACKAGECONFIG[speex] = "--enable-libspeex,--disable-libspeex,speex"
Andrew Geissler6ce62a22020-11-30 19:58:47 -060083PACKAGECONFIG[srt] = "--enable-libsrt,--disable-libsrt,srt"
Andrew Geissler82c905d2020-04-13 13:39:40 -050084PACKAGECONFIG[theora] = "--enable-libtheora,--disable-libtheora,libtheora libogg"
85PACKAGECONFIG[vaapi] = "--enable-vaapi,--disable-vaapi,libva"
86PACKAGECONFIG[vdpau] = "--enable-vdpau,--disable-vdpau,libvdpau"
87PACKAGECONFIG[vpx] = "--enable-libvpx,--disable-libvpx,libvpx"
88PACKAGECONFIG[x264] = "--enable-libx264,--disable-libx264,x264"
89PACKAGECONFIG[x265] = "--enable-libx265,--disable-libx265,x265"
90PACKAGECONFIG[xcb] = "--enable-libxcb,--disable-libxcb,libxcb"
91PACKAGECONFIG[xv] = "--enable-outdev=xv,--disable-outdev=xv,libxv"
92PACKAGECONFIG[zlib] = "--enable-zlib,--disable-zlib,zlib"
93
Andrew Geissler9b4d8b02021-02-19 12:26:16 -060094# other configuration options
95PACKAGECONFIG[mips32r2] = ",--disable-mipsdsp --disable-mipsdspr2"
96PACKAGECONFIG[pic] = "--enable-pic"
97PACKAGECONFIG[pthreads] = "--enable-pthreads,--disable-pthreads"
98PACKAGECONFIG[shared] = "--enable-shared"
99PACKAGECONFIG[strip] = ",--disable-stripping"
100
Andrew Geissler82c905d2020-04-13 13:39:40 -0500101# Check codecs that require --enable-nonfree
102USE_NONFREE = "${@bb.utils.contains_any('PACKAGECONFIG', [ 'openssl' ], 'yes', '', d)}"
103
104def cpu(d):
105 for arg in (d.getVar('TUNE_CCARGS') or '').split():
106 if arg.startswith('-mcpu='):
107 return arg[6:]
108 return 'generic'
109
110EXTRA_OECONF = " \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500111 ${@bb.utils.contains('USE_NONFREE', 'yes', '--enable-nonfree', '', d)} \
112 \
113 --cross-prefix=${TARGET_PREFIX} \
114 \
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700115 --ld='${CCLD}' \
116 --cc='${CC}' \
117 --cxx='${CXX}' \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500118 --arch=${TARGET_ARCH} \
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700119 --target-os='linux' \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500120 --enable-cross-compile \
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700121 --extra-cflags='${CFLAGS} ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}' \
122 --extra-ldflags='${LDFLAGS}' \
123 --sysroot='${STAGING_DIR_TARGET}' \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500124 ${EXTRA_FFCONF} \
125 --libdir=${libdir} \
126 --shlibdir=${libdir} \
127 --datadir=${datadir}/ffmpeg \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500128 --cpu=${@cpu(d)} \
129 --pkg-config=pkg-config \
130"
131
Patrick Williams213cb262021-08-07 19:21:33 -0500132EXTRA_OECONF:append:linux-gnux32 = " --disable-asm"
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700133
134EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mipsisa64r6', '--disable-mips64r2 --disable-mips32r2', '', d)}"
135EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mipsisa64r2', '--disable-mips64r6 --disable-mips32r6', '', d)}"
136EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mips32r2', '--disable-mips64r6 --disable-mips32r6', '', d)}"
137EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mips32r6', '--disable-mips64r2 --disable-mips32r2', '', d)}"
Patrick Williams213cb262021-08-07 19:21:33 -0500138EXTRA_OECONF:append:mips = " --extra-libs=-latomic --disable-mips32r5 --disable-mipsdsp --disable-mipsdspr2 \
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700139 --disable-loongson2 --disable-loongson3 --disable-mmi --disable-msa --disable-msa2"
Patrick Williams213cb262021-08-07 19:21:33 -0500140EXTRA_OECONF:append:riscv32 = " --extra-libs=-latomic"
141EXTRA_OECONF:append:armv5 = " --extra-libs=-latomic"
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700142
Andrew Geissler82c905d2020-04-13 13:39:40 -0500143# gold crashes on x86, another solution is to --disable-asm but thats more hacky
144# ld.gold: internal error in relocate_section, at ../../gold/i386.cc:3684
145
Patrick Williams213cb262021-08-07 19:21:33 -0500146LDFLAGS:append:x86 = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500147
148EXTRA_OEMAKE = "V=1"
149
150do_configure() {
151 ${S}/configure ${EXTRA_OECONF}
152}
153
Andrew Geissler09209ee2020-12-13 08:44:15 -0600154# patch out build host paths for reproducibility
Patrick Williams213cb262021-08-07 19:21:33 -0500155do_compile:prepend:class-target() {
Andrew Geissler09209ee2020-12-13 08:44:15 -0600156 sed -i -e "s,${WORKDIR},,g" ${B}/config.h
157}
158
Andrew Geissler82c905d2020-04-13 13:39:40 -0500159PACKAGES =+ "libavcodec \
160 libavdevice \
161 libavfilter \
162 libavformat \
163 libavresample \
164 libavutil \
165 libpostproc \
166 libswresample \
167 libswscale"
168
Patrick Williams213cb262021-08-07 19:21:33 -0500169FILES:libavcodec = "${libdir}/libavcodec${SOLIBS}"
170FILES:libavdevice = "${libdir}/libavdevice${SOLIBS}"
171FILES:libavfilter = "${libdir}/libavfilter${SOLIBS}"
172FILES:libavformat = "${libdir}/libavformat${SOLIBS}"
173FILES:libavresample = "${libdir}/libavresample${SOLIBS}"
174FILES:libavutil = "${libdir}/libavutil${SOLIBS}"
175FILES:libpostproc = "${libdir}/libpostproc${SOLIBS}"
176FILES:libswresample = "${libdir}/libswresample${SOLIBS}"
177FILES:libswscale = "${libdir}/libswscale${SOLIBS}"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500178
179# ffmpeg disables PIC on some platforms (e.g. x86-32)
Patrick Williams213cb262021-08-07 19:21:33 -0500180INSANE_SKIP:${MLPREFIX}libavcodec = "textrel"
181INSANE_SKIP:${MLPREFIX}libavdevice = "textrel"
182INSANE_SKIP:${MLPREFIX}libavfilter = "textrel"
183INSANE_SKIP:${MLPREFIX}libavformat = "textrel"
184INSANE_SKIP:${MLPREFIX}libavutil = "textrel"
185INSANE_SKIP:${MLPREFIX}libavresample = "textrel"
186INSANE_SKIP:${MLPREFIX}libswscale = "textrel"
187INSANE_SKIP:${MLPREFIX}libswresample = "textrel"
188INSANE_SKIP:${MLPREFIX}libpostproc = "textrel"