diff --git a/.gitmodules b/.gitmodules index ae79e3f..3e2cb23 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,9 +10,6 @@ [submodule "SDL_ttf"] path = SDL_ttf url = https://github.com/libsdl-org/SDL_ttf.git -[submodule "FFmpeg-rpi"] - path = FFmpeg-rpi - url = https://github.com/cgutman/FFmpeg.git [submodule "dav1d"] path = dav1d url = https://code.videolan.org/videolan/dav1d.git diff --git a/Dockerfile.rpi.bookworm b/Dockerfile.rpi.bookworm index 785407e..0e0855f 100644 --- a/Dockerfile.rpi.bookworm +++ b/Dockerfile.rpi.bookworm @@ -8,8 +8,6 @@ RUN /bin/bash -c /opt/scripts/install-base-deps.sh && \ apt-get clean -y && \ rm -rf /var/lib/apt/lists/* -COPY dav1d /opt/dav1d -COPY FFmpeg-rpi /opt/FFmpeg COPY SDL2 /opt/SDL2 COPY SDL_ttf /opt/SDL_ttf diff --git a/Dockerfile.rpi.trixie b/Dockerfile.rpi.trixie index 201b581..1215c60 100644 --- a/Dockerfile.rpi.trixie +++ b/Dockerfile.rpi.trixie @@ -8,8 +8,6 @@ RUN /bin/bash -c /opt/scripts/install-base-deps.sh && \ apt-get clean -y && \ rm -rf /var/lib/apt/lists/* -COPY dav1d /opt/dav1d -COPY FFmpeg-rpi /opt/FFmpeg COPY SDL2 /opt/SDL2 COPY SDL_ttf /opt/SDL_ttf diff --git a/Dockerfile.rpi64.bookworm b/Dockerfile.rpi64.bookworm index 63955d1..d1be741 100644 --- a/Dockerfile.rpi64.bookworm +++ b/Dockerfile.rpi64.bookworm @@ -8,8 +8,6 @@ RUN /bin/bash -c /opt/scripts/install-base-deps.sh && \ apt-get clean -y && \ rm -rf /var/lib/apt/lists/* -COPY dav1d /opt/dav1d -COPY FFmpeg-rpi /opt/FFmpeg COPY SDL2 /opt/SDL2 COPY SDL_ttf /opt/SDL_ttf diff --git a/Dockerfile.rpi64.trixie b/Dockerfile.rpi64.trixie index 6a912cf..4c635fb 100644 --- a/Dockerfile.rpi64.trixie +++ b/Dockerfile.rpi64.trixie @@ -8,8 +8,6 @@ RUN /bin/bash -c /opt/scripts/install-base-deps.sh && \ apt-get clean -y && \ rm -rf /var/lib/apt/lists/* -COPY dav1d /opt/dav1d -COPY FFmpeg-rpi /opt/FFmpeg COPY SDL2 /opt/SDL2 COPY SDL_ttf /opt/SDL_ttf diff --git a/FFmpeg-rpi b/FFmpeg-rpi deleted file mode 160000 index 9482fb3..0000000 --- a/FFmpeg-rpi +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9482fb35ae5e602ef29818f354f4400f07db436a diff --git a/scripts/build-deps.sh b/scripts/build-deps.sh index 61e3e09..1cdf755 100755 --- a/scripts/build-deps.sh +++ b/scripts/build-deps.sh @@ -1,11 +1,12 @@ set -e BASE_FFMPEG_ARGS="--fatal-warnings --enable-pic --enable-static --disable-shared --disable-all --disable-vulkan --enable-avcodec --enable-swscale --enable-decoder=h264 --enable-decoder=hevc --enable-decoder=av1 --enable-libdav1d --enable-decoder=libdav1d --enable-libdrm --enable-decoder=h264_v4l2m2m --enable-decoder=hevc_v4l2m2m --extra-cflags=-I/usr/include/libdrm" +USE_PLATFORM_FFMPEG=0 echo "Building dependencies for $TARGET" if [ "$TARGET" == "rpi" ] || [ "$TARGET" == "rpi64" ]; then - # Enable HEVC VL42 stateless decoder (H.264 is stateful on Pi 4 and absent on Pi 5) - EXTRA_FFMPEG_ARGS="--enable-sand --enable-libudev --enable-v4l2-request --enable-hwaccel=hevc_v4l2request" + # Use the platform-provided FFmpeg version on Raspberry Pi OS + USE_PLATFORM_FFMPEG=1 elif [ "$TARGET" == "l4t" ]; then # Enable NVV4L2 decoders (and VP9 decoder to work around compilation error in NVV4L2 fallback code) EXTRA_FFMPEG_ARGS="--enable-nvv4l2 --enable-decoder=h264_nvv4l2 --enable-decoder=hevc_nvv4l2 --enable-decoder=vp9" @@ -43,13 +44,17 @@ sed -i 's/-lSDL2_ttf/-lSDL2_ttf -lfreetype/g' SDL2_ttf.pc cat SDL2_ttf.pc make install -# Build and install libdav1d -cd /opt/dav1d -meson setup build -Ddefault_library=static -Dbuildtype=debugoptimized -Denable_tools=false -Denable_tests=false -ninja -C build -ninja install -C build +# Build FFmpeg and its dependencies if we're not using the platform version +if [ "$USE_PLATFORM_FFMPEG" == "0" ]; then + # Build and install libdav1d + cd /opt/dav1d + meson setup build -Ddefault_library=static -Dbuildtype=debugoptimized -Denable_tools=false -Denable_tests=false + ninja -C build + ninja install -C build -cd /opt/FFmpeg -./configure $BASE_FFMPEG_ARGS $EXTRA_FFMPEG_ARGS $DAV1D_FFMPEG_ARGS -make -j$(nproc) -make install + # Build and install FFmpeg + cd /opt/FFmpeg + ./configure $BASE_FFMPEG_ARGS $EXTRA_FFMPEG_ARGS $DAV1D_FFMPEG_ARGS + make -j$(nproc) + make install +fi diff --git a/scripts/build-package.sh b/scripts/build-package.sh index 293ba71..31c9240 100755 --- a/scripts/build-package.sh +++ b/scripts/build-package.sh @@ -15,6 +15,7 @@ VERSION=`cat app/version.txt` # Determine extra target-specific dependencies if [ "$TARGET" == "rpi" ] || [ "$TARGET" == "rpi64" ]; then EXTRA_CONFIG="CONFIG+=gpuslow CONFIG+=disable-mmal" + EXTRA_BUILD_DEPS="libavcodec-dev libavformat-dev libswscale-dev" elif [ "$TARGET" == "l4t" ]; then : elif [ "$TARGET" == "desktop" ]; then diff --git a/scripts/install-base-deps.sh b/scripts/install-base-deps.sh index 4247a91..c863229 100755 --- a/scripts/install-base-deps.sh +++ b/scripts/install-base-deps.sh @@ -6,6 +6,11 @@ apt-get update apt-get install -y curl g++ make ninja-build devscripts fakeroot debhelper git nasm libgbm-dev libdrm-dev libasound2-dev libdbus-1-dev libegl1-mesa-dev libgl1-mesa-dev libgles2-mesa-dev libglu1-mesa-dev libibus-1.0-dev libpulse-dev libudev-dev libx11-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxkbcommon-dev libxrandr-dev libxss-dev libxt-dev libxv-dev libxxf86vm-dev cmake libgl-dev meson wayland-protocols libwayland-dev libdecor-0-dev libfreetype-dev libpipewire-0.3-dev apt-get install -y --no-install-recommends libssl-dev qtbase5-dev qtquickcontrols2-5-dev qtdeclarative5-dev libqt5svg5-dev libopus-dev gnupg +# Install FFmpeg if we're using the OS-provided version +if [ "$TARGET" == "rpi" ] || [ "$TARGET" == "rpi64" ]; then + apt-get install -y libavcodec-dev libavformat-dev libswscale-dev +fi + if [ "$TARGET" == "embedded" ] && [ "$DISTRO" != "sid" ] && [ "$DISTRO" != "trixie" ]; then # Grab latest kernel headers from Bookworm to pick up the latest V4L2 defs apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 6ED0E7B82643E131