distribution/projects/Rockchip/devices/RK3588/packages/ffmpeg/package.mk
2023-01-08 22:49:32 +00:00

212 lines
6.6 KiB
Makefile
Executable file

# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="ffmpeg"
PKG_VERSION="4.3.1-Matrix-Beta1"
PKG_SHA256="0b209a9b15f2335e516bf2ad1249fffc6b55425145f17c9674dc430abf6a67ad"
PKG_LICENSE="LGPLv2.1+"
PKG_SITE="https://ffmpeg.org"
PKG_URL="https://github.com/xbmc/FFmpeg/archive/${PKG_VERSION}.tar.gz"
PKG_DEPENDS_TARGET="toolchain zlib bzip2 gnutls speex"
PKG_LONGDESC="FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video."
PKG_BUILD_FLAGS="-gold"
# Dependencies
get_graphicdrivers
PKG_FFMPEG_HWACCEL="--enable-hwaccels"
PKG_FFMPEG_RPI="--disable-mmal"
if [ "${PROJECT}" = "RPi" ]; then
PKG_PATCH_DIRS="rpi"
PKG_FFMPEG_RPI+=" --disable-rpi --enable-sand"
else
PKG_PATCH_DIRS="v4l2-request v4l2-drmprime"
fi
PKG_PATCH_DIRS+=" libreelec"
if [ "${V4L2_SUPPORT}" = "yes" ]; then
PKG_DEPENDS_TARGET+=" libdrm"
PKG_NEED_UNPACK+=" $(get_pkg_directory libdrm)"
PKG_FFMPEG_V4L2="--enable-v4l2_m2m --enable-libdrm"
if [ "${PROJECT}" = "Allwinner" -o "${PROJECT}" = "Rockchip" ]; then
PKG_V4L2_REQUEST="yes"
elif [ "${PROJECT}" = "RPi" -a "${DEVICE}" = "RPi4" ]; then
PKG_V4L2_REQUEST="yes"
PKG_FFMPEG_HWACCEL="--disable-hwaccel=h264_v4l2request \
--disable-hwaccel=mpeg2_v4l2request \
--disable-hwaccel=vp8_v4l2request \
--disable-hwaccel=vp9_v4l2request"
else
PKG_V4L2_REQUEST="no"
fi
if [ "${PKG_V4L2_REQUEST}" = "yes" ]; then
PKG_DEPENDS_TARGET+=" systemd"
PKG_NEED_UNPACK+=" $(get_pkg_directory systemd)"
PKG_FFMPEG_V4L2+=" --enable-libudev --enable-v4l2-request"
else
PKG_FFMPEG_V4L2+=" --disable-libudev --disable-v4l2-request"
fi
else
PKG_FFMPEG_V4L2="--disable-v4l2_m2m --disable-libudev --disable-v4l2-request"
fi
if [ "${VAAPI_SUPPORT}" = "yes" ]; then
PKG_DEPENDS_TARGET+=" libva"
PKG_NEED_UNPACK+=" $(get_pkg_directory libva)"
PKG_FFMPEG_VAAPI="--enable-vaapi"
else
PKG_FFMPEG_VAAPI="--disable-vaapi"
fi
if [ "${VDPAU_SUPPORT}" = "yes" -a "${DISPLAYSERVER}" = "x11" ]; then
PKG_DEPENDS_TARGET+=" libvdpau"
PKG_NEED_UNPACK+=" $(get_pkg_directory libvdpau)"
PKG_FFMPEG_VDPAU="--enable-vdpau"
else
PKG_FFMPEG_VDPAU="--disable-vdpau"
fi
if build_with_debug; then
PKG_FFMPEG_DEBUG="--enable-debug --disable-stripping"
else
PKG_FFMPEG_DEBUG="--disable-debug --enable-stripping"
fi
if target_has_feature neon; then
PKG_FFMPEG_FPU="--enable-neon"
else
PKG_FFMPEG_FPU="--disable-neon"
fi
if [ "${TARGET_ARCH}" = "x86_64" ]; then
PKG_DEPENDS_TARGET+=" nasm:host"
fi
#$if target_has_feature "(neon|sse)"; then
# PKG_DEPENDS_TARGET+=" dav1d"
# PKG_NEED_UNPACK+=" $(get_pkg_directory dav1d)"
#PKG_FFMPEG_AV1="--enable-libdav1d"
#else
PKG_FFMPEG_AV1="--disable-libdav1d"
#fi
pre_configure_target() {
cd ${PKG_BUILD}
rm -rf .${TARGET_NAME}
}
configure_target() {
./configure --prefix="/usr" \
--cpu="${TARGET_CPU}" \
--arch="${TARGET_ARCH}" \
--enable-cross-compile \
--cross-prefix="${TARGET_PREFIX}" \
--sysroot="${SYSROOT_PREFIX}" \
--sysinclude="${SYSROOT_PREFIX}/usr/include" \
--target-os="linux" \
--nm="${NM}" \
--ar="${AR}" \
--as="${CC}" \
--cc="${CC}" \
--ld="${CC}" \
--host-cc="${HOST_CC}" \
--host-cflags="${HOST_CFLAGS}" \
--host-ldflags="${HOST_LDFLAGS}" \
--extra-cflags="${CFLAGS}" \
--extra-ldflags="${LDFLAGS}" \
--extra-libs="${PKG_FFMPEG_LIBS}" \
--disable-static \
--enable-shared \
--enable-gpl \
--disable-version3 \
--enable-logging \
--disable-doc \
${PKG_FFMPEG_DEBUG} \
--enable-pic \
--pkg-config="${TOOLCHAIN}/bin/pkg-config" \
--enable-optimizations \
--disable-extra-warnings \
--disable-programs \
--enable-avdevice \
--enable-avcodec \
--enable-avformat \
--enable-swscale \
--enable-postproc \
--enable-avfilter \
--disable-devices \
--enable-pthreads \
--enable-network \
--enable-gnutls --disable-openssl \
--disable-gray \
--enable-swscale-alpha \
--disable-small \
--enable-dct \
--enable-fft \
--enable-mdct \
--enable-rdft \
--disable-crystalhd \
${PKG_FFMPEG_V4L2} \
${PKG_FFMPEG_VAAPI} \
${PKG_FFMPEG_VDPAU} \
${PKG_FFMPEG_RPI} \
--enable-runtime-cpudetect \
--disable-hardcoded-tables \
--disable-encoders \
--enable-encoder=ac3 \
--enable-encoder=aac \
--enable-encoder=wmav2 \
--enable-encoder=mjpeg \
--enable-encoder=png \
${PKG_FFMPEG_HWACCEL} \
--disable-muxers \
--enable-muxer=spdif \
--enable-muxer=adts \
--enable-muxer=asf \
--enable-muxer=ipod \
--enable-muxer=mpegts \
--enable-demuxers \
--enable-parsers \
--enable-bsfs \
--enable-protocol=http \
--disable-indevs \
--disable-outdevs \
--enable-filters \
--disable-avisynth \
--enable-bzlib \
--disable-lzma \
--disable-alsa \
--disable-frei0r \
--disable-libopencore-amrnb \
--disable-libopencore-amrwb \
--disable-libopencv \
--disable-libdc1394 \
--disable-libfreetype \
--disable-libgsm \
--disable-libmp3lame \
--disable-libopenjpeg \
--disable-librtmp \
${PKG_FFMPEG_AV1} \
--enable-libspeex \
--disable-libtheora \
--disable-libvo-amrwbenc \
--disable-libvorbis \
--disable-libvpx \
--disable-libx264 \
--disable-libxavs \
--disable-libxvid \
--enable-zlib \
--enable-asm \
--disable-altivec \
${PKG_FFMPEG_FPU} \
--disable-symver
}
post_makeinstall_target() {
rm -rf ${INSTALL}/usr/share/ffmpeg/examples
}