From aca6d30af5338e27571ed124ff3ef26479b214c5 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Mon, 9 Dec 2024 18:30:37 +0100 Subject: [PATCH] Include dav1d in releases Scrcpy supports AV1, but no decoder was provided in binary releases. Include dav1d: - - Fixes #4744 PR #5644 --- app/deps/dav1d.sh | 68 ++++++++++++++++++++++++++++++++++++++++ app/deps/ffmpeg.sh | 5 +++ release/build_linux.sh | 1 + release/build_macos.sh | 1 + release/build_windows.sh | 1 + 5 files changed, 76 insertions(+) create mode 100755 app/deps/dav1d.sh diff --git a/app/deps/dav1d.sh b/app/deps/dav1d.sh new file mode 100755 index 0000000000..3069b6fe99 --- /dev/null +++ b/app/deps/dav1d.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash +set -ex +DEPS_DIR=$(dirname ${BASH_SOURCE[0]}) +cd "$DEPS_DIR" +. common +process_args "$@" + +VERSION=1.5.0 +FILENAME=dav1d-$VERSION.tar.gz +PROJECT_DIR=dav1d-$VERSION +SHA256SUM=78b15d9954b513ea92d27f39362535ded2243e1b0924fde39f37a31ebed5f76b + +cd "$SOURCES_DIR" + +if [[ -d "$PROJECT_DIR" ]] +then + echo "$PWD/$PROJECT_DIR" found +else + get_file "https://code.videolan.org/videolan/dav1d/-/archive/$VERSION/$FILENAME" "$FILENAME" "$SHA256SUM" + tar xf "$FILENAME" # First level directory is "$PROJECT_DIR" +fi + +mkdir -p "$BUILD_DIR/$PROJECT_DIR" +cd "$BUILD_DIR/$PROJECT_DIR" + +if [[ -d "$DIRNAME" ]] +then + echo "'$PWD/$DIRNAME' already exists, not reconfigured" + cd "$DIRNAME" +else + mkdir "$DIRNAME" + cd "$DIRNAME" + + conf=( + --prefix="$INSTALL_DIR/$DIRNAME" + --libdir=lib + -Denable_tests=false + -Denable_tools=false + # Always build dav1d statically + --default-library=static + ) + + if [[ "$BUILD_TYPE" == cross ]] + then + case "$HOST" in + win32) + conf+=( + --cross-file="$SOURCES_DIR/$PROJECT_DIR/package/crossfiles/i686-w64-mingw32.meson" + ) + ;; + + win64) + conf+=( + --cross-file="$SOURCES_DIR/$PROJECT_DIR/package/crossfiles/x86_64-w64-mingw32.meson" + ) + ;; + + *) + echo "Unsupported host: $HOST" >&2 + exit 1 + esac + fi + + meson setup . "$SOURCES_DIR/$PROJECT_DIR" "${conf[@]}" +fi + +ninja +ninja install diff --git a/app/deps/ffmpeg.sh b/app/deps/ffmpeg.sh index acf1158403..d268ca91b1 100755 --- a/app/deps/ffmpeg.sh +++ b/app/deps/ffmpeg.sh @@ -43,8 +43,11 @@ else export PKG_CONFIG_PATH="/opt/homebrew/opt/zlib/lib/pkgconfig" fi + export PKG_CONFIG_PATH="$INSTALL_DIR/$DIRNAME/lib/pkgconfig:$PKG_CONFIG_PATH" + conf=( --prefix="$INSTALL_DIR/$DIRNAME" + --pkg-config-flags="--static" --extra-cflags="-O2 -fPIC" --disable-programs --disable-doc @@ -57,9 +60,11 @@ else --disable-vaapi --disable-vdpau --enable-swresample + --enable-libdav1d --enable-decoder=h264 --enable-decoder=hevc --enable-decoder=av1 + --enable-decoder=libdav1d --enable-decoder=pcm_s16le --enable-decoder=opus --enable-decoder=aac diff --git a/release/build_linux.sh b/release/build_linux.sh index ccf2457530..6bca6979d7 100755 --- a/release/build_linux.sh +++ b/release/build_linux.sh @@ -15,6 +15,7 @@ LINUX_BUILD_DIR="$WORK_DIR/build-linux-$ARCH" app/deps/adb_linux.sh app/deps/sdl.sh linux native static +app/deps/dav1d.sh linux native static app/deps/ffmpeg.sh linux native static app/deps/libusb.sh linux native static diff --git a/release/build_macos.sh b/release/build_macos.sh index 2c41d04e04..8f4beb9b34 100755 --- a/release/build_macos.sh +++ b/release/build_macos.sh @@ -15,6 +15,7 @@ MACOS_BUILD_DIR="$WORK_DIR/build-macos-$ARCH" app/deps/adb_macos.sh app/deps/sdl.sh macos native static +app/deps/dav1d.sh macos native static app/deps/ffmpeg.sh macos native static app/deps/libusb.sh macos native static diff --git a/release/build_windows.sh b/release/build_windows.sh index dbd6cbf42a..c83d2e3151 100755 --- a/release/build_windows.sh +++ b/release/build_windows.sh @@ -22,6 +22,7 @@ WINXX_BUILD_DIR="$WORK_DIR/build-$WINXX" app/deps/adb_windows.sh app/deps/sdl.sh $WINXX cross shared +app/deps/dav1d.sh $WINXX cross shared app/deps/ffmpeg.sh $WINXX cross shared app/deps/libusb.sh $WINXX cross shared