blob: 72c2fe16ecd2a466075b8000514c35ea68ca4381 [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 Geissler82c905d2020-04-13 13:39:40 -050029 "
Andrew Geisslerb7d28612020-07-24 16:15:54 -050030SRC_URI[sha256sum] = "ad009240d46e307b4e03a213a0f49c11b650e445b1f8be0dda2a9212b34d2ffb"
Andrew Geissler82c905d2020-04-13 13:39:40 -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 avresample \
46 alsa bzlib gpl lzma theora x264 zlib \
47 ${@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"
67PACKAGECONFIG[libvorbis] = "--enable-libvorbis,--disable-libvorbis,libvorbis"
68PACKAGECONFIG[lzma] = "--enable-lzma,--disable-lzma,xz"
69PACKAGECONFIG[mfx] = "--enable-libmfx,--disable-libmfx,intel-mediasdk"
70PACKAGECONFIG[mp3lame] = "--enable-libmp3lame,--disable-libmp3lame,lame"
71PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl"
72PACKAGECONFIG[sdl2] = "--enable-sdl2,--disable-sdl2,virtual/libsdl2"
73PACKAGECONFIG[speex] = "--enable-libspeex,--disable-libspeex,speex"
Andrew Geissler6ce62a22020-11-30 19:58:47 -060074PACKAGECONFIG[srt] = "--enable-libsrt,--disable-libsrt,srt"
Andrew Geissler82c905d2020-04-13 13:39:40 -050075PACKAGECONFIG[theora] = "--enable-libtheora,--disable-libtheora,libtheora libogg"
76PACKAGECONFIG[vaapi] = "--enable-vaapi,--disable-vaapi,libva"
77PACKAGECONFIG[vdpau] = "--enable-vdpau,--disable-vdpau,libvdpau"
78PACKAGECONFIG[vpx] = "--enable-libvpx,--disable-libvpx,libvpx"
79PACKAGECONFIG[x264] = "--enable-libx264,--disable-libx264,x264"
80PACKAGECONFIG[x265] = "--enable-libx265,--disable-libx265,x265"
81PACKAGECONFIG[xcb] = "--enable-libxcb,--disable-libxcb,libxcb"
82PACKAGECONFIG[xv] = "--enable-outdev=xv,--disable-outdev=xv,libxv"
83PACKAGECONFIG[zlib] = "--enable-zlib,--disable-zlib,zlib"
84
85# Check codecs that require --enable-nonfree
86USE_NONFREE = "${@bb.utils.contains_any('PACKAGECONFIG', [ 'openssl' ], 'yes', '', d)}"
87
88def cpu(d):
89 for arg in (d.getVar('TUNE_CCARGS') or '').split():
90 if arg.startswith('-mcpu='):
91 return arg[6:]
92 return 'generic'
93
94EXTRA_OECONF = " \
95 --disable-stripping \
96 --enable-pic \
97 --enable-shared \
98 --enable-pthreads \
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 ${@bb.utils.contains('AVAILTUNES', 'mips32r2', '', '--disable-mipsdsp --disable-mipsdspr2', d)} \
117 --cpu=${@cpu(d)} \
118 --pkg-config=pkg-config \
119"
120
121EXTRA_OECONF_append_linux-gnux32 = " --disable-asm"
122# gold crashes on x86, another solution is to --disable-asm but thats more hacky
123# ld.gold: internal error in relocate_section, at ../../gold/i386.cc:3684
124
125LDFLAGS_append_x86 = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}"
126
127EXTRA_OEMAKE = "V=1"
128
129do_configure() {
130 ${S}/configure ${EXTRA_OECONF}
131}
132
133PACKAGES =+ "libavcodec \
134 libavdevice \
135 libavfilter \
136 libavformat \
137 libavresample \
138 libavutil \
139 libpostproc \
140 libswresample \
141 libswscale"
142
143FILES_libavcodec = "${libdir}/libavcodec${SOLIBS}"
144FILES_libavdevice = "${libdir}/libavdevice${SOLIBS}"
145FILES_libavfilter = "${libdir}/libavfilter${SOLIBS}"
146FILES_libavformat = "${libdir}/libavformat${SOLIBS}"
147FILES_libavresample = "${libdir}/libavresample${SOLIBS}"
148FILES_libavutil = "${libdir}/libavutil${SOLIBS}"
149FILES_libpostproc = "${libdir}/libpostproc${SOLIBS}"
150FILES_libswresample = "${libdir}/libswresample${SOLIBS}"
151FILES_libswscale = "${libdir}/libswscale${SOLIBS}"
152
153# ffmpeg disables PIC on some platforms (e.g. x86-32)
154INSANE_SKIP_${MLPREFIX}libavcodec = "textrel"
155INSANE_SKIP_${MLPREFIX}libavdevice = "textrel"
156INSANE_SKIP_${MLPREFIX}libavfilter = "textrel"
157INSANE_SKIP_${MLPREFIX}libavformat = "textrel"
158INSANE_SKIP_${MLPREFIX}libavutil = "textrel"
159INSANE_SKIP_${MLPREFIX}libavresample = "textrel"
160INSANE_SKIP_${MLPREFIX}libswscale = "textrel"
161INSANE_SKIP_${MLPREFIX}libswresample = "textrel"
162INSANE_SKIP_${MLPREFIX}libpostproc = "textrel"