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