blob: 0c6af6549d695eeefd4ca7c1bfc552ed468eafa6 [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 \
Patrick Williams93c203f2021-10-06 16:15:23 -050034 file://fix-CVE-2021-38171.patch \
35 "
William A. Kennington IIIac69b482021-06-02 12:28:27 -070036SRC_URI[sha256sum] = "06b10a183ce5371f915c6bb15b7b1fffbe046e8275099c96affc29e17645d909"
Andrew Geissler82c905d2020-04-13 13:39:40 -050037
38# Build fails when thumb is enabled: https://bugzilla.yoctoproject.org/show_bug.cgi?id=7717
Patrick Williams213cb262021-08-07 19:21:33 -050039ARM_INSTRUCTION_SET:armv4 = "arm"
40ARM_INSTRUCTION_SET:armv5 = "arm"
41ARM_INSTRUCTION_SET:armv6 = "arm"
Andrew Geissler82c905d2020-04-13 13:39:40 -050042
43# Should be API compatible with libav (which was a fork of ffmpeg)
44# libpostproc was previously packaged from a separate recipe
45PROVIDES = "libav libpostproc"
46
47DEPENDS = "nasm-native"
48
49inherit autotools pkgconfig
50
51PACKAGECONFIG ??= "avdevice avfilter avcodec avformat swresample swscale postproc avresample \
Andrew Geissler95ac1b82021-03-31 14:34:31 -050052 alsa bzlib lzma pic pthreads shared theora zlib \
Andrew Geissler9b4d8b02021-02-19 12:26:16 -060053 ${@bb.utils.contains('AVAILTUNES', 'mips32r2', 'mips32r2', '', d)} \
Andrew Geissler82c905d2020-04-13 13:39:40 -050054 ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xv xcb', '', d)}"
55
56# libraries to build in addition to avutil
57PACKAGECONFIG[avdevice] = "--enable-avdevice,--disable-avdevice"
58PACKAGECONFIG[avfilter] = "--enable-avfilter,--disable-avfilter"
59PACKAGECONFIG[avcodec] = "--enable-avcodec,--disable-avcodec"
60PACKAGECONFIG[avformat] = "--enable-avformat,--disable-avformat"
61PACKAGECONFIG[swresample] = "--enable-swresample,--disable-swresample"
62PACKAGECONFIG[swscale] = "--enable-swscale,--disable-swscale"
63PACKAGECONFIG[postproc] = "--enable-postproc,--disable-postproc"
64PACKAGECONFIG[avresample] = "--enable-avresample,--disable-avresample"
65
66# features to support
67PACKAGECONFIG[alsa] = "--enable-alsa,--disable-alsa,alsa-lib"
Andrew Geissler475cb722020-07-10 16:00:51 -050068PACKAGECONFIG[altivec] = "--enable-altivec,--disable-altivec,"
Andrew Geissler82c905d2020-04-13 13:39:40 -050069PACKAGECONFIG[bzlib] = "--enable-bzlib,--disable-bzlib,bzip2"
70PACKAGECONFIG[fdk-aac] = "--enable-libfdk-aac --enable-nonfree,--disable-libfdk-aac,fdk-aac"
71PACKAGECONFIG[gpl] = "--enable-gpl,--disable-gpl"
72PACKAGECONFIG[gsm] = "--enable-libgsm,--disable-libgsm,libgsm"
73PACKAGECONFIG[jack] = "--enable-indev=jack,--disable-indev=jack,jack"
William A. Kennington IIIac69b482021-06-02 12:28:27 -070074PACKAGECONFIG[libopus] = "--enable-libopus,--disable-libopus,libopus"
Andrew Geissler82c905d2020-04-13 13:39:40 -050075PACKAGECONFIG[libvorbis] = "--enable-libvorbis,--disable-libvorbis,libvorbis"
76PACKAGECONFIG[lzma] = "--enable-lzma,--disable-lzma,xz"
77PACKAGECONFIG[mfx] = "--enable-libmfx,--disable-libmfx,intel-mediasdk"
78PACKAGECONFIG[mp3lame] = "--enable-libmp3lame,--disable-libmp3lame,lame"
79PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl"
80PACKAGECONFIG[sdl2] = "--enable-sdl2,--disable-sdl2,virtual/libsdl2"
81PACKAGECONFIG[speex] = "--enable-libspeex,--disable-libspeex,speex"
Andrew Geissler6ce62a22020-11-30 19:58:47 -060082PACKAGECONFIG[srt] = "--enable-libsrt,--disable-libsrt,srt"
Andrew Geissler82c905d2020-04-13 13:39:40 -050083PACKAGECONFIG[theora] = "--enable-libtheora,--disable-libtheora,libtheora libogg"
84PACKAGECONFIG[vaapi] = "--enable-vaapi,--disable-vaapi,libva"
85PACKAGECONFIG[vdpau] = "--enable-vdpau,--disable-vdpau,libvdpau"
86PACKAGECONFIG[vpx] = "--enable-libvpx,--disable-libvpx,libvpx"
87PACKAGECONFIG[x264] = "--enable-libx264,--disable-libx264,x264"
88PACKAGECONFIG[x265] = "--enable-libx265,--disable-libx265,x265"
89PACKAGECONFIG[xcb] = "--enable-libxcb,--disable-libxcb,libxcb"
90PACKAGECONFIG[xv] = "--enable-outdev=xv,--disable-outdev=xv,libxv"
91PACKAGECONFIG[zlib] = "--enable-zlib,--disable-zlib,zlib"
92
Andrew Geissler9b4d8b02021-02-19 12:26:16 -060093# other configuration options
94PACKAGECONFIG[mips32r2] = ",--disable-mipsdsp --disable-mipsdspr2"
95PACKAGECONFIG[pic] = "--enable-pic"
96PACKAGECONFIG[pthreads] = "--enable-pthreads,--disable-pthreads"
97PACKAGECONFIG[shared] = "--enable-shared"
98PACKAGECONFIG[strip] = ",--disable-stripping"
99
Andrew Geissler82c905d2020-04-13 13:39:40 -0500100# Check codecs that require --enable-nonfree
101USE_NONFREE = "${@bb.utils.contains_any('PACKAGECONFIG', [ 'openssl' ], 'yes', '', d)}"
102
103def cpu(d):
104 for arg in (d.getVar('TUNE_CCARGS') or '').split():
105 if arg.startswith('-mcpu='):
106 return arg[6:]
107 return 'generic'
108
109EXTRA_OECONF = " \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500110 ${@bb.utils.contains('USE_NONFREE', 'yes', '--enable-nonfree', '', d)} \
111 \
112 --cross-prefix=${TARGET_PREFIX} \
113 \
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700114 --ld='${CCLD}' \
115 --cc='${CC}' \
116 --cxx='${CXX}' \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500117 --arch=${TARGET_ARCH} \
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700118 --target-os='linux' \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500119 --enable-cross-compile \
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700120 --extra-cflags='${CFLAGS} ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}' \
121 --extra-ldflags='${LDFLAGS}' \
122 --sysroot='${STAGING_DIR_TARGET}' \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500123 ${EXTRA_FFCONF} \
124 --libdir=${libdir} \
125 --shlibdir=${libdir} \
126 --datadir=${datadir}/ffmpeg \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500127 --cpu=${@cpu(d)} \
128 --pkg-config=pkg-config \
129"
130
Patrick Williams213cb262021-08-07 19:21:33 -0500131EXTRA_OECONF:append:linux-gnux32 = " --disable-asm"
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700132
133EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mipsisa64r6', '--disable-mips64r2 --disable-mips32r2', '', d)}"
134EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mipsisa64r2', '--disable-mips64r6 --disable-mips32r6', '', d)}"
135EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mips32r2', '--disable-mips64r6 --disable-mips32r6', '', d)}"
136EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mips32r6', '--disable-mips64r2 --disable-mips32r2', '', d)}"
Patrick Williams213cb262021-08-07 19:21:33 -0500137EXTRA_OECONF:append:mips = " --extra-libs=-latomic --disable-mips32r5 --disable-mipsdsp --disable-mipsdspr2 \
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700138 --disable-loongson2 --disable-loongson3 --disable-mmi --disable-msa --disable-msa2"
Patrick Williams213cb262021-08-07 19:21:33 -0500139EXTRA_OECONF:append:riscv32 = " --extra-libs=-latomic"
140EXTRA_OECONF:append:armv5 = " --extra-libs=-latomic"
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700141
Andrew Geissler82c905d2020-04-13 13:39:40 -0500142# gold crashes on x86, another solution is to --disable-asm but thats more hacky
143# ld.gold: internal error in relocate_section, at ../../gold/i386.cc:3684
144
Patrick Williams213cb262021-08-07 19:21:33 -0500145LDFLAGS:append:x86 = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500146
147EXTRA_OEMAKE = "V=1"
148
149do_configure() {
150 ${S}/configure ${EXTRA_OECONF}
151}
152
Andrew Geissler09209ee2020-12-13 08:44:15 -0600153# patch out build host paths for reproducibility
Patrick Williams213cb262021-08-07 19:21:33 -0500154do_compile:prepend:class-target() {
Andrew Geissler09209ee2020-12-13 08:44:15 -0600155 sed -i -e "s,${WORKDIR},,g" ${B}/config.h
156}
157
Andrew Geissler82c905d2020-04-13 13:39:40 -0500158PACKAGES =+ "libavcodec \
159 libavdevice \
160 libavfilter \
161 libavformat \
162 libavresample \
163 libavutil \
164 libpostproc \
165 libswresample \
166 libswscale"
167
Patrick Williams213cb262021-08-07 19:21:33 -0500168FILES:libavcodec = "${libdir}/libavcodec${SOLIBS}"
169FILES:libavdevice = "${libdir}/libavdevice${SOLIBS}"
170FILES:libavfilter = "${libdir}/libavfilter${SOLIBS}"
171FILES:libavformat = "${libdir}/libavformat${SOLIBS}"
172FILES:libavresample = "${libdir}/libavresample${SOLIBS}"
173FILES:libavutil = "${libdir}/libavutil${SOLIBS}"
174FILES:libpostproc = "${libdir}/libpostproc${SOLIBS}"
175FILES:libswresample = "${libdir}/libswresample${SOLIBS}"
176FILES:libswscale = "${libdir}/libswscale${SOLIBS}"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500177
178# ffmpeg disables PIC on some platforms (e.g. x86-32)
Patrick Williams213cb262021-08-07 19:21:33 -0500179INSANE_SKIP:${MLPREFIX}libavcodec = "textrel"
180INSANE_SKIP:${MLPREFIX}libavdevice = "textrel"
181INSANE_SKIP:${MLPREFIX}libavfilter = "textrel"
182INSANE_SKIP:${MLPREFIX}libavformat = "textrel"
183INSANE_SKIP:${MLPREFIX}libavutil = "textrel"
184INSANE_SKIP:${MLPREFIX}libavresample = "textrel"
185INSANE_SKIP:${MLPREFIX}libswscale = "textrel"
186INSANE_SKIP:${MLPREFIX}libswresample = "textrel"
187INSANE_SKIP:${MLPREFIX}libpostproc = "textrel"