ffmpeg_5.1.2.bb 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. SUMMARY = "A complete, cross-platform solution to record, convert and stream audio and video."
  2. DESCRIPTION = "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."
  5. HOMEPAGE = "https://www.ffmpeg.org/"
  6. SECTION = "libs"
  7. LICENSE = "GPL-2.0-or-later & LGPL-2.1-or-later & ISC & MIT & BSD-2-Clause & BSD-3-Clause & IJG"
  8. LICENSE:${PN} = "GPL-2.0-or-later"
  9. LICENSE:libavcodec = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}"
  10. LICENSE:libavdevice = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}"
  11. LICENSE:libavfilter = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}"
  12. LICENSE:libavformat = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}"
  13. LICENSE:libavutil = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}"
  14. LICENSE:libpostproc = "GPL-2.0-or-later"
  15. LICENSE:libswresample = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}"
  16. LICENSE:libswscale = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}"
  17. LICENSE_FLAGS = "commercial"
  18. LIC_FILES_CHKSUM = "file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
  19. file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \
  20. file://COPYING.LGPLv2.1;md5=bd7a443320af8c812e4c18d1b79df004 \
  21. file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02"
  22. S = "${WORKDIR}/${BP}"
  23. FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
  24. SRC_URI += " \
  25. https://www.ffmpeg.org/releases/${BP}.tar.xz \
  26. file://0001-Add-sf-extra-folder.patch \
  27. file://0001-hwcontext_vulkan-remove-optional-encode-decode-exten.patch \
  28. file://0005-avcodec-add-omx-decoder-support.patch \
  29. file://0006-add-hevc-decoder-and-encoder-support.patch \
  30. file://0007-avcoder-fix-decoder-bug.patch \
  31. file://0008-fix-omx-decoder-setting-pix-fmt-bug.patch \
  32. file://0009-ffmpeg-add-mjpeg-decoder-support-and-fix-some-bug.patch \
  33. file://0010-ffmpeg-support-to-change-gop.patch \
  34. file://0011-ffmpeg-add-delay-for-decoding.patch \
  35. file://0012-ffmpeg-add-omx_pix_fmt.patch \
  36. file://0013-ffmpeg-replace-the-indent-with-space.patch \
  37. file://0014-ffmpeg-add-pixel-foramt.patch \
  38. file://0015-ffmpeg-remove-delay.patch \
  39. file://0016-FFmpeg-omx-add-scale-option-for-omx.patch \
  40. file://0017-FFmpeg-omxdec-add-mirror-rotation-and-crop-option.patch \
  41. file://0018-FFmpeg-omx-gop-parameter-of-hevc-encoder.patch \
  42. file://0019-FFmpeg-omcdec-fix-mjpeg_omx-decoder-scale-option-bug.patch \
  43. file://0020-FFmpeg-omxdec-modify-the-range-of-width-and-height-o.patch \
  44. file://0021-FFmpeg-omxdec-set-pts-of-avframe-and-fix-some-compil.patch \
  45. file://0022-FFmpeg-enable-internal-optimize.patch \
  46. file://0023-FFmpeg_upstream_AVCodec_struct_to_FFCodec.patch \
  47. file://0024-FFmpeg-optimize-copy-for-omxdec.patch \
  48. file://0025-FFmpeg-fix-pts-incorrect.patch \
  49. "
  50. SRC_URI[sha256sum] = "619e706d662c8420859832ddc259cd4d4096a48a2ce1eefd052db9e440eef3dc"
  51. # Build fails when thumb is enabled: https://bugzilla.yoctoproject.org/show_bug.cgi?id=7717
  52. ARM_INSTRUCTION_SET:armv4 = "arm"
  53. ARM_INSTRUCTION_SET:armv5 = "arm"
  54. ARM_INSTRUCTION_SET:armv6 = "arm"
  55. # Should be API compatible with libav (which was a fork of ffmpeg)
  56. # libpostproc was previously packaged from a separate recipe
  57. PROVIDES = "libav libpostproc"
  58. DEPENDS = "nasm-native"
  59. inherit autotools pkgconfig
  60. PACKAGECONFIG ??= " \
  61. avdevice avfilter avcodec avformat swresample swscale postproc \
  62. alsa bzlib lzma pic pthreads shared theora zlib \
  63. ${@bb.utils.contains('AVAILTUNES', 'mips32r2', 'mips32r2', '', d)} \
  64. ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xv xcb', '', d)} \
  65. gpl mp3lame libopus speex srt theora libvorbis vpx omx sdl2 \
  66. "
  67. # libraries to build in addition to avutil
  68. PACKAGECONFIG[avdevice] = "--enable-avdevice,--disable-avdevice"
  69. PACKAGECONFIG[avfilter] = "--enable-avfilter,--disable-avfilter"
  70. PACKAGECONFIG[avcodec] = "--enable-avcodec,--disable-avcodec"
  71. PACKAGECONFIG[avformat] = "--enable-avformat,--disable-avformat"
  72. PACKAGECONFIG[swresample] = "--enable-swresample,--disable-swresample"
  73. PACKAGECONFIG[swscale] = "--enable-swscale,--disable-swscale"
  74. PACKAGECONFIG[postproc] = "--enable-postproc,--disable-postproc"
  75. PACKAGECONFIG[omx] = "--enable-omx,--disable-omx"
  76. # features to support
  77. PACKAGECONFIG[alsa] = "--enable-alsa,--disable-alsa,alsa-lib"
  78. PACKAGECONFIG[altivec] = "--enable-altivec,--disable-altivec,"
  79. PACKAGECONFIG[bzlib] = "--enable-bzlib,--disable-bzlib,bzip2"
  80. PACKAGECONFIG[fdk-aac] = "--enable-libfdk-aac --enable-nonfree,--disable-libfdk-aac,fdk-aac"
  81. PACKAGECONFIG[gpl] = "--enable-gpl,--disable-gpl"
  82. PACKAGECONFIG[gsm] = "--enable-libgsm,--disable-libgsm,libgsm"
  83. PACKAGECONFIG[jack] = "--enable-indev=jack,--disable-indev=jack,jack"
  84. PACKAGECONFIG[libopus] = "--enable-libopus,--disable-libopus,libopus"
  85. PACKAGECONFIG[libvorbis] = "--enable-libvorbis,--disable-libvorbis,libvorbis"
  86. PACKAGECONFIG[lzma] = "--enable-lzma,--disable-lzma,xz"
  87. PACKAGECONFIG[mfx] = "--enable-libmfx,--disable-libmfx,intel-mediasdk"
  88. PACKAGECONFIG[mp3lame] = "--enable-libmp3lame,--disable-libmp3lame,lame"
  89. PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl"
  90. PACKAGECONFIG[sdl2] = "--enable-sdl2,--disable-sdl2,virtual/libsdl2"
  91. PACKAGECONFIG[speex] = "--enable-libspeex,--disable-libspeex,speex"
  92. PACKAGECONFIG[srt] = "--enable-libsrt,--disable-libsrt,srt"
  93. PACKAGECONFIG[theora] = "--enable-libtheora,--disable-libtheora,libtheora libogg"
  94. PACKAGECONFIG[vaapi] = "--enable-vaapi,--disable-vaapi,libva"
  95. PACKAGECONFIG[vdpau] = "--enable-vdpau,--disable-vdpau,libvdpau"
  96. PACKAGECONFIG[vpx] = "--enable-libvpx,--disable-libvpx,libvpx"
  97. PACKAGECONFIG[x264] = "--enable-libx264,--disable-libx264,x264"
  98. PACKAGECONFIG[x265] = "--enable-libx265,--disable-libx265,x265"
  99. PACKAGECONFIG[xcb] = "--enable-libxcb,--disable-libxcb,libxcb"
  100. PACKAGECONFIG[xv] = "--enable-outdev=xv,--disable-outdev=xv,libxv"
  101. PACKAGECONFIG[zlib] = "--enable-zlib,--disable-zlib,zlib"
  102. # other configuration options
  103. PACKAGECONFIG[mips32r2] = ",--disable-mipsdsp --disable-mipsdspr2"
  104. PACKAGECONFIG[pic] = "--enable-pic"
  105. PACKAGECONFIG[pthreads] = "--enable-pthreads,--disable-pthreads"
  106. PACKAGECONFIG[shared] = "--enable-shared"
  107. PACKAGECONFIG[strip] = ",--disable-stripping"
  108. # Check codecs that require --enable-nonfree
  109. USE_NONFREE = "${@bb.utils.contains_any('PACKAGECONFIG', [ 'openssl' ], 'yes', '', d)}"
  110. def cpu(d):
  111. for arg in (d.getVar('TUNE_CCARGS') or '').split():
  112. if arg.startswith('-mcpu='):
  113. return arg[6:]
  114. return 'generic'
  115. EXTRA_OECONF = " \
  116. ${@bb.utils.contains('USE_NONFREE', 'yes', '--enable-nonfree', '', d)} \
  117. \
  118. --cross-prefix=${TARGET_PREFIX} \
  119. \
  120. --ld='${CCLD}' \
  121. --cc='${CC}' \
  122. --cxx='${CXX}' \
  123. --arch=${TARGET_ARCH} \
  124. --target-os='linux' \
  125. --enable-cross-compile \
  126. --extra-cflags='${CFLAGS} ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}' \
  127. --extra-ldflags='${LDFLAGS}' \
  128. --sysroot='${STAGING_DIR_TARGET}' \
  129. ${EXTRA_FFCONF} \
  130. --libdir=${libdir} \
  131. --shlibdir=${libdir} \
  132. --datadir=${datadir}/ffmpeg \
  133. --cpu=${@cpu(d)} \
  134. --pkg-config=pkg-config \
  135. "
  136. EXTRA_OECONF:append:linux-gnux32 = " --disable-asm"
  137. EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mipsisa64r6', '--disable-mips64r2 --disable-mips32r2', '', d)}"
  138. EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mipsisa64r2', '--disable-mips64r6 --disable-mips32r6', '', d)}"
  139. EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mips32r2', '--disable-mips64r6 --disable-mips32r6', '', d)}"
  140. EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mips32r6', '--disable-mips64r2 --disable-mips32r2', '', d)}"
  141. EXTRA_OECONF:append:mips = " --extra-libs=-latomic --disable-mips32r5 --disable-mipsdsp --disable-mipsdspr2 \
  142. --disable-loongson2 --disable-loongson3 --disable-mmi --disable-msa"
  143. EXTRA_OECONF:append:riscv32 = " --extra-libs=-latomic"
  144. EXTRA_OECONF:append:armv5 = " --extra-libs=-latomic"
  145. EXTRA_OECONF:append:powerpc = " --extra-libs=-latomic"
  146. # gold crashes on x86, another solution is to --disable-asm but thats more hacky
  147. # ld.gold: internal error in relocate_section, at ../../gold/i386.cc:3684
  148. LDFLAGS:append:x86 = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}"
  149. EXTRA_OEMAKE = "V=1"
  150. CFLAGS += "-I${S}/sf-extra/omx-il"
  151. do_configure() {
  152. export TMPDIR="${B}/tmp"
  153. mkdir -p ${B}/tmp
  154. ${S}/configure ${EXTRA_OECONF}
  155. sed -i -e "s,^X86ASMFLAGS=.*,& --debug-prefix-map=${S}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} --debug-prefix-map=${B}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR},g" ${B}/ffbuild/config.mak
  156. }
  157. # patch out build host paths for reproducibility
  158. do_compile:prepend:class-target() {
  159. sed -i -e "s,${WORKDIR},,g" ${B}/config.h
  160. }
  161. PACKAGES =+ "libavcodec \
  162. libavdevice \
  163. libavfilter \
  164. libavformat \
  165. libavutil \
  166. libpostproc \
  167. libswresample \
  168. libswscale \
  169. "
  170. FILES:libavcodec = "${libdir}/libavcodec${SOLIBS}"
  171. FILES:libavdevice = "${libdir}/libavdevice${SOLIBS}"
  172. FILES:libavfilter = "${libdir}/libavfilter${SOLIBS}"
  173. FILES:libavformat = "${libdir}/libavformat${SOLIBS}"
  174. FILES:libavutil = "${libdir}/libavutil${SOLIBS}"
  175. FILES:libpostproc = "${libdir}/libpostproc${SOLIBS}"
  176. FILES:libswresample = "${libdir}/libswresample${SOLIBS}"
  177. FILES:libswscale = "${libdir}/libswscale${SOLIBS}"
  178. # ffmpeg disables PIC on some platforms (e.g. x86-32)
  179. INSANE_SKIP:${MLPREFIX}libavcodec = "textrel"
  180. INSANE_SKIP:${MLPREFIX}libavdevice = "textrel"
  181. INSANE_SKIP:${MLPREFIX}libavfilter = "textrel"
  182. INSANE_SKIP:${MLPREFIX}libavformat = "textrel"
  183. INSANE_SKIP:${MLPREFIX}libavutil = "textrel"
  184. INSANE_SKIP:${MLPREFIX}libswscale = "textrel"
  185. INSANE_SKIP:${MLPREFIX}libswresample = "textrel"
  186. INSANE_SKIP:${MLPREFIX}libpostproc = "textrel"