blob: ded8232713332d728e5406286bee8552dfaa130d [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
8LICENSE = "BSD & GPLv2+ & LGPLv2.1+ & MIT"
9LICENSE_${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)}"
19LICENSE_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 \
27 file://mips64_cpu_detection.patch \
Andrew Geissler6ce62a22020-11-30 19:58:47 -060028 file://0001-lavf-srt-fix-build-fail-when-used-the-libsrt-1.4.1.patch \
Andrew Geissler09209ee2020-12-13 08:44:15 -060029 file://0001-libavutil-include-assembly-with-full-path-from-sourc.patch \
Andrew Geisslerd1e89492021-02-12 15:35:20 -060030 file://CVE-2020-35964.patch \
31 file://CVE-2020-35965.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050032 "
Andrew Geisslerb7d28612020-07-24 16:15:54 -050033SRC_URI[sha256sum] = "ad009240d46e307b4e03a213a0f49c11b650e445b1f8be0dda2a9212b34d2ffb"
Andrew Geissler82c905d2020-04-13 13:39:40 -050034
35# Build fails when thumb is enabled: https://bugzilla.yoctoproject.org/show_bug.cgi?id=7717
36ARM_INSTRUCTION_SET_armv4 = "arm"
37ARM_INSTRUCTION_SET_armv5 = "arm"
38ARM_INSTRUCTION_SET_armv6 = "arm"
39
40# Should be API compatible with libav (which was a fork of ffmpeg)
41# libpostproc was previously packaged from a separate recipe
42PROVIDES = "libav libpostproc"
43
44DEPENDS = "nasm-native"
45
46inherit autotools pkgconfig
47
48PACKAGECONFIG ??= "avdevice avfilter avcodec avformat swresample swscale postproc avresample \
49 alsa bzlib gpl lzma theora x264 zlib \
50 ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xv xcb', '', d)}"
51
52# libraries to build in addition to avutil
53PACKAGECONFIG[avdevice] = "--enable-avdevice,--disable-avdevice"
54PACKAGECONFIG[avfilter] = "--enable-avfilter,--disable-avfilter"
55PACKAGECONFIG[avcodec] = "--enable-avcodec,--disable-avcodec"
56PACKAGECONFIG[avformat] = "--enable-avformat,--disable-avformat"
57PACKAGECONFIG[swresample] = "--enable-swresample,--disable-swresample"
58PACKAGECONFIG[swscale] = "--enable-swscale,--disable-swscale"
59PACKAGECONFIG[postproc] = "--enable-postproc,--disable-postproc"
60PACKAGECONFIG[avresample] = "--enable-avresample,--disable-avresample"
61
62# features to support
63PACKAGECONFIG[alsa] = "--enable-alsa,--disable-alsa,alsa-lib"
Andrew Geissler475cb722020-07-10 16:00:51 -050064PACKAGECONFIG[altivec] = "--enable-altivec,--disable-altivec,"
Andrew Geissler82c905d2020-04-13 13:39:40 -050065PACKAGECONFIG[bzlib] = "--enable-bzlib,--disable-bzlib,bzip2"
66PACKAGECONFIG[fdk-aac] = "--enable-libfdk-aac --enable-nonfree,--disable-libfdk-aac,fdk-aac"
67PACKAGECONFIG[gpl] = "--enable-gpl,--disable-gpl"
68PACKAGECONFIG[gsm] = "--enable-libgsm,--disable-libgsm,libgsm"
69PACKAGECONFIG[jack] = "--enable-indev=jack,--disable-indev=jack,jack"
70PACKAGECONFIG[libvorbis] = "--enable-libvorbis,--disable-libvorbis,libvorbis"
71PACKAGECONFIG[lzma] = "--enable-lzma,--disable-lzma,xz"
72PACKAGECONFIG[mfx] = "--enable-libmfx,--disable-libmfx,intel-mediasdk"
73PACKAGECONFIG[mp3lame] = "--enable-libmp3lame,--disable-libmp3lame,lame"
74PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl"
75PACKAGECONFIG[sdl2] = "--enable-sdl2,--disable-sdl2,virtual/libsdl2"
76PACKAGECONFIG[speex] = "--enable-libspeex,--disable-libspeex,speex"
Andrew Geissler6ce62a22020-11-30 19:58:47 -060077PACKAGECONFIG[srt] = "--enable-libsrt,--disable-libsrt,srt"
Andrew Geissler82c905d2020-04-13 13:39:40 -050078PACKAGECONFIG[theora] = "--enable-libtheora,--disable-libtheora,libtheora libogg"
79PACKAGECONFIG[vaapi] = "--enable-vaapi,--disable-vaapi,libva"
80PACKAGECONFIG[vdpau] = "--enable-vdpau,--disable-vdpau,libvdpau"
81PACKAGECONFIG[vpx] = "--enable-libvpx,--disable-libvpx,libvpx"
82PACKAGECONFIG[x264] = "--enable-libx264,--disable-libx264,x264"
83PACKAGECONFIG[x265] = "--enable-libx265,--disable-libx265,x265"
84PACKAGECONFIG[xcb] = "--enable-libxcb,--disable-libxcb,libxcb"
85PACKAGECONFIG[xv] = "--enable-outdev=xv,--disable-outdev=xv,libxv"
86PACKAGECONFIG[zlib] = "--enable-zlib,--disable-zlib,zlib"
87
88# Check codecs that require --enable-nonfree
89USE_NONFREE = "${@bb.utils.contains_any('PACKAGECONFIG', [ 'openssl' ], 'yes', '', d)}"
90
91def cpu(d):
92 for arg in (d.getVar('TUNE_CCARGS') or '').split():
93 if arg.startswith('-mcpu='):
94 return arg[6:]
95 return 'generic'
96
97EXTRA_OECONF = " \
98 --disable-stripping \
99 --enable-pic \
100 --enable-shared \
101 --enable-pthreads \
102 ${@bb.utils.contains('USE_NONFREE', 'yes', '--enable-nonfree', '', d)} \
103 \
104 --cross-prefix=${TARGET_PREFIX} \
105 \
106 --ld="${CCLD}" \
107 --cc="${CC}" \
108 --cxx="${CXX}" \
109 --arch=${TARGET_ARCH} \
110 --target-os="linux" \
111 --enable-cross-compile \
112 --extra-cflags="${CFLAGS} ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" \
113 --extra-ldflags="${LDFLAGS}" \
114 --sysroot="${STAGING_DIR_TARGET}" \
115 ${EXTRA_FFCONF} \
116 --libdir=${libdir} \
117 --shlibdir=${libdir} \
118 --datadir=${datadir}/ffmpeg \
119 ${@bb.utils.contains('AVAILTUNES', 'mips32r2', '', '--disable-mipsdsp --disable-mipsdspr2', d)} \
120 --cpu=${@cpu(d)} \
121 --pkg-config=pkg-config \
122"
123
124EXTRA_OECONF_append_linux-gnux32 = " --disable-asm"
125# gold crashes on x86, another solution is to --disable-asm but thats more hacky
126# ld.gold: internal error in relocate_section, at ../../gold/i386.cc:3684
127
128LDFLAGS_append_x86 = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}"
129
130EXTRA_OEMAKE = "V=1"
131
132do_configure() {
133 ${S}/configure ${EXTRA_OECONF}
134}
135
Andrew Geissler09209ee2020-12-13 08:44:15 -0600136# patch out build host paths for reproducibility
137do_compile_prepend_class-target() {
138 sed -i -e "s,${WORKDIR},,g" ${B}/config.h
139}
140
Andrew Geissler82c905d2020-04-13 13:39:40 -0500141PACKAGES =+ "libavcodec \
142 libavdevice \
143 libavfilter \
144 libavformat \
145 libavresample \
146 libavutil \
147 libpostproc \
148 libswresample \
149 libswscale"
150
151FILES_libavcodec = "${libdir}/libavcodec${SOLIBS}"
152FILES_libavdevice = "${libdir}/libavdevice${SOLIBS}"
153FILES_libavfilter = "${libdir}/libavfilter${SOLIBS}"
154FILES_libavformat = "${libdir}/libavformat${SOLIBS}"
155FILES_libavresample = "${libdir}/libavresample${SOLIBS}"
156FILES_libavutil = "${libdir}/libavutil${SOLIBS}"
157FILES_libpostproc = "${libdir}/libpostproc${SOLIBS}"
158FILES_libswresample = "${libdir}/libswresample${SOLIBS}"
159FILES_libswscale = "${libdir}/libswscale${SOLIBS}"
160
161# ffmpeg disables PIC on some platforms (e.g. x86-32)
162INSANE_SKIP_${MLPREFIX}libavcodec = "textrel"
163INSANE_SKIP_${MLPREFIX}libavdevice = "textrel"
164INSANE_SKIP_${MLPREFIX}libavfilter = "textrel"
165INSANE_SKIP_${MLPREFIX}libavformat = "textrel"
166INSANE_SKIP_${MLPREFIX}libavutil = "textrel"
167INSANE_SKIP_${MLPREFIX}libavresample = "textrel"
168INSANE_SKIP_${MLPREFIX}libswscale = "textrel"
169INSANE_SKIP_${MLPREFIX}libswresample = "textrel"
170INSANE_SKIP_${MLPREFIX}libpostproc = "textrel"