From fd80676dbd8f40387650618860f0ec79bbb98000 Mon Sep 17 00:00:00 2001 From: Christoph Moench-Tegeder Date: Wed, 6 May 2020 13:53:34 +0000 Subject: [PATCH] gstreamer1-plugins-v4l2: fix for (some) webcams The gstreamer v4l2 plugin probes the DMA capabilities of the webcam device via ioctl VIDIOC_EXPBUF, expecting ENOTTY in case that's not implemented (and will act accordingly). On our cuse, we get EINVAL for that case (which, from my reading of ioctl(2) woulndn't be correct here), which gstreamer neither expects nor handles and thus cannot use this device as a video source. As we cannot fix the kernel on short notice (cuse is part of the base system), the workaround is to handle EINVAL like ENOTTY in this specific place. (Tested with an old Logitech camera). PR: 236673 Approved by: maintainer-timeout (multimedia) --- .../files/patch-sys_v4l2_gstv4l2object.c | 13 +++++++++++++ multimedia/gstreamer1-plugins-v4l2/Makefile | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 multimedia/gstreamer1-plugins-good/files/patch-sys_v4l2_gstv4l2object.c diff --git a/multimedia/gstreamer1-plugins-good/files/patch-sys_v4l2_gstv4l2object.c b/multimedia/gstreamer1-plugins-good/files/patch-sys_v4l2_gstv4l2object.c new file mode 100644 index 000000000000..736cd618765c --- /dev/null +++ b/multimedia/gstreamer1-plugins-good/files/patch-sys_v4l2_gstv4l2object.c @@ -0,0 +1,13 @@ +--- sys/v4l2/gstv4l2object.c.orig 2020-04-06 14:45:19 UTC ++++ sys/v4l2/gstv4l2object.c +@@ -2891,8 +2891,9 @@ gst_v4l2_object_is_dmabuf_supported (GstV4l2Object * v + } + + /* Expected to fail, but ENOTTY tells us that it is not implemented. */ ++ /* FreeBSD cuse sends EINVAL? */ + v4l2object->ioctl (v4l2object->video_fd, VIDIOC_EXPBUF, &expbuf); +- if (errno == ENOTTY) ++ if (errno == ENOTTY || errno == EINVAL) + ret = FALSE; + + return ret; diff --git a/multimedia/gstreamer1-plugins-v4l2/Makefile b/multimedia/gstreamer1-plugins-v4l2/Makefile index 88da2ba24fa6..37f0df863983 100644 --- a/multimedia/gstreamer1-plugins-v4l2/Makefile +++ b/multimedia/gstreamer1-plugins-v4l2/Makefile @@ -1,6 +1,6 @@ # $FreeBSD$ -PORTREVISION= 0 +PORTREVISION= 1 CATEGORIES= multimedia PKGNAMESUFFIX= 1-plugins-v4l2