aboutsummaryrefslogtreecommitdiff
path: root/multimedia/libv4l
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2021-04-21 15:49:00 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2021-04-21 15:51:47 +0000
commit3a28080660e54a820fd7eedfae8ec768945d223c (patch)
tree88c3148266a5728c5f33bb68ed345b7f3045b59a /multimedia/libv4l
parent55f69b2ce523168a96cbf024169143ae94ccfc98 (diff)
downloadports-3a28080660e54a820fd7eedfae8ec768945d223c.tar.gz
ports-3a28080660e54a820fd7eedfae8ec768945d223c.zip
multimedia/libv4l: Add upstream patch to make the v4l2-ctl utility more useful.
Submitted by: Trenton Schulz <trenton@norwegianrockcat.com> Approved by: pi (implicit)
Diffstat (limited to 'multimedia/libv4l')
-rw-r--r--multimedia/libv4l/Makefile1
-rw-r--r--multimedia/libv4l/files/patch-utils_common_media-info.cpp46
2 files changed, 47 insertions, 0 deletions
diff --git a/multimedia/libv4l/Makefile b/multimedia/libv4l/Makefile
index f89b670b9516..e24c4033c92c 100644
--- a/multimedia/libv4l/Makefile
+++ b/multimedia/libv4l/Makefile
@@ -3,6 +3,7 @@
PORTNAME?= libv4l
PORTVERSION= 1.20.0
+PORTREVISION= 1
DISTVERSIONPREFIX= v4l-utils-
CATEGORIES= multimedia
diff --git a/multimedia/libv4l/files/patch-utils_common_media-info.cpp b/multimedia/libv4l/files/patch-utils_common_media-info.cpp
new file mode 100644
index 000000000000..f4c3dc6a306d
--- /dev/null
+++ b/multimedia/libv4l/files/patch-utils_common_media-info.cpp
@@ -0,0 +1,46 @@
+--- utils/common/media-info.cpp.orig 2020-05-21 11:22:05 UTC
++++ utils/common/media-info.cpp
+@@ -24,6 +24,10 @@
+ #include <iostream>
+ #include <fstream>
+ #include <media-info.h>
++#ifndef __linux__
++#include <linux/videodev2.h>
++#include <fcntl.h>
++#endif
+
+ static std::string num2s(unsigned num, bool is_hex = true)
+ {
+@@ -61,7 +65,7 @@ media_type mi_media_detect_type(const char *device)
+
+ if (stat(device, &sb) == -1)
+ return MEDIA_TYPE_CANT_STAT;
+-
++#ifdef __linux__
+ std::string uevent_path("/sys/dev/char/");
+
+ uevent_path += num2s(major(sb.st_rdev), false) + ":" +
+@@ -97,6 +101,23 @@ media_type mi_media_detect_type(const char *device)
+ }
+
+ uevent_file.close();
++#else // Not Linux
++ int fd = open(device, O_RDONLY);
++ if (fd >= 0) {
++ struct v4l2_capability caps;
++ int error = ioctl(fd, VIDIOC_QUERYCAP, &caps);
++ close(fd);
++ if (error == 0) {
++ if (caps.device_caps & V4L2_CAP_VIDEO_CAPTURE) {
++ return MEDIA_TYPE_VIDEO;
++ } else if (caps.device_caps & V4L2_CAP_VBI_CAPTURE) {
++ return MEDIA_TYPE_VBI;
++ } else if (caps.device_caps & V4L2_CAP_RADIO) {
++ return MEDIA_TYPE_RADIO;
++ }
++ }
++ }
++#endif
+ return MEDIA_TYPE_UNKNOWN;
+ }
+