blob: e70d512759a172ab80a12a3895cac95e5aecd374 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
From e8bb0c69987b6b894b594d672230f6164d11fbc0 Mon Sep 17 00:00:00 2001
From: Mirko Vogt <foss@mirko.in>
Date: Thu, 10 Sep 2026 22:34:11 +0000
Subject: [PATCH] libavdevice/v4l2: tell libv4l2.h about the POSIX ioctl
signature
libv4l2.h declares v4l2_ioctl() with a "long request" by default and only
switches to the POSIX/musl "int request" signature when the *consumer*
defines a feature macro before including it: HAVE_POSIX_IOCTL up to
v4l-utils 1.30 (added 2024-10-17), LIBV4L_HAVE_POSIX_IOCTL from 1.32 on
(renamed 2025-09-10 to avoid clashing with consumers' own config.h).
FFmpeg detects the musl signature itself (HAVE_IOCTL_POSIX) and types its
ioctl_f accordingly, but never forwards that knowledge to libv4l2.h. It used
to work by accident while FFmpeg's config.h still spelled the symbol
HAVE_POSIX_IOCTL; commit 5fea5e3e11d6 ("configure: rename POSIX ioctl check")
renamed it and the header fell back to the "long" prototype. With GCC 14
the resulting pointer-type mismatch is an error:
libavdevice/v4l2.c:145:17: error: assignment to 'int (*)(int, int, ...)'
from incompatible pointer type 'int (*)(int, long unsigned int, ...)'
Define both spellings so either header generation gets the signature the
library was actually built with (OpenWrt builds v4l-utils with
HAVE_POSIX_IOCTL on musl). Same approach as q66's posix-ioctl.patch in
Chimera Linux and Alpine, which defines one of the two names per copy;
this patch defines both.
Signed-off-by: Mirko Vogt <foss@mirko.in>
---
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -49,6 +49,14 @@
#include <dirent.h>
#if CONFIG_LIBV4L2
+#if HAVE_IOCTL_POSIX
+/* libv4l2.h only declares v4l2_ioctl() with the POSIX "int request"
+ * signature when told so by the consumer: HAVE_POSIX_IOCTL up to
+ * v4l-utils 1.30, LIBV4L_HAVE_POSIX_IOCTL from 1.32 on. Without it the
+ * assignment to ioctl_f below has an incompatible pointer type on musl. */
+#define HAVE_POSIX_IOCTL 1
+#define LIBV4L_HAVE_POSIX_IOCTL 1
+#endif
#include <libv4l2.h>
#endif
|