blob: 3ed009bbb7f924e2dc3d9d623dec84871e49cba2 [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 \
Andrew Geissler09209ee2020-12-13 08:44:15 -060027 file://0001-libavutil-include-assembly-with-full-path-from-sourc.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050028 "
William A. Kennington IIIac69b482021-06-02 12:28:27 -070029SRC_URI[sha256sum] = "06b10a183ce5371f915c6bb15b7b1fffbe046e8275099c96affc29e17645d909"
Andrew Geissler82c905d2020-04-13 13:39:40 -050030
31# Build fails when thumb is enabled: https://bugzilla.yoctoproject.org/show_bug.cgi?id=7717
32ARM_INSTRUCTION_SET_armv4 = "arm"
33ARM_INSTRUCTION_SET_armv5 = "arm"
34ARM_INSTRUCTION_SET_armv6 = "arm"
35
36# Should be API compatible with libav (which was a fork of ffmpeg)
37# libpostproc was previously packaged from a separate recipe
38PROVIDES = "libav libpostproc"
39
40DEPENDS = "nasm-native"
41
42inherit autotools pkgconfig
43
44PACKAGECONFIG ??= "avdevice avfilter avcodec avformat swresample swscale postproc avresample \
Andrew Geissler95ac1b82021-03-31 14:34:31 -050045 alsa bzlib lzma pic pthreads shared theora zlib \
Andrew Geissler9b4d8b02021-02-19 12:26:16 -060046 ${@bb.utils.contains('AVAILTUNES', 'mips32r2', 'mips32r2', '', d)} \
Andrew Geissler82c905d2020-04-13 13:39:40 -050047 ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xv xcb', '', d)}"
48
49# libraries to build in addition to avutil
50PACKAGECONFIG[avdevice] = "--enable-avdevice,--disable-avdevice"
51PACKAGECONFIG[avfilter] = "--enable-avfilter,--disable-avfilter"
52PACKAGECONFIG[avcodec] = "--enable-avcodec,--disable-avcodec"
53PACKAGECONFIG[avformat] = "--enable-avformat,--disable-avformat"
54PACKAGECONFIG[swresample] = "--enable-swresample,--disable-swresample"
55PACKAGECONFIG[swscale] = "--enable-swscale,--disable-swscale"
56PACKAGECONFIG[postproc] = "--enable-postproc,--disable-postproc"
57PACKAGECONFIG[avresample] = "--enable-avresample,--disable-avresample"
58
59# features to support
60PACKAGECONFIG[alsa] = "--enable-alsa,--disable-alsa,alsa-lib"
Andrew Geissler475cb722020-07-10 16:00:51 -050061PACKAGECONFIG[altivec] = "--enable-altivec,--disable-altivec,"
Andrew Geissler82c905d2020-04-13 13:39:40 -050062PACKAGECONFIG[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"
William A. Kennington IIIac69b482021-06-02 12:28:27 -070067PACKAGECONFIG[libopus] = "--enable-libopus,--disable-libopus,libopus"
Andrew Geissler82c905d2020-04-13 13:39:40 -050068PACKAGECONFIG[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"
Andrew Geissler6ce62a22020-11-30 19:58:47 -060075PACKAGECONFIG[srt] = "--enable-libsrt,--disable-libsrt,srt"
Andrew Geissler82c905d2020-04-13 13:39:40 -050076PACKAGECONFIG[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
Andrew Geissler9b4d8b02021-02-19 12:26:16 -060086# 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
Andrew Geissler82c905d2020-04-13 13:39:40 -050093# 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 = " \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500103 ${@bb.utils.contains('USE_NONFREE', 'yes', '--enable-nonfree', '', d)} \
104 \
105 --cross-prefix=${TARGET_PREFIX} \
106 \
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700107 --ld='${CCLD}' \
108 --cc='${CC}' \
109 --cxx='${CXX}' \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500110 --arch=${TARGET_ARCH} \
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700111 --target-os='linux' \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500112 --enable-cross-compile \
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700113 --extra-cflags='${CFLAGS} ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}' \
114 --extra-ldflags='${LDFLAGS}' \
115 --sysroot='${STAGING_DIR_TARGET}' \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500116 ${EXTRA_FFCONF} \
117 --libdir=${libdir} \
118 --shlibdir=${libdir} \
119 --datadir=${datadir}/ffmpeg \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500120 --cpu=${@cpu(d)} \
121 --pkg-config=pkg-config \
122"
123
124EXTRA_OECONF_append_linux-gnux32 = " --disable-asm"
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700125
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 --disable-msa2"
Andrew Geissler09036742021-06-25 14:25:14 -0500132EXTRA_OECONF_append_riscv32 = " --extra-libs=-latomic"
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700133
Andrew Geissler82c905d2020-04-13 13:39:40 -0500134# gold crashes on x86, another solution is to --disable-asm but thats more hacky
135# ld.gold: internal error in relocate_section, at ../../gold/i386.cc:3684
136
137LDFLAGS_append_x86 = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}"
138
139EXTRA_OEMAKE = "V=1"
140
141do_configure() {
142 ${S}/configure ${EXTRA_OECONF}
143}
144
Andrew Geissler09209ee2020-12-13 08:44:15 -0600145# patch out build host paths for reproducibility
146do_compile_prepend_class-target() {
147 sed -i -e "s,${WORKDIR},,g" ${B}/config.h
148}
149
Andrew Geissler82c905d2020-04-13 13:39:40 -0500150PACKAGES =+ "libavcodec \
151 libavdevice \
152 libavfilter \
153 libavformat \
154 libavresample \
155 libavutil \
156 libpostproc \
157 libswresample \
158 libswscale"
159
160FILES_libavcodec = "${libdir}/libavcodec${SOLIBS}"
161FILES_libavdevice = "${libdir}/libavdevice${SOLIBS}"
162FILES_libavfilter = "${libdir}/libavfilter${SOLIBS}"
163FILES_libavformat = "${libdir}/libavformat${SOLIBS}"
164FILES_libavresample = "${libdir}/libavresample${SOLIBS}"
165FILES_libavutil = "${libdir}/libavutil${SOLIBS}"
166FILES_libpostproc = "${libdir}/libpostproc${SOLIBS}"
167FILES_libswresample = "${libdir}/libswresample${SOLIBS}"
168FILES_libswscale = "${libdir}/libswscale${SOLIBS}"
169
170# ffmpeg disables PIC on some platforms (e.g. x86-32)
171INSANE_SKIP_${MLPREFIX}libavcodec = "textrel"
172INSANE_SKIP_${MLPREFIX}libavdevice = "textrel"
173INSANE_SKIP_${MLPREFIX}libavfilter = "textrel"
174INSANE_SKIP_${MLPREFIX}libavformat = "textrel"
175INSANE_SKIP_${MLPREFIX}libavutil = "textrel"
176INSANE_SKIP_${MLPREFIX}libavresample = "textrel"
177INSANE_SKIP_${MLPREFIX}libswscale = "textrel"
178INSANE_SKIP_${MLPREFIX}libswresample = "textrel"
179INSANE_SKIP_${MLPREFIX}libpostproc = "textrel"