From edb911243582765f274d6824b9e9c1a02159885f Mon Sep 17 00:00:00 2001 From: mofeng-git Date: Sun, 28 Sep 2025 15:24:25 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A4=A7=E5=B9=85=E4=BC=98=E5=8C=96=20?= =?UTF-8?q?RKMPP=20=E5=9C=A8=20ustreamer=20=E4=B8=AD=E7=9A=84=E7=BC=96?= =?UTF-8?q?=E8=A7=A3=E7=A0=81=E6=80=A7=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit feat: 添加 DRM 初步支持 fix: 修复 OEC TURBO 硬件编解码设备权限错误 --- build/Dockerfile | 5 +++-- build/Dockerfile-stage-0 | 40 +++++++++++++++----------------------- build/functions/devices.sh | 9 +++++++++ 3 files changed, 28 insertions(+), 26 deletions(-) diff --git a/build/Dockerfile b/build/Dockerfile index be1b074d..b07dcce0 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -68,8 +68,9 @@ RUN sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/' /etc/apt/sources.lis ;; \ arm64) \ apt-get install -y --no-install-recommends \ - v4l-utils libv4l-0 \ - libstdc++6 \ + v4l-utils libv4l-0 libavutil57 \ + libstdc++6 libavcodec59 libavformat59 \ + libswscale6 libavfilter8 libavdevice59 \ libva2 libva-drm2 libva-x11-2 \ libvdpau1 ocl-icd-libopencl1 \ ;; \ diff --git a/build/Dockerfile-stage-0 b/build/Dockerfile-stage-0 index dc130892..14c84e5f 100644 --- a/build/Dockerfile-stage-0 +++ b/build/Dockerfile-stage-0 @@ -54,16 +54,13 @@ RUN sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/' /etc/apt/sources.lis mesa-vdpau-drivers \ v4l-utils \ libv4l-dev \ - && if [ ${TARGETARCH} != arm64 ]; then \ - apt-get install -y --no-install-recommends \ - ffmpeg \ - libavcodec-dev \ - libavformat-dev \ - libavutil-dev \ - libswscale-dev \ - libavfilter-dev \ - libavdevice-dev; \ - fi \ + ffmpeg \ + libavcodec-dev \ + libavformat-dev \ + libavutil-dev \ + libswscale-dev \ + libavfilter-dev \ + libavdevice-dev \ && if [ ${TARGETARCH} != arm ] && [ ${TARGETARCH} != arm64 ]; then \ apt-get install -y --no-install-recommends \ vainfo \ @@ -148,7 +145,7 @@ RUN git clone --depth=1 https://gitlab.freedesktop.org/libnice/libnice /tmp/libn # 编译 Rockchip MPP、RGA 和 FFmpeg(仅 arm64) RUN if [ ${TARGETARCH} = arm64 ]; then \ - git clone -b jellyfin-mpp --depth=1 https://github.com/nyanmisaka/mpp.git /tmp/rkmpp \ + git clone --depth=1 https://github.com/rockchip-linux/mpp.git /tmp/rkmpp \ && mkdir -p /tmp/rkmpp/rkmpp_build && cd /tmp/rkmpp/rkmpp_build \ && cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DBUILD_TEST=OFF .. \ && make -j$(nproc) \ @@ -158,21 +155,17 @@ RUN if [ ${TARGETARCH} = arm64 ]; then \ && meson setup rkrga rkrga_build --prefix=/usr --libdir=lib --buildtype=release -Dcpp_args=-fpermissive -Dlibdrm=false -Dlibrga_demo=false \ && meson configure rkrga_build > /dev/null \ && ninja -C rkrga_build install \ - && git clone --depth=1 https://github.com/nyanmisaka/ffmpeg-rockchip.git /tmp/ffmpeg-rockchip \ - && cd /tmp/ffmpeg-rockchip \ - && ./configure --prefix=/usr --enable-gpl --enable-version3 --enable-libdrm --enable-rkmpp --enable-rkrga \ - --enable-libv4l2 --enable-libx264 --enable-shared --disable-programs \ - --disable-doc --disable-htmlpages --disable-manpages --disable-network --disable-protocols \ - --disable-decoders --disable-debug --disable-alsa \ - && make -j$(nproc) \ - && make install \ - && rm -rf /tmp/rkmpp /tmp/rkrga /tmp/ffmpeg-rockchip; \ + && rm -rf /tmp/rkmpp /tmp/rkrga; \ fi # 编译 ustreamer RUN sed --in-place --expression 's|^#include "refcount.h"$|#include "../refcount.h"|g' /usr/include/janus/plugins/plugin.h \ && git clone --depth=1 https://github.com/mofeng-git/ustreamer /tmp/ustreamer \ - && make -j$(nproc) WITH_PYTHON=1 WITH_JANUS=1 WITH_FFMPEG=1 -C /tmp/ustreamer \ + && if [ ${TARGETARCH} = arm64 ]; then \ + make -j$(nproc) WITH_PYTHON=1 WITH_JANUS=1 WITH_FFMPEG=1 WITH_MPP=1 -C /tmp/ustreamer; \ + else \ + make -j$(nproc) WITH_PYTHON=1 WITH_JANUS=1 WITH_FFMPEG=1 -C /tmp/ustreamer; \ + fi \ && /tmp/ustreamer/ustreamer -v \ && /tmp/ustreamer/ustreamer-dump -v \ && cp /tmp/ustreamer/python/dist/*.whl /tmp/wheel/ @@ -186,9 +179,8 @@ RUN mkdir /tmp/lib \ && find /usr/lib -name "libsrtp2.so.*" -exec cp {} /tmp/lib/ \; \ && find /usr/lib -name "libwebsockets.so.*" -exec cp {} /tmp/lib/ \; \ && if [ ${TARGETARCH} = arm64 ]; then \ - find /usr/lib -name "libav*.so.*" -exec cp {} /tmp/lib/ \; \ - && find /usr/lib -name "libsw*.so.*" -exec cp {} /tmp/lib/ \; \ + find /usr/lib -name "libsw*.so.*" -exec cp {} /tmp/lib/ \; \ && find /usr/lib -name "libpostproc.so.*" -exec cp {} /tmp/lib/ \; \ && find /usr/lib -name "librockchip*" -exec cp {} /tmp/lib/ \; \ && find /usr/lib -name "librga.so.*" -exec cp {} /tmp/lib/ \; ; \ - fi + fi \ No newline at end of file diff --git a/build/functions/devices.sh b/build/functions/devices.sh index 6f0183f2..ff6f39ab 100755 --- a/build/functions/devices.sh +++ b/build/functions/devices.sh @@ -374,6 +374,15 @@ config_oec_turbo_files() { echo "信息:配置 VPU 硬件编码支持..." run_in_chroot "sed -i 's/--h264-hwenc=disabled/--h264-hwenc=rkmpp/g' /etc/kvmd/override.yaml" + # 配置 rc.local 自启脚本,添加设备权限设置 + echo "信息:配置 rc.local 自启脚本..." + run_in_chroot "cat > /etc/rc.local << 'EOF' +#!/bin/bash +chmod 777 /dev/mpp_service /dev/rga +exit 0 +EOF" + run_in_chroot "chmod +x /etc/rc.local" + # 替换 DTB 文件 replace_oec_turbo_dtb