blob: 7d1af04047fa7f6528d5387fbf91a6bf0cc003d3 [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001SUMMARY = "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 file://CVE-2018-15822.patch \
29 "
30SRC_URI[md5sum] = "ae0bfdf809306a212b4f0e6eb8d1c75e"
31SRC_URI[sha256sum] = "a95c0cc9eb990e94031d2183f2e6e444cc61c99f6f182d1575c433d62afb2f97"
32
33# Build fails when thumb is enabled: https://bugzilla.yoctoproject.org/show_bug.cgi?id=7717
34ARM_INSTRUCTION_SET_armv4 = "arm"
35ARM_INSTRUCTION_SET_armv5 = "arm"
36ARM_INSTRUCTION_SET_armv6 = "arm"
37
38# Should be API compatible with libav (which was a fork of ffmpeg)
39# libpostproc was previously packaged from a separate recipe
40PROVIDES = "libav libpostproc"
41
42DEPENDS = "alsa-lib zlib libogg nasm-native"
43
44inherit autotools pkgconfig
45
46PACKAGECONFIG ??= "avdevice avfilter avcodec avformat swresample swscale postproc \
47 bzlib gpl lzma theora x264 \
48 ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xv', '', 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"
58PACKAGECONFIG[avresample] = "--enable-avresample,--disable-avresample"
59
60# features to support
61PACKAGECONFIG[bzlib] = "--enable-bzlib,--disable-bzlib,bzip2"
62PACKAGECONFIG[gpl] = "--enable-gpl,--disable-gpl"
63PACKAGECONFIG[gsm] = "--enable-libgsm,--disable-libgsm,libgsm"
64PACKAGECONFIG[jack] = "--enable-indev=jack,--disable-indev=jack,jack"
65PACKAGECONFIG[libvorbis] = "--enable-libvorbis,--disable-libvorbis,libvorbis"
66PACKAGECONFIG[lzma] = "--enable-lzma,--disable-lzma,xz"
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[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"
76PACKAGECONFIG[xv] = "--enable-outdev=xv,--disable-outdev=xv,libxv"
77
78# Check codecs that require --enable-nonfree
79USE_NONFREE = "${@bb.utils.contains_any('PACKAGECONFIG', [ 'openssl' ], 'yes', '', d)}"
80
81def cpu(d):
82 for arg in (d.getVar('TUNE_CCARGS') or '').split():
83 if arg.startswith('-mcpu='):
84 return arg[6:]
85 return 'generic'
86
87EXTRA_OECONF = " \
88 --disable-stripping \
89 --enable-pic \
90 --enable-shared \
91 --enable-pthreads \
92 --disable-libxcb \
93 --disable-libxcb-shm \
94 --disable-libxcb-xfixes \
95 --disable-libxcb-shape \
96 ${@bb.utils.contains('USE_NONFREE', 'yes', '--enable-nonfree', '', d)} \
97 \
98 --cross-prefix=${TARGET_PREFIX} \
99 \
100 --ld="${CCLD}" \
101 --cc="${CC}" \
102 --cxx="${CXX}" \
103 --arch=${TARGET_ARCH} \
104 --target-os="linux" \
105 --enable-cross-compile \
106 --extra-cflags="${TARGET_CFLAGS} ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" \
107 --extra-ldflags="${TARGET_LDFLAGS}" \
108 --sysroot="${STAGING_DIR_TARGET}" \
109 --enable-hardcoded-tables \
110 ${EXTRA_FFCONF} \
111 --libdir=${libdir} \
112 --shlibdir=${libdir} \
113 --datadir=${datadir}/ffmpeg \
114 ${@bb.utils.contains('AVAILTUNES', 'mips32r2', '', '--disable-mipsdsp --disable-mipsdspr2', d)} \
115 --cpu=${@cpu(d)} \
116 --pkg-config=pkg-config \
117"
118
119EXTRA_OECONF_append_linux-gnux32 = " --disable-asm"
120# gold crashes on x86, another solution is to --disable-asm but thats more hacky
121# ld.gold: internal error in relocate_section, at ../../gold/i386.cc:3684
122
123LDFLAGS_append_x86 = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}"
124
125do_configure() {
126 ${S}/configure ${EXTRA_OECONF}
127}
128
129PACKAGES =+ "libavcodec \
130 libavdevice \
131 libavfilter \
132 libavformat \
133 libavresample \
134 libavutil \
135 libpostproc \
136 libswresample \
137 libswscale"
138
139FILES_libavcodec = "${libdir}/libavcodec${SOLIBS}"
140FILES_libavdevice = "${libdir}/libavdevice${SOLIBS}"
141FILES_libavfilter = "${libdir}/libavfilter${SOLIBS}"
142FILES_libavformat = "${libdir}/libavformat${SOLIBS}"
143FILES_libavresample = "${libdir}/libavresample${SOLIBS}"
144FILES_libavutil = "${libdir}/libavutil${SOLIBS}"
145FILES_libpostproc = "${libdir}/libpostproc${SOLIBS}"
146FILES_libswresample = "${libdir}/libswresample${SOLIBS}"
147FILES_libswscale = "${libdir}/libswscale${SOLIBS}"
148
149# ffmpeg disables PIC on some platforms (e.g. x86-32)
150INSANE_SKIP_${MLPREFIX}libavcodec = "textrel"
151INSANE_SKIP_${MLPREFIX}libavdevice = "textrel"
152INSANE_SKIP_${MLPREFIX}libavfilter = "textrel"
153INSANE_SKIP_${MLPREFIX}libavformat = "textrel"
154INSANE_SKIP_${MLPREFIX}libavutil = "textrel"
155INSANE_SKIP_${MLPREFIX}libavresample = "textrel"
156INSANE_SKIP_${MLPREFIX}libswscale = "textrel"
157INSANE_SKIP_${MLPREFIX}libswresample = "textrel"
158INSANE_SKIP_${MLPREFIX}libpostproc = "textrel"