blob: e837a05d47051bcf5c565be038acac4d0a88dc73 [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 Geissler5a43b432020-06-13 10:46:56 -050029SRC_URI[sha256sum] = "9df6c90aed1337634c1fb026fb01c154c29c82a64ea71291ff2da9aacb9aad31"
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"
60PACKAGECONFIG[bzlib] = "--enable-bzlib,--disable-bzlib,bzip2"
61PACKAGECONFIG[fdk-aac] = "--enable-libfdk-aac --enable-nonfree,--disable-libfdk-aac,fdk-aac"
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[mfx] = "--enable-libmfx,--disable-libmfx,intel-mediasdk"
68PACKAGECONFIG[mp3lame] = "--enable-libmp3lame,--disable-libmp3lame,lame"
69PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl"
70PACKAGECONFIG[sdl2] = "--enable-sdl2,--disable-sdl2,virtual/libsdl2"
71PACKAGECONFIG[speex] = "--enable-libspeex,--disable-libspeex,speex"
72PACKAGECONFIG[theora] = "--enable-libtheora,--disable-libtheora,libtheora libogg"
73PACKAGECONFIG[vaapi] = "--enable-vaapi,--disable-vaapi,libva"
74PACKAGECONFIG[vdpau] = "--enable-vdpau,--disable-vdpau,libvdpau"
75PACKAGECONFIG[vpx] = "--enable-libvpx,--disable-libvpx,libvpx"
76PACKAGECONFIG[x264] = "--enable-libx264,--disable-libx264,x264"
77PACKAGECONFIG[x265] = "--enable-libx265,--disable-libx265,x265"
78PACKAGECONFIG[xcb] = "--enable-libxcb,--disable-libxcb,libxcb"
79PACKAGECONFIG[xv] = "--enable-outdev=xv,--disable-outdev=xv,libxv"
80PACKAGECONFIG[zlib] = "--enable-zlib,--disable-zlib,zlib"
81
82# Check codecs that require --enable-nonfree
83USE_NONFREE = "${@bb.utils.contains_any('PACKAGECONFIG', [ 'openssl' ], 'yes', '', d)}"
84
85def cpu(d):
86 for arg in (d.getVar('TUNE_CCARGS') or '').split():
87 if arg.startswith('-mcpu='):
88 return arg[6:]
89 return 'generic'
90
91EXTRA_OECONF = " \
92 --disable-stripping \
93 --enable-pic \
94 --enable-shared \
95 --enable-pthreads \
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="${CFLAGS} ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" \
107 --extra-ldflags="${LDFLAGS}" \
108 --sysroot="${STAGING_DIR_TARGET}" \
109 ${EXTRA_FFCONF} \
110 --libdir=${libdir} \
111 --shlibdir=${libdir} \
112 --datadir=${datadir}/ffmpeg \
113 ${@bb.utils.contains('AVAILTUNES', 'mips32r2', '', '--disable-mipsdsp --disable-mipsdspr2', d)} \
114 --cpu=${@cpu(d)} \
115 --pkg-config=pkg-config \
116"
117
118EXTRA_OECONF_append_linux-gnux32 = " --disable-asm"
119# gold crashes on x86, another solution is to --disable-asm but thats more hacky
120# ld.gold: internal error in relocate_section, at ../../gold/i386.cc:3684
121
122LDFLAGS_append_x86 = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}"
123
124EXTRA_OEMAKE = "V=1"
125
126do_configure() {
127 ${S}/configure ${EXTRA_OECONF}
128}
129
130PACKAGES =+ "libavcodec \
131 libavdevice \
132 libavfilter \
133 libavformat \
134 libavresample \
135 libavutil \
136 libpostproc \
137 libswresample \
138 libswscale"
139
140FILES_libavcodec = "${libdir}/libavcodec${SOLIBS}"
141FILES_libavdevice = "${libdir}/libavdevice${SOLIBS}"
142FILES_libavfilter = "${libdir}/libavfilter${SOLIBS}"
143FILES_libavformat = "${libdir}/libavformat${SOLIBS}"
144FILES_libavresample = "${libdir}/libavresample${SOLIBS}"
145FILES_libavutil = "${libdir}/libavutil${SOLIBS}"
146FILES_libpostproc = "${libdir}/libpostproc${SOLIBS}"
147FILES_libswresample = "${libdir}/libswresample${SOLIBS}"
148FILES_libswscale = "${libdir}/libswscale${SOLIBS}"
149
150# ffmpeg disables PIC on some platforms (e.g. x86-32)
151INSANE_SKIP_${MLPREFIX}libavcodec = "textrel"
152INSANE_SKIP_${MLPREFIX}libavdevice = "textrel"
153INSANE_SKIP_${MLPREFIX}libavfilter = "textrel"
154INSANE_SKIP_${MLPREFIX}libavformat = "textrel"
155INSANE_SKIP_${MLPREFIX}libavutil = "textrel"
156INSANE_SKIP_${MLPREFIX}libavresample = "textrel"
157INSANE_SKIP_${MLPREFIX}libswscale = "textrel"
158INSANE_SKIP_${MLPREFIX}libswresample = "textrel"
159INSANE_SKIP_${MLPREFIX}libpostproc = "textrel"