From 89e0ede12fcf26807c911012b6a02bc3bac77a0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Wed, 23 Apr 2025 20:09:08 +0800 Subject: [PATCH] Camera (OpenBSD): add support --- src/detection/camera/camera_linux.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/detection/camera/camera_linux.c b/src/detection/camera/camera_linux.c index e83f385b0..8c1cfd0ab 100644 --- a/src/detection/camera/camera_linux.c +++ b/src/detection/camera/camera_linux.c @@ -7,6 +7,9 @@ #if FF_HAVE_LINUX_VIDEODEV2 #include +#elif __has_include() // OpenBSD + #include + #define FF_HAVE_LINUX_VIDEODEV2 1 #endif const char* ffDetectCamera(FFlist* result) @@ -19,7 +22,13 @@ const char* ffDetectCamera(FFlist* result) path[ARRAY_SIZE(path) - 2] = (char) (i + '0'); FF_AUTO_CLOSE_FD int fd = open(path, O_RDONLY); if (fd < 0) - break; + { + if (errno == ENOENT) + break; + if (errno == ENXIO) + continue; + return "Failed to open /dev/videoN"; + } struct v4l2_capability cap = {}; if (ioctl(fd, VIDIOC_QUERYCAP, &cap) < 0 || !(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE))