blob: 884973d237cb65ef54e031ec7ba69e2859c93512 [file] [log] [blame]
Brad Bishopc342db32019-05-15 21:57:59 -04001SUMMARY = "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 \
28 "
Brad Bishop96ff1982019-08-19 13:50:42 -040029SRC_URI[md5sum] = "5307931aeb7aaee5e1509d9996040661"
30SRC_URI[sha256sum] = "f1f049a82fcfbf156564e73a3935d7e750891fab2abf302e735104fd4050a7e1"
Brad Bishopc342db32019-05-15 21:57:59 -040031
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 = "alsa-lib zlib libogg nasm-native"
42
43inherit autotools pkgconfig
44
45PACKAGECONFIG ??= "avdevice avfilter avcodec avformat swresample swscale postproc avresample \
46 bzlib gpl lzma theora x264 \
Brad Bishop96ff1982019-08-19 13:50:42 -040047 ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xv xcb', '', d)}"
Brad Bishopc342db32019-05-15 21:57:59 -040048
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[bzlib] = "--enable-bzlib,--disable-bzlib,bzip2"
61PACKAGECONFIG[gpl] = "--enable-gpl,--disable-gpl"
62PACKAGECONFIG[gsm] = "--enable-libgsm,--disable-libgsm,libgsm"
63PACKAGECONFIG[jack] = "--enable-indev=jack,--disable-indev=jack,jack"
64PACKAGECONFIG[libvorbis] = "--enable-libvorbis,--disable-libvorbis,libvorbis"
65PACKAGECONFIG[lzma] = "--enable-lzma,--disable-lzma,xz"
Brad Bishop15ae2502019-06-18 21:44:24 -040066PACKAGECONFIG[mfx] = "--enable-libmfx,--disable-libmfx,intel-mediasdk"
Brad Bishopc342db32019-05-15 21:57:59 -040067PACKAGECONFIG[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[theora] = "--enable-libtheora,--disable-libtheora,libtheora"
72PACKAGECONFIG[vaapi] = "--enable-vaapi,--disable-vaapi,libva"
73PACKAGECONFIG[vdpau] = "--enable-vdpau,--disable-vdpau,libvdpau"
74PACKAGECONFIG[vpx] = "--enable-libvpx,--disable-libvpx,libvpx"
75PACKAGECONFIG[x264] = "--enable-libx264,--disable-libx264,x264"
Brad Bishop96ff1982019-08-19 13:50:42 -040076PACKAGECONFIG[xcb] = "--enable-libxcb,--disable-libxcb,libxcb"
Brad Bishopc342db32019-05-15 21:57:59 -040077PACKAGECONFIG[xv] = "--enable-outdev=xv,--disable-outdev=xv,libxv"
78
79# Check codecs that require --enable-nonfree
80USE_NONFREE = "${@bb.utils.contains_any('PACKAGECONFIG', [ 'openssl' ], 'yes', '', d)}"
81
82def cpu(d):
83 for arg in (d.getVar('TUNE_CCARGS') or '').split():
84 if arg.startswith('-mcpu='):
85 return arg[6:]
86 return 'generic'
87
88EXTRA_OECONF = " \
89 --disable-stripping \
90 --enable-pic \
91 --enable-shared \
92 --enable-pthreads \
Brad Bishopc342db32019-05-15 21:57:59 -040093 ${@bb.utils.contains('USE_NONFREE', 'yes', '--enable-nonfree', '', d)} \
94 \
95 --cross-prefix=${TARGET_PREFIX} \
96 \
97 --ld="${CCLD}" \
98 --cc="${CC}" \
99 --cxx="${CXX}" \
100 --arch=${TARGET_ARCH} \
101 --target-os="linux" \
102 --enable-cross-compile \
103 --extra-cflags="${TARGET_CFLAGS} ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" \
104 --extra-ldflags="${TARGET_LDFLAGS}" \
105 --sysroot="${STAGING_DIR_TARGET}" \
Brad Bishopc342db32019-05-15 21:57:59 -0400106 ${EXTRA_FFCONF} \
107 --libdir=${libdir} \
108 --shlibdir=${libdir} \
109 --datadir=${datadir}/ffmpeg \
110 ${@bb.utils.contains('AVAILTUNES', 'mips32r2', '', '--disable-mipsdsp --disable-mipsdspr2', d)} \
111 --cpu=${@cpu(d)} \
112 --pkg-config=pkg-config \
113"
114
115EXTRA_OECONF_append_linux-gnux32 = " --disable-asm"
116# gold crashes on x86, another solution is to --disable-asm but thats more hacky
117# ld.gold: internal error in relocate_section, at ../../gold/i386.cc:3684
118
119LDFLAGS_append_x86 = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}"
120
121do_configure() {
122 ${S}/configure ${EXTRA_OECONF}
123}
124
125PACKAGES =+ "libavcodec \
126 libavdevice \
127 libavfilter \
128 libavformat \
129 libavresample \
130 libavutil \
131 libpostproc \
132 libswresample \
133 libswscale"
134
135FILES_libavcodec = "${libdir}/libavcodec${SOLIBS}"
136FILES_libavdevice = "${libdir}/libavdevice${SOLIBS}"
137FILES_libavfilter = "${libdir}/libavfilter${SOLIBS}"
138FILES_libavformat = "${libdir}/libavformat${SOLIBS}"
139FILES_libavresample = "${libdir}/libavresample${SOLIBS}"
140FILES_libavutil = "${libdir}/libavutil${SOLIBS}"
141FILES_libpostproc = "${libdir}/libpostproc${SOLIBS}"
142FILES_libswresample = "${libdir}/libswresample${SOLIBS}"
143FILES_libswscale = "${libdir}/libswscale${SOLIBS}"
144
145# ffmpeg disables PIC on some platforms (e.g. x86-32)
146INSANE_SKIP_${MLPREFIX}libavcodec = "textrel"
147INSANE_SKIP_${MLPREFIX}libavdevice = "textrel"
148INSANE_SKIP_${MLPREFIX}libavfilter = "textrel"
149INSANE_SKIP_${MLPREFIX}libavformat = "textrel"
150INSANE_SKIP_${MLPREFIX}libavutil = "textrel"
151INSANE_SKIP_${MLPREFIX}libavresample = "textrel"
152INSANE_SKIP_${MLPREFIX}libswscale = "textrel"
153INSANE_SKIP_${MLPREFIX}libswresample = "textrel"
154INSANE_SKIP_${MLPREFIX}libpostproc = "textrel"