Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions srcpkgs/ffmpeg/patches/00001-v4l-config.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
From 7405f1ad5351cc24b91a0227aeeaf24ff9d12278 Mon Sep 17 00:00:00 2001
From: Ramiro Polla <ramiro.polla@gmail.com>
Date: Wed, 3 Jul 2024 00:30:08 +0200
Subject: [PATCH] configure: restore autodetection of v4l2 and fbdev

The detection logic for v4l2 and fbdev was accidentally modified to
depend on v4l2-m2m in 43b3412.
---
configure | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index b28221f258965..fa2e384350958 100755
--- a/configure
+++ b/configure
@@ -7145,11 +7145,12 @@ pod2man --help > /dev/null 2>&1 && enable pod2man || disable pod2man
rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || disable rsync_contimeout
xmllint --version > /dev/null 2>&1 && enable xmllint || disable xmllint

+check_headers linux/fb.h
+check_headers linux/videodev2.h
+test_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete
+
# check V4L2 codecs available in the API
if enabled v4l2_m2m; then
- check_headers linux/fb.h
- check_headers linux/videodev2.h
- test_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete
check_cc v4l2_m2m linux/videodev2.h "int i = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_VIDEO_M2M | V4L2_BUF_FLAG_LAST;"
check_cc vc1_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VC1_ANNEX_G;"
check_cc mpeg1_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG1;"
87 changes: 87 additions & 0 deletions srcpkgs/ffmpeg/patches/00002-v4l-ioctl-musl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
From 008b0b4a3b0cbafa568d0dcbf78c798d56929802 Mon Sep 17 00:00:00 2001
From: Brad Smith <brad-at-comstyle.com@ffmpeg.org>
Date: Sun, 5 May 2024 23:59:47 -0400
Subject: [PATCH] lavd/v4l2: Use proper field type for second parameter of
ioctl() with BSD's

The proper type was used until 73251678c83cbe24d08264da693411b166239bc7.

This covers all of the OS's that currently have V4L2 support, permutations
of Linux glibc/musl, Android bionic, FreeBSD, NetBSD, OpenBSD, Solaris.

Copied from FreeBSD ports patch.

Signed-off-by: Brad Smith <brad@comstyle.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
(cherry picked from commit 9e674b31606c805dd31b4bb754364a72a5877238)
Signed-off-by: Brad Smith <brad@comstyle.com>
---
libavdevice/v4l2.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index 365bacd7714b6..1dcbe04bb1741 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -95,10 +95,10 @@ struct video_data {
int (*open_f)(const char *file, int oflag, ...);
int (*close_f)(int fd);
int (*dup_f)(int fd);
-#ifdef __GLIBC__
- int (*ioctl_f)(int fd, unsigned long int request, ...);
-#else
+#if defined(__sun) || defined(__BIONIC__) || defined(__musl__) /* POSIX-like */
int (*ioctl_f)(int fd, int request, ...);
+#else
+ int (*ioctl_f)(int fd, unsigned long int request, ...);
#endif
ssize_t (*read_f)(int fd, void *buffer, size_t n);
void *(*mmap_f)(void *start, size_t length, int prot, int flags, int fd, int64_t offset);
From af17f55202e285d4d3d502078e5b6a41bcca90fb Mon Sep 17 00:00:00 2001
From: Ramiro Polla <ramiro.polla@gmail.com>
Date: Thu, 29 Aug 2024 15:40:00 +0200
Subject: [PATCH] configure: improve check for POSIX ioctl

Instead of relying on system #ifdefs which may or may not be correct,
detect the POSIX ioctl signature at configure time.

(cherry picked from commit 00b64fca55a3a009c9d0e391c85f4fd3291e5d12)
Signed-off-by: Brad Smith <brad@comstyle.com>
---
configure | 2 ++
libavdevice/v4l2.c | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index c89d3ad1ec291..175b70e20735c 100755
--- a/configure
+++ b/configure
@@ -2340,6 +2340,7 @@ HAVE_LIST="
opencl_vaapi_intel_media
perl
pod2man
+ posix_ioctl
texi2html
"

@@ -6616,6 +6617,7 @@ rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || d
check_headers linux/fb.h
check_headers linux/videodev2.h
test_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete
+test_code cc sys/ioctl.h "int ioctl(int, int, ...)" && enable posix_ioctl

# check V4L2 codecs available in the API
if enabled v4l2_m2m; then
diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index 1dcbe04bb1741..f90490eebfc86 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -95,7 +95,7 @@ struct video_data {
int (*open_f)(const char *file, int oflag, ...);
int (*close_f)(int fd);
int (*dup_f)(int fd);
-#if defined(__sun) || defined(__BIONIC__) || defined(__musl__) /* POSIX-like */
+#if HAVE_POSIX_IOCTL
int (*ioctl_f)(int fd, int request, ...);
#else
int (*ioctl_f)(int fd, unsigned long int request, ...);
31 changes: 31 additions & 0 deletions srcpkgs/ffmpeg6/patches/00003-v4l-config.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
From 7405f1ad5351cc24b91a0227aeeaf24ff9d12278 Mon Sep 17 00:00:00 2001
From: Ramiro Polla <ramiro.polla@gmail.com>
Date: Wed, 3 Jul 2024 00:30:08 +0200
Subject: [PATCH] configure: restore autodetection of v4l2 and fbdev

The detection logic for v4l2 and fbdev was accidentally modified to
depend on v4l2-m2m in 43b3412.
---
configure | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index b28221f258965..fa2e384350958 100755
--- a/configure
+++ b/configure
@@ -7145,11 +7145,12 @@ pod2man --help > /dev/null 2>&1 && enable pod2man || disable pod2man
rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || disable rsync_contimeout
xmllint --version > /dev/null 2>&1 && enable xmllint || disable xmllint

+check_headers linux/fb.h
+check_headers linux/videodev2.h
+test_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete
+
# check V4L2 codecs available in the API
if enabled v4l2_m2m; then
- check_headers linux/fb.h
- check_headers linux/videodev2.h
- test_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete
check_cc v4l2_m2m linux/videodev2.h "int i = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_VIDEO_M2M | V4L2_BUF_FLAG_LAST;"
check_cc vc1_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VC1_ANNEX_G;"
check_cc mpeg1_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG1;"
45 changes: 45 additions & 0 deletions srcpkgs/ffmpeg6/patches/00004-v4l-ioctl-musl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
From 00b64fca55a3a009c9d0e391c85f4fd3291e5d12 Mon Sep 17 00:00:00 2001
From: Ramiro Polla <ramiro.polla@gmail.com>
Date: Thu, 29 Aug 2024 15:40:00 +0200
Subject: [PATCH] configure: improve check for POSIX ioctl

Instead of relying on system #ifdefs which may or may not be correct,
detect the POSIX ioctl signature at configure time.
---
configure | 2 ++
libavdevice/v4l2.c | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 44cfaebf21860..a8e67d230c4a9 100755
--- a/configure
+++ b/configure
@@ -2524,6 +2524,7 @@ HAVE_LIST="
opencl_videotoolbox
perl
pod2man
+ posix_ioctl
texi2html
xmllint
zlib_gzip
@@ -7166,6 +7167,7 @@ xmllint --version > /dev/null 2>&1 && enable xmllint || disable xmllint
check_headers linux/fb.h
check_headers linux/videodev2.h
test_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete
+test_code cc sys/ioctl.h "int ioctl(int, int, ...)" && enable posix_ioctl

# check V4L2 codecs available in the API
if enabled v4l2_m2m; then
diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index 42d4b97c8f701..0ae68723382f4 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -111,7 +111,7 @@ struct video_data {
int (*open_f)(const char *file, int oflag, ...);
int (*close_f)(int fd);
int (*dup_f)(int fd);
-#if defined(__sun) || defined(__BIONIC__) || defined(__musl__) /* POSIX-like */
+#if HAVE_POSIX_IOCTL
int (*ioctl_f)(int fd, int request, ...);
#else
int (*ioctl_f)(int fd, unsigned long int request, ...);
62 changes: 62 additions & 0 deletions srcpkgs/gst-plugins-good1/patches/musl-ioctl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
From dd1fc2b7931f5789815e17dda2ef7c31b9fba563 Mon Sep 17 00:00:00 2001
From: Alyssa Ross <hi@alyssa.is>
Date: Tue, 11 Mar 2025 16:36:58 +0100
Subject: [PATCH] v4l2object: fix type mismatch when ioctl takes int

v4l2object->ioctl can either be set to v4l2_ioctl() or ioctl().
v4l2_ioctl() always takes the request number as unsigned long int, but ioctl()
may take (at least) unsigned long int, int, or unsigned, depending on libc.
This means that there isn't one function pointer type that can be used for
v4l2object->ioctl that will always be able to accomodate being set to either of
v4l2_ioctl() and ioctl(). It's therefore necessary to wrap one of them so that
both options can have the same type. This fixes an assignment from incompatible
pointer type error when building for musl.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8613>
---
.../gst-plugins-good/sys/v4l2/gstv4l2object.c | 21 +++++++++++++++++++
1 file changed, 21 insertions(+)

diff --git a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c
index 288ff74477d7..5b7f45512459 100644
--- a/sys/v4l2/gstv4l2object.c
+++ b/sys/v4l2/gstv4l2object.c
@@ -528,6 +528,23 @@ v4l2_mmap_wrapper (gpointer start, gsize length, gint prot, gint flags, gint fd,
#define v4l2_mmap v4l2_mmap_wrapper

#endif /* SIZEOF_OFF_T < 8 */
+
+#if defined(__linux__) && !defined(__GLIBC__)
+/* v4l2_ioctl always takes request as unsigned long int, not ioctl_req_t */
+static gint
+v4l2_ioctl_wrapper (gint fd, ioctl_req_t request, ...)
+{
+ void *arg;
+ va_list ap;
+
+ va_start (ap, request);
+ arg = va_arg (ap, void *);
+ va_end (ap);
+
+ return v4l2_ioctl (fd, request, arg);
+}
+#endif /* defined(__linux__) && !defined(__GLIBC__) */
+
#endif /* HAVE_LIBV4L2 */

GstV4l2Object *
@@ -578,7 +595,11 @@ gst_v4l2_object_new (GstElement * element,
v4l2object->fd_open = v4l2_fd_open;
v4l2object->close = v4l2_close;
v4l2object->dup = v4l2_dup;
+#ifdef __GLIBC__
v4l2object->ioctl = v4l2_ioctl;
+#else
+ v4l2object->ioctl = v4l2_ioctl_wrapper;
+#endif
v4l2object->read = v4l2_read;
v4l2object->mmap = v4l2_mmap;
v4l2object->munmap = v4l2_munmap;
--
GitLab

56 changes: 56 additions & 0 deletions srcpkgs/v4l-utils/patches/musl-ioctl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
From fd882f9e77b13cbc6a669e6836c3943393b44152 Mon Sep 17 00:00:00 2001
From: Michal Rostecki <vadorovsky@gmail.com>
Date: Fri, 6 Sep 2024 14:46:31 +0200
Subject: libv4l2: Guard the v4l2_ioctl function with HAVE_POSIX_IOCTL

Lack of this check leads to issues on musl-based system. Even though
compilation of libv4l2 itself with musl doesn't cause any errors,
using the library inside gst-plugins-v4l2 causes a compiler error
due to mismatch of the ioctl signature.

A similar check is already performed in v4l2convert.c, so the change
doesn't bring any inconsistency.

Link: https://bugs.gentoo.org/896418
Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
---
lib/include/libv4l2.h | 4 ++++
lib/libv4l2/libv4l2.c | 4 ++++
2 files changed, 8 insertions(+)

diff --git a/lib/include/libv4l2.h b/lib/include/libv4l2.h
index ea1870db..16565555 100644
--- a/lib/include/libv4l2.h
+++ b/lib/include/libv4l2.h
@@ -63,7 +63,11 @@ LIBV4L_PUBLIC extern FILE *v4l2_log_file;
LIBV4L_PUBLIC int v4l2_open(const char *file, int oflag, ...);
LIBV4L_PUBLIC int v4l2_close(int fd);
LIBV4L_PUBLIC int v4l2_dup(int fd);
+#ifdef HAVE_POSIX_IOCTL
+LIBV4L_PUBLIC int v4l2_ioctl(int fd, int request, ...);
+#else
LIBV4L_PUBLIC int v4l2_ioctl(int fd, unsigned long int request, ...);
+#endif
LIBV4L_PUBLIC ssize_t v4l2_read(int fd, void *buffer, size_t n);
LIBV4L_PUBLIC ssize_t v4l2_write(int fd, const void *buffer, size_t n);
LIBV4L_PUBLIC void *v4l2_mmap(void *start, size_t length, int prot, int flags,
diff --git a/lib/libv4l2/libv4l2.c b/lib/libv4l2/libv4l2.c
index 032a4f1c..1607ec35 100644
--- a/lib/libv4l2/libv4l2.c
+++ b/lib/libv4l2/libv4l2.c
@@ -1051,7 +1051,11 @@ static int v4l2_s_fmt(int index, struct v4l2_format *dest_fmt)
return 0;
}

+#ifdef HAVE_POSIX_IOCTL
+int v4l2_ioctl(int fd, int request, ...)
+#else
int v4l2_ioctl(int fd, unsigned long int request, ...)
+#endif
{
void *arg;
va_list ap;
--
cgit v1.2.3

15 changes: 15 additions & 0 deletions srcpkgs/v4l-utils/patches/sbin.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Don't hardcode sbin path.

diff --git v4l-utils-1.26.1/utils/v4l2-dbg/meson.build~ v4l-utils-1.26.1/utils/v4l2-dbg/meson.build
index c23bf8f351..bfbc10c616 100644
--- v4l-utils-1.26.1/utils/v4l2-dbg/meson.build~
+++ v4l-utils-1.26.1/utils/v4l2-dbg/meson.build
@@ -13,7 +13,7 @@ v4l2_dbg_sources = files(
v4l2_dbg = executable('v4l2-dbg',
v4l2_dbg_sources,
install : true,
- install_dir : 'sbin',
+ install_dir : get_option('sbindir'),
include_directories : [
v4l2_utils_incdir,
utils_common_incdir,
13 changes: 5 additions & 8 deletions srcpkgs/v4l-utils/template
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Template file for 'v4l-utils'
pkgname=v4l-utils
version=1.24.1
version=1.28.1
revision=1
build_style=gnu-configure
configure_args="--disable-qv4l2 --with-udevdir=/usr/lib/udev"
build_style=meson
configure_args="-Dqv4l2=disabled -Dudevdir=/usr/lib/udev -Dgconv=disabled"
hostmakedepends="perl pkg-config gettext-devel"
makedepends="libjpeg-turbo-devel libsysfs-devel eudev-libudev-devel alsa-lib-devel
libX11-devel"
Expand All @@ -12,8 +12,8 @@ maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2.0-or-later, LGPL-2.1-or-later"
homepage="https://linuxtv.org/"
changelog="https://git.linuxtv.org/v4l-utils.git/plain/ChangeLog"
distfiles="https://linuxtv.org/downloads/v4l-utils/v4l-utils-${version}.tar.bz2"
checksum=cbb7fe8a6307f5ce533a05cded70bb93c3ba06395ab9b6d007eb53b75d805f5b
distfiles="https://linuxtv.org/downloads/v4l-utils/v4l-utils-${version}.tar.xz"
checksum=0fa075ce59b6618847af6ea191b6155565ccaa44de0504581ddfed795a328a82
conf_files="/etc/rc_maps.cfg"

case "$XBPS_TARGET_MACHINE" in
Expand All @@ -23,15 +23,12 @@ case "$XBPS_TARGET_MACHINE" in
;;
esac

CFLAGS+=" -fcommon"

v4l-utils-devel_package() {
depends="${makedepends} ${sourcepkg}>=${version}_${revision}"
short_desc+=" - development files"
pkg_install() {
vmove usr/include
vmove usr/lib/pkgconfig
vmove "usr/lib/*.a"
vmove "usr/lib/*.so"
}
}
Loading