ffmpeg-v4l2-request-git → ffmpeg-v4l2-request-fourier: rename directory

PKGBUILD already renamed itself (pkgname=ffmpeg-v4l2-request-fourier,
replaces=(ffmpeg ffmpeg-v4l2-request-git)) but the containing
directory was never moved. This commit completes the rename to align
the path with the package identity and the rest of the -fourier
umbrella (libva, mpv, kwin, qt6-base, chromium, linux-*).

CI workflow path-trigger is wildcard (arch/**), unaffected. Step
names + cp source path updated to the new directory.
This commit is contained in:
claude-noether
2026-05-17 01:04:33 +02:00
parent 1fed626900
commit d6c4260eb8
3 changed files with 4 additions and 4 deletions
@@ -0,0 +1,166 @@
--- a/libavutil/hwcontext_v4l2request.c
+++ b/libavutil/hwcontext_v4l2request.c
@@ -19,12 +19,13 @@
#include "config.h"
#include <fcntl.h>
#include <linux/dma-buf.h>
#include <linux/media.h>
#include <sys/ioctl.h>
+#include <sys/stat.h>
#include <sys/mman.h>
#include <unistd.h>
#include <drm_fourcc.h>
#include <libudev.h>
@@ -690,12 +691,125 @@
}
udev_enumerate_unref(enumerate);
return ret;
}
+/*
+ * Brute-force fallback used when libudev's scan fails (e.g. inside firefox's
+ * RDD sandbox where Mozilla's broker rejects fd-relative openat used by
+ * systemd's chase() symlink resolver). Iterates /dev/video[0..63], picks the
+ * one whose major/minor matches the requested devnum.
+ */
+static char *v4l2request_devnum_to_video_path_brute(dev_t devnum)
+{
+ char path[32];
+ struct stat st;
+ for (int i = 0; i < 64; i++) {
+ snprintf(path, sizeof(path), "/dev/video%d", i);
+ if (stat(path, &st) < 0)
+ continue;
+ if (st.st_rdev == devnum)
+ return av_strdup(path);
+ }
+ return NULL;
+}
+
+/* Brute-force version of v4l2request_probe_video_devices: replaces the
+ * udev_device_new_from_devnum + udev_device_get_devnode flow with
+ * stat()-based major/minor matching against /dev/video[0..63]. */
+static int v4l2request_probe_video_devices_brute(AVHWFramesContext *hwfc,
+ uint32_t pixelformat,
+ uint32_t buffersize)
+{
+ AVV4L2RequestFramesContext *fctx = hwfc->hwctx;
+ AVV4L2RequestFramesContextInternal *fctxi = fctx->internal;
+ struct media_device_info device_info;
+ struct media_v2_topology topology = {0};
+ struct media_v2_interface *interfaces;
+ char *path;
+ dev_t devnum;
+ int ret;
+
+ if (ioctl(fctxi->media_fd, MEDIA_IOC_DEVICE_INFO, &device_info) < 0)
+ return AVERROR(errno);
+
+ if (ioctl(fctxi->media_fd, MEDIA_IOC_G_TOPOLOGY, &topology) < 0)
+ return AVERROR(errno);
+
+ if (!topology.num_interfaces)
+ return AVERROR(ENOENT);
+
+ interfaces = av_calloc(topology.num_interfaces,
+ sizeof(struct media_v2_interface));
+ if (!interfaces)
+ return AVERROR(ENOMEM);
+
+ topology.ptr_interfaces = (__u64)(uintptr_t)interfaces;
+ if (ioctl(fctxi->media_fd, MEDIA_IOC_G_TOPOLOGY, &topology) < 0) {
+ ret = AVERROR(errno);
+ goto fail;
+ }
+
+ ret = AVERROR(ENOENT);
+ for (unsigned i = 0; i < topology.num_interfaces; i++) {
+ if (interfaces[i].intf_type != MEDIA_INTF_T_V4L_VIDEO)
+ continue;
+
+ devnum = makedev(interfaces[i].devnode.major,
+ interfaces[i].devnode.minor);
+ path = v4l2request_devnum_to_video_path_brute(devnum);
+ if (!path)
+ continue;
+
+ ret = v4l2request_probe_video_device(hwfc, path, pixelformat, buffersize);
+ if (!ret) {
+ av_log(hwfc, AV_LOG_INFO,
+ "Using V4L2 media driver %s (brute-force) for %s\n",
+ device_info.driver, av_fourcc2str(pixelformat));
+ av_free(path);
+ break;
+ }
+ av_free(path);
+ }
+
+fail:
+ av_free(interfaces);
+ return ret;
+}
+
+/* Brute-force fallback for v4l2request_probe_media_devices(). Iterates
+ * /dev/media[0..15], opens each, probes via topology+stat. */
+static int v4l2request_probe_media_devices_brute(AVHWFramesContext *hwfc,
+ uint32_t pixelformat,
+ uint32_t buffersize)
+{
+ AVV4L2RequestFramesContext *fctx = hwfc->hwctx;
+ AVV4L2RequestFramesContextInternal *fctxi = fctx->internal;
+ char path[32];
+ int ret = AVERROR(ENOENT);
+
+ for (int i = 0; i < 16; i++) {
+ snprintf(path, sizeof(path), "/dev/media%d", i);
+
+ fctxi->media_fd = open(path, O_RDWR);
+ if (fctxi->media_fd < 0)
+ continue;
+
+ ret = v4l2request_probe_video_devices_brute(hwfc, pixelformat,
+ buffersize);
+ if (!ret)
+ return 0;
+
+ close(fctxi->media_fd);
+ fctxi->media_fd = -1;
+ }
+
+ return ret;
+}
+
static int v4l2request_open_decoder(AVHWFramesContext *hwfc)
{
AVV4L2RequestFramesContext *fctx = hwfc->hwctx;
uint32_t buffersize;
struct udev *udev;
int ret;
@@ -712,12 +826,23 @@
buffersize = FFMAX(hwfc->width * hwfc->height * 3 / 2, 256 * 1024);
// Probe all media devices (auto-detection)
ret = v4l2request_probe_media_devices(hwfc, udev, fctx->pixelformat, buffersize);
+ // Brute-force fallback when libudev fails. Firefox-fourier hits this
+ // because Mozilla's RDD sandbox blocks fd-relative openat used by
+ // systemd's chase() symlink resolver inside udev_enumerate_scan_devices.
+ if (ret < 0) {
+ av_log(hwfc, AV_LOG_INFO,
+ "libudev probe failed (%d), falling back to brute-force /dev/media*\n",
+ ret);
+ ret = v4l2request_probe_media_devices_brute(hwfc, fctx->pixelformat,
+ buffersize);
+ }
+
udev_unref(udev);
return ret;
}
static AVBufferRef *v4l2request_v4l2_buffer_alloc(AVHWFramesContext *hwfc,
struct v4l2_format *format)
+158
View File
@@ -0,0 +1,158 @@
# Maintainer: Markus Fritsche <mfritsche@reauktion.de>
#
# FFmpeg + V4L2-Request hwaccel (stateless video decode on Rockchip,
# Allwinner, etc) for the Fourier umbrella. Tracks Kwiboo's long-running
# rebase of Jernej Škrabec's v4l2-request patchset onto ffmpeg release
# tags. Pins the branch tip to a known commit for reproducible CI builds;
# bump _commit when upstream picks up a fix we want.
#
# Why this fork instead of AUR ffmpeg-v4l2-request-git:
# - AUR is pinned to 6.1.1 with epoch=2, which is OLDER than Arch's
# stock 2:8.1-3 → installing it downgrades system ffmpeg.
# - AUR pulls X11/AMF/CUDA/FireWire/AviSynth/OpenMPT/Bluray — irrelevant
# for a Wayland + ARM + video-decode fleet.
# - AUR uses #branch=..., no commit pin. CI artifacts are non-reproducible.
#
# Encoders (libx264/libx265/libvpx/libdav1d) kept per Fourier fleet policy.
# X11, AMF, CUDA, FireWire, AviSynth, OpenMPT, Bluray, OpenMAX, JPEG-XL,
# Theora, XVid, rsvg, soxr, ssh, vidstab, modplug, SDL2, Vulkan, JACK, GSM,
# Speex dropped — not needed on the Fourier fleet. (No SDL2 means no
# `ffplay` binary; mpv covers interactive playback.)
pkgname=ffmpeg-v4l2-request-fourier
_srcname=FFmpeg
_version='8.1'
_commit='b57fbbe50c9b2656fad86a1a7eeabfd2b2a50935' # v4l2-request-n8.1 tip 2026-04-24
pkgver=8.1.r123329.b57fbbe
pkgrel=4
epoch=2
pkgdesc='FFmpeg with V4L2 Request API hwaccel (Rockchip / Allwinner stateless decode)'
arch=('aarch64')
url='https://github.com/Kwiboo/FFmpeg'
license=('GPL-3.0-or-later')
depends=(
alsa-lib
bzip2
fontconfig
fribidi
gmp
gnutls
lame
libass.so
libdav1d.so
libdrm
libfreetype.so
libgl
libpulse
libva.so
libva-drm.so
libvorbis.so
libvorbisenc.so
libvpx.so
libwebp
libx264.so
libx265.so
libxml2
opus
v4l-utils
xz
zlib
)
makedepends=(
git
linux-api-headers
mesa
nasm
)
provides=(
libavcodec.so
libavdevice.so
libavfilter.so
libavformat.so
libavutil.so
libpostproc.so
libswresample.so
libswscale.so
ffmpeg
)
conflicts=(ffmpeg)
replaces=(ffmpeg ffmpeg-v4l2-request-git)
source=("git+https://github.com/Kwiboo/FFmpeg.git#commit=${_commit}"
'0001-libudev-bypass-fallback.patch')
sha256sums=('SKIP' 'SKIP')
pkgver() {
cd "${_srcname}"
printf '%s.r%s.%s' "${_version}" \
"$(git rev-list --count HEAD)" \
"$(git rev-parse --short=7 HEAD)"
}
prepare() {
cd "${_srcname}"
patch -Np1 -i "${srcdir}/0001-libudev-bypass-fallback.patch"
}
build() {
cd "${_srcname}"
# FFmpeg's configure resolves the compiler via `which` and bakes the
# absolute path into generated makefiles, bypassing the makepkg
# /usr/lib/distcc/bin shim. Pass it explicitly so `BUILDENV=(distcc ...)`
# actually distributes; otherwise everything compiles locally.
local _ffmpeg_cc=gcc _ffmpeg_cxx=g++
if [[ ":$PATH:" == *":/usr/lib/distcc/bin:"* ]]; then
_ffmpeg_cc='distcc gcc'
_ffmpeg_cxx='distcc g++'
fi
./configure \
--prefix=/usr \
--cc="${_ffmpeg_cc}" \
--cxx="${_ffmpeg_cxx}" \
--disable-debug \
--disable-static \
--disable-doc \
--disable-stripping \
--enable-shared \
--enable-gpl \
--enable-version3 \
--enable-pic \
--enable-neon \
--arch=aarch64 \
\
--enable-libdrm \
--enable-libv4l2 \
--enable-libudev \
--enable-v4l2-request \
--enable-v4l2_m2m \
--enable-vaapi \
--enable-opengl \
\
--enable-gnutls \
--enable-fontconfig \
--enable-libass \
--enable-libfreetype \
--enable-libfribidi \
--enable-libxml2 \
--enable-libpulse \
--enable-libdav1d \
--enable-libopus \
--enable-libvorbis \
--enable-libmp3lame \
--enable-libvpx \
--enable-libx264 \
--enable-libx265 \
--enable-libwebp \
\
--host-cflags='-fPIC'
make
make tools/qt-faststart
}
package() {
cd "${_srcname}"
make DESTDIR="${pkgdir}" install
install -Dm755 tools/qt-faststart "${pkgdir}/usr/bin/qt-faststart"
}