blob: 0f67c9e9490415bbe7215fa6c992c33311a14593 [file] [log] [blame]
Patrick Williams92b42cb2022-09-03 06:53:57 -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 = "GPL-2.0-or-later & LGPL-2.1-or-later & ISC & MIT & BSD-2-Clause & BSD-3-Clause & IJG"
9LICENSE:${PN} = "GPL-2.0-or-later"
10LICENSE:libavcodec = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}"
11LICENSE:libavdevice = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}"
12LICENSE:libavfilter = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}"
13LICENSE:libavformat = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}"
14LICENSE:libavutil = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}"
15LICENSE:libpostproc = "GPL-2.0-or-later"
16LICENSE:libswresample = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}"
17LICENSE:libswscale = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}"
18LICENSE_FLAGS = "commercial"
19
20LIC_FILES_CHKSUM = "file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
21 file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \
22 file://COPYING.LGPLv2.1;md5=bd7a443320af8c812e4c18d1b79df004 \
23 file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02"
24
Andrew Geissler517393d2023-01-13 08:55:19 -060025SRC_URI = "https://www.ffmpeg.org/releases/${BP}.tar.xz \
26 file://0001-avcodec-rpzaenc-stop-accessing-out-of-bounds-frame.patch \
27 file://0001-avcodec-smcenc-stop-accessing-out-of-bounds-frame.patch \
28 "
29
Patrick Williams7784c422022-11-17 07:29:11 -060030SRC_URI[sha256sum] = "619e706d662c8420859832ddc259cd4d4096a48a2ce1eefd052db9e440eef3dc"
Patrick Williams92b42cb2022-09-03 06:53:57 -050031
32# Build fails when thumb is enabled: https://bugzilla.yoctoproject.org/show_bug.cgi?id=7717
33ARM_INSTRUCTION_SET:armv4 = "arm"
34ARM_INSTRUCTION_SET:armv5 = "arm"
35ARM_INSTRUCTION_SET:armv6 = "arm"
36
37# Should be API compatible with libav (which was a fork of ffmpeg)
38# libpostproc was previously packaged from a separate recipe
39PROVIDES = "libav libpostproc"
40
41DEPENDS = "nasm-native"
42
43inherit autotools pkgconfig
44
45PACKAGECONFIG ??= "avdevice avfilter avcodec avformat swresample swscale postproc \
46 alsa bzlib lzma pic pthreads shared theora zlib \
47 ${@bb.utils.contains('AVAILTUNES', 'mips32r2', 'mips32r2', '', d)} \
48 ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xv xcb', '', d)}"
49
50# libraries to build in addition to avutil
51PACKAGECONFIG[avdevice] = "--enable-avdevice,--disable-avdevice"
52PACKAGECONFIG[avfilter] = "--enable-avfilter,--disable-avfilter"
53PACKAGECONFIG[avcodec] = "--enable-avcodec,--disable-avcodec"
54PACKAGECONFIG[avformat] = "--enable-avformat,--disable-avformat"
55PACKAGECONFIG[swresample] = "--enable-swresample,--disable-swresample"
56PACKAGECONFIG[swscale] = "--enable-swscale,--disable-swscale"
57PACKAGECONFIG[postproc] = "--enable-postproc,--disable-postproc"
58
59# features to support
60PACKAGECONFIG[alsa] = "--enable-alsa,--disable-alsa,alsa-lib"
61PACKAGECONFIG[altivec] = "--enable-altivec,--disable-altivec,"
62PACKAGECONFIG[bzlib] = "--enable-bzlib,--disable-bzlib,bzip2"
63PACKAGECONFIG[fdk-aac] = "--enable-libfdk-aac --enable-nonfree,--disable-libfdk-aac,fdk-aac"
64PACKAGECONFIG[gpl] = "--enable-gpl,--disable-gpl"
65PACKAGECONFIG[gsm] = "--enable-libgsm,--disable-libgsm,libgsm"
66PACKAGECONFIG[jack] = "--enable-indev=jack,--disable-indev=jack,jack"
67PACKAGECONFIG[libopus] = "--enable-libopus,--disable-libopus,libopus"
68PACKAGECONFIG[libvorbis] = "--enable-libvorbis,--disable-libvorbis,libvorbis"
69PACKAGECONFIG[lzma] = "--enable-lzma,--disable-lzma,xz"
70PACKAGECONFIG[mfx] = "--enable-libmfx,--disable-libmfx,intel-mediasdk"
71PACKAGECONFIG[mp3lame] = "--enable-libmp3lame,--disable-libmp3lame,lame"
72PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl"
73PACKAGECONFIG[sdl2] = "--enable-sdl2,--disable-sdl2,virtual/libsdl2"
74PACKAGECONFIG[speex] = "--enable-libspeex,--disable-libspeex,speex"
75PACKAGECONFIG[srt] = "--enable-libsrt,--disable-libsrt,srt"
76PACKAGECONFIG[theora] = "--enable-libtheora,--disable-libtheora,libtheora libogg"
77PACKAGECONFIG[vaapi] = "--enable-vaapi,--disable-vaapi,libva"
78PACKAGECONFIG[vdpau] = "--enable-vdpau,--disable-vdpau,libvdpau"
79PACKAGECONFIG[vpx] = "--enable-libvpx,--disable-libvpx,libvpx"
80PACKAGECONFIG[x264] = "--enable-libx264,--disable-libx264,x264"
81PACKAGECONFIG[x265] = "--enable-libx265,--disable-libx265,x265"
82PACKAGECONFIG[xcb] = "--enable-libxcb,--disable-libxcb,libxcb"
83PACKAGECONFIG[xv] = "--enable-outdev=xv,--disable-outdev=xv,libxv"
84PACKAGECONFIG[zlib] = "--enable-zlib,--disable-zlib,zlib"
85
86# other configuration options
87PACKAGECONFIG[mips32r2] = ",--disable-mipsdsp --disable-mipsdspr2"
88PACKAGECONFIG[pic] = "--enable-pic"
89PACKAGECONFIG[pthreads] = "--enable-pthreads,--disable-pthreads"
90PACKAGECONFIG[shared] = "--enable-shared"
91PACKAGECONFIG[strip] = ",--disable-stripping"
92
93# Check codecs that require --enable-nonfree
94USE_NONFREE = "${@bb.utils.contains_any('PACKAGECONFIG', [ 'openssl' ], 'yes', '', d)}"
95
96def cpu(d):
97 for arg in (d.getVar('TUNE_CCARGS') or '').split():
98 if arg.startswith('-mcpu='):
99 return arg[6:]
100 return 'generic'
101
102EXTRA_OECONF = " \
103 ${@bb.utils.contains('USE_NONFREE', 'yes', '--enable-nonfree', '', d)} \
104 \
105 --cross-prefix=${TARGET_PREFIX} \
106 \
107 --ld='${CCLD}' \
108 --cc='${CC}' \
109 --cxx='${CXX}' \
110 --arch=${TARGET_ARCH} \
111 --target-os='linux' \
112 --enable-cross-compile \
113 --extra-cflags='${CFLAGS} ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}' \
114 --extra-ldflags='${LDFLAGS}' \
115 --sysroot='${STAGING_DIR_TARGET}' \
116 ${EXTRA_FFCONF} \
117 --libdir=${libdir} \
118 --shlibdir=${libdir} \
119 --datadir=${datadir}/ffmpeg \
120 --cpu=${@cpu(d)} \
121 --pkg-config=pkg-config \
122"
123
124EXTRA_OECONF:append:linux-gnux32 = " --disable-asm"
125
126EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mipsisa64r6', '--disable-mips64r2 --disable-mips32r2', '', d)}"
127EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mipsisa64r2', '--disable-mips64r6 --disable-mips32r6', '', d)}"
128EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mips32r2', '--disable-mips64r6 --disable-mips32r6', '', d)}"
129EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mips32r6', '--disable-mips64r2 --disable-mips32r2', '', d)}"
130EXTRA_OECONF:append:mips = " --extra-libs=-latomic --disable-mips32r5 --disable-mipsdsp --disable-mipsdspr2 \
131 --disable-loongson2 --disable-loongson3 --disable-mmi --disable-msa"
132EXTRA_OECONF:append:riscv32 = " --extra-libs=-latomic"
133EXTRA_OECONF:append:armv5 = " --extra-libs=-latomic"
134EXTRA_OECONF:append:powerpc = " --extra-libs=-latomic"
135
136# gold crashes on x86, another solution is to --disable-asm but thats more hacky
137# ld.gold: internal error in relocate_section, at ../../gold/i386.cc:3684
138
139LDFLAGS:append:x86 = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}"
140
141EXTRA_OEMAKE = "V=1"
142
143do_configure() {
144 ${S}/configure ${EXTRA_OECONF}
Andrew Geissler517393d2023-01-13 08:55:19 -0600145 sed -i -e "s,^X86ASMFLAGS=.*,& --debug-prefix-map=${S}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} --debug-prefix-map=${B}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR},g" ${B}/ffbuild/config.mak
Patrick Williams92b42cb2022-09-03 06:53:57 -0500146}
147
148# patch out build host paths for reproducibility
149do_compile:prepend:class-target() {
150 sed -i -e "s,${WORKDIR},,g" ${B}/config.h
151}
152
153PACKAGES =+ "libavcodec \
154 libavdevice \
155 libavfilter \
156 libavformat \
157 libavutil \
158 libpostproc \
159 libswresample \
160 libswscale"
161
162FILES:libavcodec = "${libdir}/libavcodec${SOLIBS}"
163FILES:libavdevice = "${libdir}/libavdevice${SOLIBS}"
164FILES:libavfilter = "${libdir}/libavfilter${SOLIBS}"
165FILES:libavformat = "${libdir}/libavformat${SOLIBS}"
166FILES:libavutil = "${libdir}/libavutil${SOLIBS}"
167FILES:libpostproc = "${libdir}/libpostproc${SOLIBS}"
168FILES:libswresample = "${libdir}/libswresample${SOLIBS}"
169FILES:libswscale = "${libdir}/libswscale${SOLIBS}"
170
171# ffmpeg disables PIC on some platforms (e.g. x86-32)
172INSANE_SKIP:${MLPREFIX}libavcodec = "textrel"
173INSANE_SKIP:${MLPREFIX}libavdevice = "textrel"
174INSANE_SKIP:${MLPREFIX}libavfilter = "textrel"
175INSANE_SKIP:${MLPREFIX}libavformat = "textrel"
176INSANE_SKIP:${MLPREFIX}libavutil = "textrel"
177INSANE_SKIP:${MLPREFIX}libswscale = "textrel"
178INSANE_SKIP:${MLPREFIX}libswresample = "textrel"
179INSANE_SKIP:${MLPREFIX}libpostproc = "textrel"