blob: 517dac7f051fc135b84668ed1350a5a1584128e2 [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 \
28 "
Andrew Geisslerb7d28612020-07-24 16:15:54 -050029SRC_URI[sha256sum] = "ad009240d46e307b4e03a213a0f49c11b650e445b1f8be0dda2a9212b34d2ffb"
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 \
45 alsa bzlib gpl lzma theora x264 zlib \
46 ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xv xcb', '', d)}"
47
48# libraries to build in addition to avutil
49PACKAGECONFIG[avdevice] = "--enable-avdevice,--disable-avdevice"
50PACKAGECONFIG[avfilter] = "--enable-avfilter,--disable-avfilter"
51PACKAGECONFIG[avcodec] = "--enable-avcodec,--disable-avcodec"
52PACKAGECONFIG[avformat] = "--enable-avformat,--disable-avformat"
53PACKAGECONFIG[swresample] = "--enable-swresample,--disable-swresample"
54PACKAGECONFIG[swscale] = "--enable-swscale,--disable-swscale"
55PACKAGECONFIG[postproc] = "--enable-postproc,--disable-postproc"
56PACKAGECONFIG[avresample] = "--enable-avresample,--disable-avresample"
57
58# features to support
59PACKAGECONFIG[alsa] = "--enable-alsa,--disable-alsa,alsa-lib"
Andrew Geissler475cb722020-07-10 16:00:51 -050060PACKAGECONFIG[altivec] = "--enable-altivec,--disable-altivec,"
Andrew Geissler82c905d2020-04-13 13:39:40 -050061PACKAGECONFIG[bzlib] = "--enable-bzlib,--disable-bzlib,bzip2"
62PACKAGECONFIG[fdk-aac] = "--enable-libfdk-aac --enable-nonfree,--disable-libfdk-aac,fdk-aac"
63PACKAGECONFIG[gpl] = "--enable-gpl,--disable-gpl"
64PACKAGECONFIG[gsm] = "--enable-libgsm,--disable-libgsm,libgsm"
65PACKAGECONFIG[jack] = "--enable-indev=jack,--disable-indev=jack,jack"
66PACKAGECONFIG[libvorbis] = "--enable-libvorbis,--disable-libvorbis,libvorbis"
67PACKAGECONFIG[lzma] = "--enable-lzma,--disable-lzma,xz"
68PACKAGECONFIG[mfx] = "--enable-libmfx,--disable-libmfx,intel-mediasdk"
69PACKAGECONFIG[mp3lame] = "--enable-libmp3lame,--disable-libmp3lame,lame"
70PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl"
71PACKAGECONFIG[sdl2] = "--enable-sdl2,--disable-sdl2,virtual/libsdl2"
72PACKAGECONFIG[speex] = "--enable-libspeex,--disable-libspeex,speex"
73PACKAGECONFIG[theora] = "--enable-libtheora,--disable-libtheora,libtheora libogg"
74PACKAGECONFIG[vaapi] = "--enable-vaapi,--disable-vaapi,libva"
75PACKAGECONFIG[vdpau] = "--enable-vdpau,--disable-vdpau,libvdpau"
76PACKAGECONFIG[vpx] = "--enable-libvpx,--disable-libvpx,libvpx"
77PACKAGECONFIG[x264] = "--enable-libx264,--disable-libx264,x264"
78PACKAGECONFIG[x265] = "--enable-libx265,--disable-libx265,x265"
79PACKAGECONFIG[xcb] = "--enable-libxcb,--disable-libxcb,libxcb"
80PACKAGECONFIG[xv] = "--enable-outdev=xv,--disable-outdev=xv,libxv"
81PACKAGECONFIG[zlib] = "--enable-zlib,--disable-zlib,zlib"
82
83# Check codecs that require --enable-nonfree
84USE_NONFREE = "${@bb.utils.contains_any('PACKAGECONFIG', [ 'openssl' ], 'yes', '', d)}"
85
86def cpu(d):
87 for arg in (d.getVar('TUNE_CCARGS') or '').split():
88 if arg.startswith('-mcpu='):
89 return arg[6:]
90 return 'generic'
91
92EXTRA_OECONF = " \
93 --disable-stripping \
94 --enable-pic \
95 --enable-shared \
96 --enable-pthreads \
97 ${@bb.utils.contains('USE_NONFREE', 'yes', '--enable-nonfree', '', d)} \
98 \
99 --cross-prefix=${TARGET_PREFIX} \
100 \
101 --ld="${CCLD}" \
102 --cc="${CC}" \
103 --cxx="${CXX}" \
104 --arch=${TARGET_ARCH} \
105 --target-os="linux" \
106 --enable-cross-compile \
107 --extra-cflags="${CFLAGS} ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" \
108 --extra-ldflags="${LDFLAGS}" \
109 --sysroot="${STAGING_DIR_TARGET}" \
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
125EXTRA_OEMAKE = "V=1"
126
127do_configure() {
128 ${S}/configure ${EXTRA_OECONF}
129}
130
131PACKAGES =+ "libavcodec \
132 libavdevice \
133 libavfilter \
134 libavformat \
135 libavresample \
136 libavutil \
137 libpostproc \
138 libswresample \
139 libswscale"
140
141FILES_libavcodec = "${libdir}/libavcodec${SOLIBS}"
142FILES_libavdevice = "${libdir}/libavdevice${SOLIBS}"
143FILES_libavfilter = "${libdir}/libavfilter${SOLIBS}"
144FILES_libavformat = "${libdir}/libavformat${SOLIBS}"
145FILES_libavresample = "${libdir}/libavresample${SOLIBS}"
146FILES_libavutil = "${libdir}/libavutil${SOLIBS}"
147FILES_libpostproc = "${libdir}/libpostproc${SOLIBS}"
148FILES_libswresample = "${libdir}/libswresample${SOLIBS}"
149FILES_libswscale = "${libdir}/libswscale${SOLIBS}"
150
151# ffmpeg disables PIC on some platforms (e.g. x86-32)
152INSANE_SKIP_${MLPREFIX}libavcodec = "textrel"
153INSANE_SKIP_${MLPREFIX}libavdevice = "textrel"
154INSANE_SKIP_${MLPREFIX}libavfilter = "textrel"
155INSANE_SKIP_${MLPREFIX}libavformat = "textrel"
156INSANE_SKIP_${MLPREFIX}libavutil = "textrel"
157INSANE_SKIP_${MLPREFIX}libavresample = "textrel"
158INSANE_SKIP_${MLPREFIX}libswscale = "textrel"
159INSANE_SKIP_${MLPREFIX}libswresample = "textrel"
160INSANE_SKIP_${MLPREFIX}libpostproc = "textrel"