aboutsummaryrefslogtreecommitdiff
path: root/multimedia
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2020-04-17 08:34:50 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2020-04-17 08:34:50 +0000
commit6dd2426803c57693b1c944d66a30266929466167 (patch)
treef623ad1ba5654653de2bb246ee7f1d6cc288ac2e /multimedia
parent9654b0081a48d99970b7acd5175c15944f27141b (diff)
downloadports-6dd2426803c57693b1c944d66a30266929466167.tar.gz
ports-6dd2426803c57693b1c944d66a30266929466167.zip
Notes
Diffstat (limited to 'multimedia')
-rw-r--r--multimedia/libv4l/Makefile122
-rw-r--r--multimedia/libv4l/distinfo9
-rw-r--r--multimedia/libv4l/files/extra-linux_dvb_ca.h20
-rw-r--r--multimedia/libv4l/files/extra-linux_dvb_osd.h11
-rw-r--r--multimedia/libv4l/files/extra-patch-configure78
-rw-r--r--multimedia/libv4l/files/patch-configure11
-rw-r--r--multimedia/libv4l/files/patch-contrib_freebsd_include_linux_videodev2.h662
-rw-r--r--multimedia/libv4l/files/patch-include_linux_dvb_frontend.h17
-rw-r--r--multimedia/libv4l/files/patch-include_linux_dvb_video.h11
-rw-r--r--multimedia/libv4l/files/patch-lib_Makefile.in13
-rw-r--r--multimedia/libv4l/files/patch-lib_include_libdvbv5_descriptors.h20
-rw-r--r--multimedia/libv4l/files/patch-lib_include_libdvbv5_dvb-frontend.h19
-rw-r--r--multimedia/libv4l/files/patch-lib_libdvbv5_dvb-dev-remote.c14
-rw-r--r--multimedia/libv4l/files/patch-lib_libv4lconvert_control_libv4lcontrol.c10
-rw-r--r--multimedia/libv4l/files/patch-lib_libv4lconvert_jpeg__memsrcdest.h16
-rw-r--r--multimedia/libv4l/files/patch-lib_libv4lconvert_rgbyuv.c11
-rw-r--r--multimedia/libv4l/files/patch-utils_Makefile.in11
-rw-r--r--multimedia/libv4l/files/patch-utils_cec-ctl_msg2ctl.pl11
-rw-r--r--multimedia/libv4l/files/patch-utils_common_ir-encode.c322
-rw-r--r--multimedia/libv4l/files/patch-utils_common_keymap.h32
-rw-r--r--multimedia/libv4l/files/patch-utils_common_v4l2-tpg.h12
-rw-r--r--multimedia/libv4l/files/patch-utils_dvb_dvbv5-daemon.c14
-rw-r--r--multimedia/libv4l/files/patch-utils_ir-ctl_bpf__encoder.c50
-rw-r--r--multimedia/libv4l/files/patch-utils_ir-ctl_ir-ctl.c10
-rw-r--r--multimedia/libv4l/files/patch-utils_media-ctl_media-ctl.c11
-rw-r--r--multimedia/libv4l/files/patch-utils_v4l2-compliance_v4l2-test-buffers.cpp30
-rw-r--r--multimedia/libv4l/files/patch-utils_v4l2-ctl_v4l2-ctl-overlay.cpp42
-rw-r--r--multimedia/libv4l/files/patch-utils_v4l2-ctl_v4l2-ctl.cpp54
-rw-r--r--multimedia/libv4l/files/types.h35
-rw-r--r--multimedia/libv4l/pkg-plist3
-rw-r--r--multimedia/v4l-utils/Makefile1
-rw-r--r--multimedia/v4l-utils/pkg-plist31
-rw-r--r--multimedia/v4l_compat/Makefile57
-rw-r--r--multimedia/v4l_compat/pkg-plist10
34 files changed, 791 insertions, 989 deletions
diff --git a/multimedia/libv4l/Makefile b/multimedia/libv4l/Makefile
index 252e8d910209..97e5f1184741 100644
--- a/multimedia/libv4l/Makefile
+++ b/multimedia/libv4l/Makefile
@@ -3,13 +3,14 @@
# Check v4l_compat and v4l-utils slave ports
PORTNAME?= libv4l
-PORTVERSION= 1.6.3
-PORTREVISION?= 4
+PORTVERSION= 1.18.0
CATEGORIES= multimedia
MASTER_SITES= http://linuxtv.org/downloads/v4l-utils/:master \
- LOCAL/kwm:local
-DISTFILES+= v4l-utils-${PORTVERSION}.tar.bz2:master \
- linux-3.16.7-dvb-headers.tar.xz:local
+ http://www.selasky.org/hans_petter/distfiles/:local \
+ http://home.selasky.org/distfiles/:local
+WEBCAMDVERSION= 5.7.1.1
+DISTFILES= v4l-utils-${PORTVERSION}.tar.bz2:master \
+ webcamd-${WEBCAMDVERSION}.tar.bz2:local
MAINTAINER= multimedia@FreeBSD.org
COMMENT?= Video4Linux library
@@ -21,51 +22,100 @@ USES= tar:bzip2
WRKSRC= ${WRKDIR}/v4l-utils-${PORTVERSION}
.if ${PORTNAME} == v4l-utils || ${PORTNAME} == libv4l
-BUILD_DEPENDS+= v4l_compat>=${PORTVERSION}:multimedia/v4l_compat
+LIB_DEPENDS+= libargp.so:devel/argp-standalone \
+ libudev.so:devel/libudev-devd
+BUILD_DEPENDS+= gsed>0:textproc/gsed \
+ v4l_compat>=${PORTVERSION}:multimedia/v4l_compat
GNU_CONFIGURE= yes
CPPFLAGS+= -I${LOCALBASE}/include
LDFLAGS+= -L${LOCALBASE}/lib
USES+= gmake iconv jpeg libtool pathfix pkgconfig
USE_LDCONFIG= yes
-CONFIGURE_ARGS= --enable-libdvbv5 \
- --disable-qv4l2 \
- --without-libudev
+CONFIGURE_ARGS= \
+ --disable-qv4l2 \
+ --disable-qvidcap \
+ --disable-nls
INSTALL_TARGET= install-strip
+.endif
+
+.if ${PORTNAME} == v4l_compat
+RUN_DEPENDS+= evdev-proto>=5.3:devel/evdev-proto
+.endif
-. if ${PORTNAME} == v4l-utils
+.if ${PORTNAME} == v4l-utils
+USES+= perl5
BUILD_DEPENDS+= libv4l>=${PORTVERSION}:multimedia/libv4l
-LIB_DEPENDS+= libargp.so:devel/argp-standalone \
+LIB_DEPENDS+= libepoll-shim.so:devel/libepoll-shim \
libv4l2.so:multimedia/libv4l
-# Disabling building libv4l in the utils slave is too much hackery
-# Lets wait for subpackages
-CONFIGURE_ARGS+=--enable-v4l-utils
-. else
-CONFIGURE_ARGS+=--disable-v4l-utils --enable-libv4l
-EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-configure
-. endif
+LDFLAGS+= -lepoll-shim
+CONFIGURE_ARGS+= \
+ --enable-v4l-utils \
+ --without-v4l2-compliance
.endif
-HEADER_PATCHES= extra-linux_dvb_ca.h \
- extra-linux_dvb_osd.h \
- patch-include_linux_dvb_frontend.h \
- patch-include_linux_dvb_video.h
+.if ${PORTNAME} == libv4l
+CONFIGURE_ARGS+= \
+ --disable-v4l-utils \
+ --enable-dyn-libv4l \
+ --enable-libdvbv5
+.endif
post-patch:
- @${REINPLACE_CMD} -e 's|$$libdir/pkgconfig|${PREFIX}/libdata/pkgconfig|g' \
- ${WRKSRC}/configure
-# fix weird types, except a few headers which have compat code for these types.
- @${FIND} ${WRKDIR} -type f \( -iname "*.h" ! -iname "input.h" ! -iname "videodev2.h" \) | \
+# Remove old FreeBSD include files (to be removed upstream)
+ @${RM} -r ${WRKDIR}/v4l-utils-${PORTVERSION}/contrib/freebsd/include/*
+# Apply webcamd patches first
+ @(cd ${WRKDIR}/webcamd-${WEBCAMDVERSION}/patches && ${SH} ./do_patch.sh)
+# Patch Makefiles to use GNU-sed
+ @${FIND} ${WRKDIR}/v4l-utils-${PORTVERSION} -type f \( -iname "Makefile*" \) | \
${XARGS} -n 10 ${REINPLACE_CMD} \
- -e 's|linux/types.h|sys/types.h|g; s|__user||g; \
- s|__u8|uint8_t|g; s|__s8|int8_t|g; \
- s|__u16|uint16_t|g; s|__s16|int16_t|g; \
- s|__u32|uint32_t|g; s|__s32|int32_t|g; \
- s|__u64|uint64_t|g; s|__s64|int64_t|g'
-.if ${PORTNAME} == v4l_compat
-.for patch in ${HEADER_PATCHES}
- @cd ${WRKDIR}/linux && ${PATCH} -p2 < ${FILESDIR}/${patch}
-.endfor
-.endif
+ -e 's|^\([[:space:]]*\)sed |\1${LOCALBASE}/bin/gsed |'
+# Patch all source files
+ @${FIND} ${WRKDIR} -type f \( -iname "*.[ch]" -or -iname "*.cpp" -or -iname "msg2ctl.pl" \) | \
+ ${XARGS} -n 10 ${REINPLACE_CMD} \
+ -e 's|__inline__|inline|g' \
+ -e 's|__u8|uint8_t|g' \
+ -e 's|__s8|int8_t|g' \
+ -e 's|__le16|uint16_t|g' \
+ -e 's|__be16|uint16_t|g' \
+ -e 's|__u16|uint16_t|g' \
+ -e 's|__s16|int16_t|g' \
+ -e 's|__le32|uint32_t|g' \
+ -e 's|__be32|uint32_t|g' \
+ -e 's|__u32|uint32_t|g' \
+ -e 's|__s32|int32_t|g' \
+ -e 's|__le64|uint64_t|g' \
+ -e 's|__be64|uint64_t|g' \
+ -e 's|__u64|uint64_t|g' \
+ -e 's|__s64|int64_t|g' \
+ -e 's|uint16_t_to_cpu|letoh16|g' \
+ -e 's|uint32_t_to_cpu|letoh32|g' \
+ -e 's|uint64_t_to_cpu|letoh64|g' \
+ -e 's|error_t|int|g' \
+ -e 's|"gettext.h"|<stdio.h>|g' \
+ -e 's|MSG_MORE|0|g' \
+ -e 's|EBADR|EFAULT|g' \
+ -e 's|ENONET|EHOSTDOWN|g' \
+ -e 's|_IOC_READ|IOC_OUT|g' \
+ -e 's|_IOC_WRITE|IOC_IN|g' \
+ -e 's|_IOC_NONE|IOC_VOID|g' \
+ -e 's|<endian.h>|<sys/endian.h>|g' \
+ -e 's|<linux/compiler.h>|<sys/cdefs.h>|g' \
+ -e 's|<linux/errno.h>|<errno.h>|g' \
+ -e 's|<linux/ioctl.h>|<sys/ioctl.h>|g' \
+ -e 's|<linux/kernel.h>|<sys/sysinfo.h>|g' \
+ -e 's|<linux/string.h>|<string.h>|g' \
+ -e 's|<linux/sysmacros.h>|<sys/types.h>|g' \
+ -e 's|<malloc.h>|<stdlib.h>|g' \
+ -e 's|<sys/epoll.h>|<libepoll-shim/sys/epoll.h>|g' \
+ -e 's|<sys/sysmacros.h>|<sys/types.h>|g' \
+ -e 's|/usr/bin/perl|${LOCALBASE}/bin/perl|g' \
+ -e 's|__user||g'
+
+# Duplicate some files to avoid patching
+ @${CP} ${WRKSRC}/utils/common/ir-encode.c ${WRKSRC}/utils/ir-ctl/ir-encode.c
+ @${CP} ${WRKSRC}/utils/common/ir-encode.c ${WRKSRC}/utils/keytable/ir-encode.c
+ @${CP} ${WRKSRC}/utils/common/keymap.h ${WRKSRC}/utils/ir-ctl/keymap.h
+ @${CP} ${WRKSRC}/utils/common/keymap.h ${WRKSRC}/utils/keytable/keymap.h
.include <bsd.port.mk>
diff --git a/multimedia/libv4l/distinfo b/multimedia/libv4l/distinfo
index 69a66754e59b..a977eec67f25 100644
--- a/multimedia/libv4l/distinfo
+++ b/multimedia/libv4l/distinfo
@@ -1,4 +1,5 @@
-SHA256 (v4l-utils-1.6.3.tar.bz2) = 164abf5c1befcd27e8e6ef824a82d4015bdfb5d99ae82daa00e77d895ff9864c
-SIZE (v4l-utils-1.6.3.tar.bz2) = 1151081
-SHA256 (linux-3.16.7-dvb-headers.tar.xz) = 0ee217b243d52b8104e6b61bbf009bf84155573317720f41930af0a9ef50cdaa
-SIZE (linux-3.16.7-dvb-headers.tar.xz) = 11712
+TIMESTAMP = 1587021105
+SHA256 (v4l-utils-1.18.0.tar.bz2) = 6cb60d822eeed20486a03cc23e0fc65956fbc1e85e0c1a7477f68bbd9802880d
+SIZE (v4l-utils-1.18.0.tar.bz2) = 1995506
+SHA256 (webcamd-5.7.1.1.tar.bz2) = e803b245d0e1ecaf5ff07c5a9700f0951d065827d4907c4615369afab3c102c2
+SIZE (webcamd-5.7.1.1.tar.bz2) = 14370502
diff --git a/multimedia/libv4l/files/extra-linux_dvb_ca.h b/multimedia/libv4l/files/extra-linux_dvb_ca.h
deleted file mode 100644
index d1352f6ed8f7..000000000000
--- a/multimedia/libv4l/files/extra-linux_dvb_ca.h
+++ /dev/null
@@ -1,20 +0,0 @@
---- ../linux/dvb/ca.h.orig 2014-12-01 10:58:18.000000000 +0100
-+++ ../linux/dvb/ca.h 2015-01-23 22:41:21.761540460 +0100
-@@ -80,9 +80,17 @@
-
- #define CA_RESET _IO('o', 128)
- #define CA_GET_CAP _IOR('o', 129, ca_caps_t)
-+
-+/* At least CA_GET_SLOT_INFO and CA_GET_MSG need to be _IOWR not _IOR.
-+ * This is wrong on Linux too but there the driver doesn't care.
-+ *
- #define CA_GET_SLOT_INFO _IOR('o', 130, ca_slot_info_t)
- #define CA_GET_DESCR_INFO _IOR('o', 131, ca_descr_info_t)
- #define CA_GET_MSG _IOR('o', 132, ca_msg_t)
-+ */
-+#define CA_GET_SLOT_INFO _IOWR('o', 130, ca_slot_info_t)
-+#define CA_GET_DESCR_INFO _IOR('o', 131, ca_descr_info_t)
-+#define CA_GET_MSG _IOWR('o', 132, ca_msg_t)
- #define CA_SEND_MSG _IOW('o', 133, ca_msg_t)
- #define CA_SET_DESCR _IOW('o', 134, ca_descr_t)
- #define CA_SET_PID _IOW('o', 135, ca_pid_t)
diff --git a/multimedia/libv4l/files/extra-linux_dvb_osd.h b/multimedia/libv4l/files/extra-linux_dvb_osd.h
deleted file mode 100644
index 55d9806c0c39..000000000000
--- a/multimedia/libv4l/files/extra-linux_dvb_osd.h
+++ /dev/null
@@ -1,11 +0,0 @@
---- ../linux/dvb/osd.h.bak 2014-12-01 10:58:18.000000000 +0100
-+++ ../linux/dvb/osd.h 2015-01-24 00:12:54.252160592 +0100
-@@ -24,7 +24,7 @@
- #ifndef _DVBOSD_H_
- #define _DVBOSD_H_
-
--#include <linux/compiler.h>
-+#include <sys/types.h>
-
- typedef enum {
- // All functions return -2 on "not open"
diff --git a/multimedia/libv4l/files/extra-patch-configure b/multimedia/libv4l/files/extra-patch-configure
deleted file mode 100644
index b7ad34c75b03..000000000000
--- a/multimedia/libv4l/files/extra-patch-configure
+++ /dev/null
@@ -1,78 +0,0 @@
---- configure.orig 2015-08-12 21:40:16 UTC
-+++ configure
-@@ -18563,75 +18563,6 @@ fi
-
- LIBS=$dl_saved_libs
-
--ac_fn_c_check_header_mongrel "$LINENO" "argp.h" "ac_cv_header_argp_h" "$ac_includes_default"
--if test "x$ac_cv_header_argp_h" = xyes; then :
--
--else
-- as_fn_error $? "Cannot continue: argp.h not found" "$LINENO" 5
--fi
--
--
--argp_saved_libs=$LIBS
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing argp_parse" >&5
--$as_echo_n "checking for library containing argp_parse... " >&6; }
--if ${ac_cv_search_argp_parse+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- ac_func_search_save_LIBS=$LIBS
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--/* Override any GCC internal prototype to avoid an error.
-- Use char because int might match the return type of a GCC
-- builtin and then its argument prototype would still apply. */
--#ifdef __cplusplus
--extern "C"
--#endif
--char argp_parse ();
--int
--main ()
--{
--return argp_parse ();
-- ;
-- return 0;
--}
--_ACEOF
--for ac_lib in '' argp; do
-- if test -z "$ac_lib"; then
-- ac_res="none required"
-- else
-- ac_res=-l$ac_lib
-- LIBS="-l$ac_lib $ac_func_search_save_LIBS"
-- fi
-- if ac_fn_c_try_link "$LINENO"; then :
-- ac_cv_search_argp_parse=$ac_res
--fi
--rm -f core conftest.err conftest.$ac_objext \
-- conftest$ac_exeext
-- if ${ac_cv_search_argp_parse+:} false; then :
-- break
--fi
--done
--if ${ac_cv_search_argp_parse+:} false; then :
--
--else
-- ac_cv_search_argp_parse=no
--fi
--rm conftest.$ac_ext
--LIBS=$ac_func_search_save_LIBS
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_argp_parse" >&5
--$as_echo "$ac_cv_search_argp_parse" >&6; }
--ac_res=$ac_cv_search_argp_parse
--if test "$ac_res" != no; then :
-- test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-- test "$ac_cv_search_argp_parse" = "none required" || ARGP_LIBS=$ac_cv_search_argp_parse
--else
-- as_fn_error $? "unable to find the argp_parse() function" "$LINENO" 5
--fi
--
--
--LIBS=$argp_saved_libs
-
- ac_fn_c_check_header_mongrel "$LINENO" "linux/i2c-dev.h" "ac_cv_header_linux_i2c_dev_h" "$ac_includes_default"
- if test "x$ac_cv_header_linux_i2c_dev_h" = xyes; then :
diff --git a/multimedia/libv4l/files/patch-configure b/multimedia/libv4l/files/patch-configure
deleted file mode 100644
index 88cb70f21836..000000000000
--- a/multimedia/libv4l/files/patch-configure
+++ /dev/null
@@ -1,11 +0,0 @@
---- configure.orig 2015-01-25 19:42:02.248041140 +0100
-+++ configure 2015-01-25 19:42:14.503036421 +0100
-@@ -19876,7 +19876,7 @@
- WITH_LIBV4L_FALSE=
- fi
-
-- if test x$enable_v4l_utils != xno -a x$linux_os = xyes; then
-+ if test x$enable_v4l_utils != xno; then
- WITH_V4LUTILS_TRUE=
- WITH_V4LUTILS_FALSE='#'
- else
diff --git a/multimedia/libv4l/files/patch-contrib_freebsd_include_linux_videodev2.h b/multimedia/libv4l/files/patch-contrib_freebsd_include_linux_videodev2.h
deleted file mode 100644
index 3ed8ccb394bb..000000000000
--- a/multimedia/libv4l/files/patch-contrib_freebsd_include_linux_videodev2.h
+++ /dev/null
@@ -1,662 +0,0 @@
---- contrib/freebsd/include/linux/videodev2.h.orig 2015-05-06 19:24:59 UTC
-+++ contrib/freebsd/include/linux/videodev2.h
-@@ -46,7 +46,7 @@
- * All kernel-specific stuff were moved to media/v4l2-dev.h, so
- * no #if __KERNEL tests are allowed here
- *
-- * See http://linuxtv.org for more info
-+ * See https://linuxtv.org for more info
- *
- * Author: Bill Dirks <bill@thedirks.org>
- * Justin Schoeman
-@@ -170,13 +170,12 @@ enum v4l2_buf_type {
- V4L2_BUF_TYPE_VBI_OUTPUT = 5,
- V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6,
- V4L2_BUF_TYPE_SLICED_VBI_OUTPUT = 7,
--#if 1
-- /* Experimental */
- V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY = 8,
--#endif
- V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE = 9,
- V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE = 10,
- V4L2_BUF_TYPE_SDR_CAPTURE = 11,
-+ V4L2_BUF_TYPE_SDR_OUTPUT = 12,
-+ V4L2_BUF_TYPE_META_CAPTURE = 13,
- /* Deprecated, do not use */
- V4L2_BUF_TYPE_PRIVATE = 0x80,
- };
-@@ -191,16 +190,20 @@ enum v4l2_buf_type {
- || (type) == V4L2_BUF_TYPE_VIDEO_OVERLAY \
- || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY \
- || (type) == V4L2_BUF_TYPE_VBI_OUTPUT \
-- || (type) == V4L2_BUF_TYPE_SLICED_VBI_OUTPUT)
-+ || (type) == V4L2_BUF_TYPE_SLICED_VBI_OUTPUT \
-+ || (type) == V4L2_BUF_TYPE_SDR_OUTPUT)
-
- enum v4l2_tuner_type {
- V4L2_TUNER_RADIO = 1,
- V4L2_TUNER_ANALOG_TV = 2,
- V4L2_TUNER_DIGITAL_TV = 3,
-- V4L2_TUNER_ADC = 4,
-+ V4L2_TUNER_SDR = 4,
- V4L2_TUNER_RF = 5,
- };
-
-+/* Deprecated, do not use */
-+#define V4L2_TUNER_ADC V4L2_TUNER_SDR
-+
- enum v4l2_memory {
- V4L2_MEMORY_MMAP = 1,
- V4L2_MEMORY_USERPTR = 2,
-@@ -210,32 +213,206 @@ enum v4l2_memory {
-
- /* see also http://vektor.theorem.ca/graphics/ycbcr/ */
- enum v4l2_colorspace {
-- /* ITU-R 601 -- broadcast NTSC/PAL */
-+ /*
-+ * Default colorspace, i.e. let the driver figure it out.
-+ * Can only be used with video capture.
-+ */
-+ V4L2_COLORSPACE_DEFAULT = 0,
-+
-+ /* SMPTE 170M: used for broadcast NTSC/PAL SDTV */
- V4L2_COLORSPACE_SMPTE170M = 1,
-
-- /* 1125-Line (US) HDTV */
-+ /* Obsolete pre-1998 SMPTE 240M HDTV standard, superseded by Rec 709 */
- V4L2_COLORSPACE_SMPTE240M = 2,
-
-- /* HD and modern captures. */
-+ /* Rec.709: used for HDTV */
- V4L2_COLORSPACE_REC709 = 3,
-
-- /* broken BT878 extents (601, luma range 16-253 instead of 16-235) */
-+ /*
-+ * Deprecated, do not use. No driver will ever return this. This was
-+ * based on a misunderstanding of the bt878 datasheet.
-+ */
- V4L2_COLORSPACE_BT878 = 4,
-
-- /* These should be useful. Assume 601 extents. */
-+ /*
-+ * NTSC 1953 colorspace. This only makes sense when dealing with
-+ * really, really old NTSC recordings. Superseded by SMPTE 170M.
-+ */
- V4L2_COLORSPACE_470_SYSTEM_M = 5,
-+
-+ /*
-+ * EBU Tech 3213 PAL/SECAM colorspace. This only makes sense when
-+ * dealing with really old PAL/SECAM recordings. Superseded by
-+ * SMPTE 170M.
-+ */
- V4L2_COLORSPACE_470_SYSTEM_BG = 6,
-
-- /* I know there will be cameras that send this. So, this is
-- * unspecified chromaticities and full 0-255 on each of the
-- * Y'CbCr components
-+ /*
-+ * Effectively shorthand for V4L2_COLORSPACE_SRGB, V4L2_YCBCR_ENC_601
-+ * and V4L2_QUANTIZATION_FULL_RANGE. To be used for (Motion-)JPEG.
- */
- V4L2_COLORSPACE_JPEG = 7,
-
-- /* For RGB colourspaces, this is probably a good start. */
-+ /* For RGB colorspaces such as produces by most webcams. */
- V4L2_COLORSPACE_SRGB = 8,
-+
-+ /* AdobeRGB colorspace */
-+ V4L2_COLORSPACE_ADOBERGB = 9,
-+
-+ /* BT.2020 colorspace, used for UHDTV. */
-+ V4L2_COLORSPACE_BT2020 = 10,
-+
-+ /* Raw colorspace: for RAW unprocessed images */
-+ V4L2_COLORSPACE_RAW = 11,
-+
-+ /* DCI-P3 colorspace, used by cinema projectors */
-+ V4L2_COLORSPACE_DCI_P3 = 12,
- };
-
-+/*
-+ * Determine how COLORSPACE_DEFAULT should map to a proper colorspace.
-+ * This depends on whether this is a SDTV image (use SMPTE 170M), an
-+ * HDTV image (use Rec. 709), or something else (use sRGB).
-+ */
-+#define V4L2_MAP_COLORSPACE_DEFAULT(is_sdtv, is_hdtv) \
-+ ((is_sdtv) ? V4L2_COLORSPACE_SMPTE170M : \
-+ ((is_hdtv) ? V4L2_COLORSPACE_REC709 : V4L2_COLORSPACE_SRGB))
-+
-+enum v4l2_xfer_func {
-+ /*
-+ * Mapping of V4L2_XFER_FUNC_DEFAULT to actual transfer functions
-+ * for the various colorspaces:
-+ *
-+ * V4L2_COLORSPACE_SMPTE170M, V4L2_COLORSPACE_470_SYSTEM_M,
-+ * V4L2_COLORSPACE_470_SYSTEM_BG, V4L2_COLORSPACE_REC709 and
-+ * V4L2_COLORSPACE_BT2020: V4L2_XFER_FUNC_709
-+ *
-+ * V4L2_COLORSPACE_SRGB, V4L2_COLORSPACE_JPEG: V4L2_XFER_FUNC_SRGB
-+ *
-+ * V4L2_COLORSPACE_ADOBERGB: V4L2_XFER_FUNC_ADOBERGB
-+ *
-+ * V4L2_COLORSPACE_SMPTE240M: V4L2_XFER_FUNC_SMPTE240M
-+ *
-+ * V4L2_COLORSPACE_RAW: V4L2_XFER_FUNC_NONE
-+ *
-+ * V4L2_COLORSPACE_DCI_P3: V4L2_XFER_FUNC_DCI_P3
-+ */
-+ V4L2_XFER_FUNC_DEFAULT = 0,
-+ V4L2_XFER_FUNC_709 = 1,
-+ V4L2_XFER_FUNC_SRGB = 2,
-+ V4L2_XFER_FUNC_ADOBERGB = 3,
-+ V4L2_XFER_FUNC_SMPTE240M = 4,
-+ V4L2_XFER_FUNC_NONE = 5,
-+ V4L2_XFER_FUNC_DCI_P3 = 6,
-+ V4L2_XFER_FUNC_SMPTE2084 = 7,
-+};
-+
-+/*
-+ * Determine how XFER_FUNC_DEFAULT should map to a proper transfer function.
-+ * This depends on the colorspace.
-+ */
-+#define V4L2_MAP_XFER_FUNC_DEFAULT(colsp) \
-+ ((colsp) == V4L2_COLORSPACE_ADOBERGB ? V4L2_XFER_FUNC_ADOBERGB : \
-+ ((colsp) == V4L2_COLORSPACE_SMPTE240M ? V4L2_XFER_FUNC_SMPTE240M : \
-+ ((colsp) == V4L2_COLORSPACE_DCI_P3 ? V4L2_XFER_FUNC_DCI_P3 : \
-+ ((colsp) == V4L2_COLORSPACE_RAW ? V4L2_XFER_FUNC_NONE : \
-+ ((colsp) == V4L2_COLORSPACE_SRGB || (colsp) == V4L2_COLORSPACE_JPEG ? \
-+ V4L2_XFER_FUNC_SRGB : V4L2_XFER_FUNC_709)))))
-+
-+enum v4l2_ycbcr_encoding {
-+ /*
-+ * Mapping of V4L2_YCBCR_ENC_DEFAULT to actual encodings for the
-+ * various colorspaces:
-+ *
-+ * V4L2_COLORSPACE_SMPTE170M, V4L2_COLORSPACE_470_SYSTEM_M,
-+ * V4L2_COLORSPACE_470_SYSTEM_BG, V4L2_COLORSPACE_SRGB,
-+ * V4L2_COLORSPACE_ADOBERGB and V4L2_COLORSPACE_JPEG: V4L2_YCBCR_ENC_601
-+ *
-+ * V4L2_COLORSPACE_REC709 and V4L2_COLORSPACE_DCI_P3: V4L2_YCBCR_ENC_709
-+ *
-+ * V4L2_COLORSPACE_BT2020: V4L2_YCBCR_ENC_BT2020
-+ *
-+ * V4L2_COLORSPACE_SMPTE240M: V4L2_YCBCR_ENC_SMPTE240M
-+ */
-+ V4L2_YCBCR_ENC_DEFAULT = 0,
-+
-+ /* ITU-R 601 -- SDTV */
-+ V4L2_YCBCR_ENC_601 = 1,
-+
-+ /* Rec. 709 -- HDTV */
-+ V4L2_YCBCR_ENC_709 = 2,
-+
-+ /* ITU-R 601/EN 61966-2-4 Extended Gamut -- SDTV */
-+ V4L2_YCBCR_ENC_XV601 = 3,
-+
-+ /* Rec. 709/EN 61966-2-4 Extended Gamut -- HDTV */
-+ V4L2_YCBCR_ENC_XV709 = 4,
-+
-+#ifndef __KERNEL__
-+ /*
-+ * sYCC (Y'CbCr encoding of sRGB), identical to ENC_601. It was added
-+ * originally due to a misunderstanding of the sYCC standard. It should
-+ * not be used, instead use V4L2_YCBCR_ENC_601.
-+ */
-+ V4L2_YCBCR_ENC_SYCC = 5,
-+#endif
-+
-+ /* BT.2020 Non-constant Luminance Y'CbCr */
-+ V4L2_YCBCR_ENC_BT2020 = 6,
-+
-+ /* BT.2020 Constant Luminance Y'CbcCrc */
-+ V4L2_YCBCR_ENC_BT2020_CONST_LUM = 7,
-+
-+ /* SMPTE 240M -- Obsolete HDTV */
-+ V4L2_YCBCR_ENC_SMPTE240M = 8,
-+};
-+
-+/*
-+ * enum v4l2_hsv_encoding values should not collide with the ones from
-+ * enum v4l2_ycbcr_encoding.
-+ */
-+enum v4l2_hsv_encoding {
-+
-+ /* Hue mapped to 0 - 179 */
-+ V4L2_HSV_ENC_180 = 128,
-+
-+ /* Hue mapped to 0-255 */
-+ V4L2_HSV_ENC_256 = 129,
-+};
-+
-+/*
-+ * Determine how YCBCR_ENC_DEFAULT should map to a proper Y'CbCr encoding.
-+ * This depends on the colorspace.
-+ */
-+#define V4L2_MAP_YCBCR_ENC_DEFAULT(colsp) \
-+ (((colsp) == V4L2_COLORSPACE_REC709 || \
-+ (colsp) == V4L2_COLORSPACE_DCI_P3) ? V4L2_YCBCR_ENC_709 : \
-+ ((colsp) == V4L2_COLORSPACE_BT2020 ? V4L2_YCBCR_ENC_BT2020 : \
-+ ((colsp) == V4L2_COLORSPACE_SMPTE240M ? V4L2_YCBCR_ENC_SMPTE240M : \
-+ V4L2_YCBCR_ENC_601)))
-+
-+enum v4l2_quantization {
-+ /*
-+ * The default for R'G'B' quantization is always full range, except
-+ * for the BT2020 colorspace. For Y'CbCr the quantization is always
-+ * limited range, except for COLORSPACE_JPEG: this is full range.
-+ */
-+ V4L2_QUANTIZATION_DEFAULT = 0,
-+ V4L2_QUANTIZATION_FULL_RANGE = 1,
-+ V4L2_QUANTIZATION_LIM_RANGE = 2,
-+};
-+
-+/*
-+ * Determine how QUANTIZATION_DEFAULT should map to a proper quantization.
-+ * This depends on whether the image is RGB or not, the colorspace and the
-+ * Y'CbCr encoding.
-+ */
-+#define V4L2_MAP_QUANTIZATION_DEFAULT(is_rgb_or_hsv, colsp, ycbcr_enc) \
-+ (((is_rgb_or_hsv) && (colsp) == V4L2_COLORSPACE_BT2020) ? \
-+ V4L2_QUANTIZATION_LIM_RANGE : \
-+ (((is_rgb_or_hsv) || (colsp) == V4L2_COLORSPACE_JPEG) ? \
-+ V4L2_QUANTIZATION_FULL_RANGE : V4L2_QUANTIZATION_LIM_RANGE))
-+
- enum v4l2_priority {
- V4L2_PRIORITY_UNSET = 0, /* not initialized */
- V4L2_PRIORITY_BACKGROUND = 1,
-@@ -306,11 +483,15 @@ struct v4l2_capability {
-
- #define V4L2_CAP_SDR_CAPTURE 0x00100000 /* Is a SDR capture device */
- #define V4L2_CAP_EXT_PIX_FORMAT 0x00200000 /* Supports the extended pixel format */
-+#define V4L2_CAP_SDR_OUTPUT 0x00400000 /* Is a SDR output device */
-+#define V4L2_CAP_META_CAPTURE 0x00800000 /* Is a metadata capture device */
-
- #define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */
- #define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */
- #define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */
-
-+#define V4L2_CAP_TOUCH 0x10000000 /* Is a touch device */
-+
- #define V4L2_CAP_DEVICE_CAPS 0x80000000 /* sets device capabilities field */
-
- /*
-@@ -326,6 +507,12 @@ struct v4l2_pix_format {
- uint32_t colorspace; /* enum v4l2_colorspace */
- uint32_t priv; /* private data, depends on pixelformat */
- uint32_t flags; /* format flags (V4L2_PIX_FMT_FLAG_*) */
-+ union {
-+ uint32_t ycbcr_enc;
-+ uint32_t hsv_enc;
-+ };
-+ uint32_t quantization;
-+ uint32_t xfer_func;
- };
-
- /* Pixel format FOURCC depth Description */
-@@ -360,6 +547,7 @@ struct v4l2_pix_format {
- #define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */
- #define V4L2_PIX_FMT_Y12 v4l2_fourcc('Y', '1', '2', ' ') /* 12 Greyscale */
- #define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */
-+#define V4L2_PIX_FMT_Y16_BE v4l2_fourcc_be('Y', '1', '6', ' ') /* 16 Greyscale BE */
-
- /* Grey bit-packed formats */
- #define V4L2_PIX_FMT_Y10BPACK v4l2_fourcc('Y', '1', '0', 'B') /* 10 Greyscale bit-packed */
-@@ -371,22 +559,16 @@ struct v4l2_pix_format {
- #define V4L2_PIX_FMT_UV8 v4l2_fourcc('U', 'V', '8', ' ') /* 8 UV 4:4 */
-
- /* Luminance+Chrominance formats */
--#define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y', 'V', 'U', '9') /* 9 YVU 4:1:0 */
--#define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y', 'V', '1', '2') /* 12 YVU 4:2:0 */
- #define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y', 'U', 'Y', 'V') /* 16 YUV 4:2:2 */
- #define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y', 'Y', 'U', 'V') /* 16 YUV 4:2:2 */
- #define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */
- #define V4L2_PIX_FMT_UYVY v4l2_fourcc('U', 'Y', 'V', 'Y') /* 16 YUV 4:2:2 */
- #define V4L2_PIX_FMT_VYUY v4l2_fourcc('V', 'Y', 'U', 'Y') /* 16 YUV 4:2:2 */
--#define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4', '2', '2', 'P') /* 16 YVU422 planar */
--#define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4', '1', '1', 'P') /* 16 YVU411 planar */
- #define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y', '4', '1', 'P') /* 12 YUV 4:1:1 */
- #define V4L2_PIX_FMT_YUV444 v4l2_fourcc('Y', '4', '4', '4') /* 16 xxxxyyyy uuuuvvvv */
- #define V4L2_PIX_FMT_YUV555 v4l2_fourcc('Y', 'U', 'V', 'O') /* 16 YUV-5-5-5 */
- #define V4L2_PIX_FMT_YUV565 v4l2_fourcc('Y', 'U', 'V', 'P') /* 16 YUV-5-6-5 */
- #define V4L2_PIX_FMT_YUV32 v4l2_fourcc('Y', 'U', 'V', '4') /* 32 YUV-8-8-8-8 */
--#define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */
--#define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y', 'U', '1', '2') /* 12 YUV 4:2:0 */
- #define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4') /* 8 8-bit color */
- #define V4L2_PIX_FMT_HM12 v4l2_fourcc('H', 'M', '1', '2') /* 8 YUV 4:2:0 16x16 macroblocks */
- #define V4L2_PIX_FMT_M420 v4l2_fourcc('M', '4', '2', '0') /* 12 YUV 4:2:0 2 lines y, 1 line uv interleaved */
-@@ -407,9 +589,21 @@ struct v4l2_pix_format {
- #define V4L2_PIX_FMT_NV12MT v4l2_fourcc('T', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 64x32 macroblocks */
- #define V4L2_PIX_FMT_NV12MT_16X16 v4l2_fourcc('V', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 16x16 macroblocks */
-
-+/* three planes - Y Cb, Cr */
-+#define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */
-+#define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y', 'V', 'U', '9') /* 9 YVU 4:1:0 */
-+#define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4', '1', '1', 'P') /* 12 YVU411 planar */
-+#define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y', 'U', '1', '2') /* 12 YUV 4:2:0 */
-+#define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y', 'V', '1', '2') /* 12 YVU 4:2:0 */
-+#define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4', '2', '2', 'P') /* 16 YVU422 planar */
-+
- /* three non contiguous planes - Y, Cb, Cr */
- #define V4L2_PIX_FMT_YUV420M v4l2_fourcc('Y', 'M', '1', '2') /* 12 YUV420 planar */
- #define V4L2_PIX_FMT_YVU420M v4l2_fourcc('Y', 'M', '2', '1') /* 12 YVU420 planar */
-+#define V4L2_PIX_FMT_YUV422M v4l2_fourcc('Y', 'M', '1', '6') /* 16 YUV422 planar */
-+#define V4L2_PIX_FMT_YVU422M v4l2_fourcc('Y', 'M', '6', '1') /* 16 YVU422 planar */
-+#define V4L2_PIX_FMT_YUV444M v4l2_fourcc('Y', 'M', '2', '4') /* 24 YUV444 planar */
-+#define V4L2_PIX_FMT_YVU444M v4l2_fourcc('Y', 'M', '4', '2') /* 24 YVU444 planar */
-
- /* Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm */
- #define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */
-@@ -420,10 +614,11 @@ struct v4l2_pix_format {
- #define V4L2_PIX_FMT_SGBRG10 v4l2_fourcc('G', 'B', '1', '0') /* 10 GBGB.. RGRG.. */
- #define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0') /* 10 GRGR.. BGBG.. */
- #define V4L2_PIX_FMT_SRGGB10 v4l2_fourcc('R', 'G', '1', '0') /* 10 RGRG.. GBGB.. */
--#define V4L2_PIX_FMT_SBGGR12 v4l2_fourcc('B', 'G', '1', '2') /* 12 BGBG.. GRGR.. */
--#define V4L2_PIX_FMT_SGBRG12 v4l2_fourcc('G', 'B', '1', '2') /* 12 GBGB.. RGRG.. */
--#define V4L2_PIX_FMT_SGRBG12 v4l2_fourcc('B', 'A', '1', '2') /* 12 GRGR.. BGBG.. */
--#define V4L2_PIX_FMT_SRGGB12 v4l2_fourcc('R', 'G', '1', '2') /* 12 RGRG.. GBGB.. */
-+ /* 10bit raw bayer packed, 5 bytes for every 4 pixels */
-+#define V4L2_PIX_FMT_SBGGR10P v4l2_fourcc('p', 'B', 'A', 'A')
-+#define V4L2_PIX_FMT_SGBRG10P v4l2_fourcc('p', 'G', 'A', 'A')
-+#define V4L2_PIX_FMT_SGRBG10P v4l2_fourcc('p', 'g', 'A', 'A')
-+#define V4L2_PIX_FMT_SRGGB10P v4l2_fourcc('p', 'R', 'A', 'A')
- /* 10bit raw bayer a-law compressed to 8 bits */
- #define V4L2_PIX_FMT_SBGGR10ALAW8 v4l2_fourcc('a', 'B', 'A', '8')
- #define V4L2_PIX_FMT_SGBRG10ALAW8 v4l2_fourcc('a', 'G', 'A', '8')
-@@ -434,11 +629,23 @@ struct v4l2_pix_format {
- #define V4L2_PIX_FMT_SGBRG10DPCM8 v4l2_fourcc('b', 'G', 'A', '8')
- #define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0')
- #define V4L2_PIX_FMT_SRGGB10DPCM8 v4l2_fourcc('b', 'R', 'A', '8')
-- /*
-- * 10bit raw bayer, expanded to 16 bits
-- * xxxxrrrrrrrrrrxxxxgggggggggg xxxxggggggggggxxxxbbbbbbbbbb...
-- */
-+#define V4L2_PIX_FMT_SBGGR12 v4l2_fourcc('B', 'G', '1', '2') /* 12 BGBG.. GRGR.. */
-+#define V4L2_PIX_FMT_SGBRG12 v4l2_fourcc('G', 'B', '1', '2') /* 12 GBGB.. RGRG.. */
-+#define V4L2_PIX_FMT_SGRBG12 v4l2_fourcc('B', 'A', '1', '2') /* 12 GRGR.. BGBG.. */
-+#define V4L2_PIX_FMT_SRGGB12 v4l2_fourcc('R', 'G', '1', '2') /* 12 RGRG.. GBGB.. */
-+ /* 12bit raw bayer packed, 6 bytes for every 4 pixels */
-+#define V4L2_PIX_FMT_SBGGR12P v4l2_fourcc('p', 'B', 'C', 'C')
-+#define V4L2_PIX_FMT_SGBRG12P v4l2_fourcc('p', 'G', 'C', 'C')
-+#define V4L2_PIX_FMT_SGRBG12P v4l2_fourcc('p', 'g', 'C', 'C')
-+#define V4L2_PIX_FMT_SRGGB12P v4l2_fourcc('p', 'R', 'C', 'C')
- #define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16 BGBG.. GRGR.. */
-+#define V4L2_PIX_FMT_SGBRG16 v4l2_fourcc('G', 'B', '1', '6') /* 16 GBGB.. RGRG.. */
-+#define V4L2_PIX_FMT_SGRBG16 v4l2_fourcc('G', 'R', '1', '6') /* 16 GRGR.. BGBG.. */
-+#define V4L2_PIX_FMT_SRGGB16 v4l2_fourcc('R', 'G', '1', '6') /* 16 RGRG.. GBGB.. */
-+
-+/* HSV formats */
-+#define V4L2_PIX_FMT_HSV24 v4l2_fourcc('H', 'S', 'V', '3')
-+#define V4L2_PIX_FMT_HSV32 v4l2_fourcc('H', 'S', 'V', '4')
-
- /* compressed formats */
- #define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M', 'J', 'P', 'G') /* Motion-JPEG */
-@@ -456,6 +663,8 @@ struct v4l2_pix_format {
- #define V4L2_PIX_FMT_VC1_ANNEX_G v4l2_fourcc('V', 'C', '1', 'G') /* SMPTE 421M Annex G compliant stream */
- #define V4L2_PIX_FMT_VC1_ANNEX_L v4l2_fourcc('V', 'C', '1', 'L') /* SMPTE 421M Annex L compliant stream */
- #define V4L2_PIX_FMT_VP8 v4l2_fourcc('V', 'P', '8', '0') /* VP8 */
-+#define V4L2_PIX_FMT_VP9 v4l2_fourcc('V', 'P', '9', '0') /* VP9 */
-+#define V4L2_PIX_FMT_HEVC v4l2_fourcc('H', 'E', 'V', 'C') /* HEVC aka H.265 */
-
- /* Vendor-specific formats */
- #define V4L2_PIX_FMT_CPIA1 v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */
-@@ -484,6 +693,17 @@ struct v4l2_pix_format {
- #define V4L2_PIX_FMT_JPGL v4l2_fourcc('J', 'P', 'G', 'L') /* JPEG-Lite */
- #define V4L2_PIX_FMT_SE401 v4l2_fourcc('S', '4', '0', '1') /* se401 janggu compressed rgb */
- #define V4L2_PIX_FMT_S5C_UYVY_JPG v4l2_fourcc('S', '5', 'C', 'I') /* S5C73M3 interleaved UYVY/JPEG */
-+#define V4L2_PIX_FMT_Y8I v4l2_fourcc('Y', '8', 'I', ' ') /* Greyscale 8-bit L/R interleaved */
-+#define V4L2_PIX_FMT_Y12I v4l2_fourcc('Y', '1', '2', 'I') /* Greyscale 12-bit L/R interleaved */
-+#define V4L2_PIX_FMT_Z16 v4l2_fourcc('Z', '1', '6', ' ') /* Depth data 16-bit */
-+#define V4L2_PIX_FMT_MT21C v4l2_fourcc('M', 'T', '2', '1') /* Mediatek compressed block mode */
-+#define V4L2_PIX_FMT_INZI v4l2_fourcc('I', 'N', 'Z', 'I') /* Intel Planar Greyscale 10-bit and Depth 16-bit */
-+
-+/* 10bit raw bayer packed, 32 bytes for every 25 pixels, last LSB 6 bits unused */
-+#define V4L2_PIX_FMT_IPU3_SBGGR10 v4l2_fourcc('i', 'p', '3', 'b') /* IPU3 packed 10-bit BGGR bayer */
-+#define V4L2_PIX_FMT_IPU3_SGBRG10 v4l2_fourcc('i', 'p', '3', 'g') /* IPU3 packed 10-bit GBRG bayer */
-+#define V4L2_PIX_FMT_IPU3_SGRBG10 v4l2_fourcc('i', 'p', '3', 'G') /* IPU3 packed 10-bit GRBG bayer */
-+#define V4L2_PIX_FMT_IPU3_SRGGB10 v4l2_fourcc('i', 'p', '3', 'r') /* IPU3 packed 10-bit RGGB bayer */
-
- /* SDR formats - used only for Software Defined Radio devices */
- #define V4L2_SDR_FMT_CU8 v4l2_fourcc('C', 'U', '0', '8') /* IQ u8 */
-@@ -491,6 +711,20 @@ struct v4l2_pix_format {
- #define V4L2_SDR_FMT_CS8 v4l2_fourcc('C', 'S', '0', '8') /* complex s8 */
- #define V4L2_SDR_FMT_CS14LE v4l2_fourcc('C', 'S', '1', '4') /* complex s14le */
- #define V4L2_SDR_FMT_RU12LE v4l2_fourcc('R', 'U', '1', '2') /* real u12le */
-+#define V4L2_SDR_FMT_PCU16BE v4l2_fourcc('P', 'C', '1', '6') /* planar complex u16be */
-+#define V4L2_SDR_FMT_PCU18BE v4l2_fourcc('P', 'C', '1', '8') /* planar complex u18be */
-+#define V4L2_SDR_FMT_PCU20BE v4l2_fourcc('P', 'C', '2', '0') /* planar complex u20be */
-+
-+/* Touch formats - used for Touch devices */
-+#define V4L2_TCH_FMT_DELTA_TD16 v4l2_fourcc('T', 'D', '1', '6') /* 16-bit signed deltas */
-+#define V4L2_TCH_FMT_DELTA_TD08 v4l2_fourcc('T', 'D', '0', '8') /* 8-bit signed deltas */
-+#define V4L2_TCH_FMT_TU16 v4l2_fourcc('T', 'U', '1', '6') /* 16-bit unsigned touch data */
-+#define V4L2_TCH_FMT_TU08 v4l2_fourcc('T', 'U', '0', '8') /* 8-bit unsigned touch data */
-+
-+/* Meta-data formats */
-+#define V4L2_META_FMT_VSP1_HGO v4l2_fourcc('V', 'S', 'P', 'H') /* R-Car VSP1 1-D Histogram */
-+#define V4L2_META_FMT_VSP1_HGT v4l2_fourcc('V', 'S', 'P', 'T') /* R-Car VSP1 2-D Histogram */
-+#define V4L2_META_FMT_UVC v4l2_fourcc('U', 'V', 'C', 'H') /* UVC Payload Header metadata */
-
- /* priv field value to indicates that subsequent fields are valid. */
- #define V4L2_PIX_FMT_PRIV_MAGIC 0xfeedcafe
-@@ -513,8 +747,7 @@ struct v4l2_fmtdesc {
- #define V4L2_FMT_FLAG_COMPRESSED 0x0001
- #define V4L2_FMT_FLAG_EMULATED 0x0002
-
--#if 1
-- /* Experimental Frame Size and frame rate enumeration */
-+ /* Frame Size and frame rate enumeration */
- /*
- * F R A M E S I Z E E N U M E R A T I O N
- */
-@@ -580,7 +813,6 @@ struct v4l2_frmivalenum {
-
- uint32_t reserved[2]; /* Reserved space for future use */
- };
--#endif
-
- /*
- * T I M E C O D E
-@@ -765,6 +997,8 @@ struct v4l2_buffer {
- #define V4L2_BUF_FLAG_TSTAMP_SRC_MASK 0x00070000
- #define V4L2_BUF_FLAG_TSTAMP_SRC_EOF 0x00000000
- #define V4L2_BUF_FLAG_TSTAMP_SRC_SOE 0x00010000
-+/* mem2mem encoder/decoder */
-+#define V4L2_BUF_FLAG_LAST 0x00100000
-
- /**
- * struct v4l2_exportbuffer - export of video buffer as DMABUF file descriptor
-@@ -1073,6 +1307,9 @@ struct v4l2_standard {
- * (aka field 2) of interlaced field formats
- * @standards: Standards the timing belongs to
- * @flags: Flags
-+ * @picture_aspect: The picture aspect ratio (hor/vert).
-+ * @cea861_vic: VIC code as per the CEA-861 standard.
-+ * @hdmi_vic: VIC code as per the HDMI standard.
- * @reserved: Reserved fields, must be zeroed.
- *
- * A note regarding vertical interlaced timings: height refers to the total
-@@ -1102,7 +1339,10 @@ struct v4l2_bt_timings {
- uint32_t il_vbackporch;
- uint32_t standards;
- uint32_t flags;
-- uint32_t reserved[14];
-+ struct v4l2_fract picture_aspect;
-+ uint8_t cea861_vic;
-+ uint8_t hdmi_vic;
-+ uint8_t reserved[46];
- } __attribute__ ((packed));
-
- /* Interlaced or progressive format */
-@@ -1118,6 +1358,7 @@ struct v4l2_bt_timings {
- #define V4L2_DV_BT_STD_DMT (1 << 1) /* VESA Discrete Monitor Timings */
- #define V4L2_DV_BT_STD_CVT (1 << 2) /* VESA Coordinated Video Timings */
- #define V4L2_DV_BT_STD_GTF (1 << 3) /* VESA Generalized Timings Formula */
-+#define V4L2_DV_BT_STD_SDI (1 << 4) /* SDI Timings */
-
- /* Flags */
-
-@@ -1143,6 +1384,36 @@ struct v4l2_bt_timings {
- exactly the same number of half-lines. Whether half-lines can be detected
- or used depends on the hardware. */
- #define V4L2_DV_FL_HALF_LINE (1 << 3)
-+/*
-+ * If set, then this is a Consumer Electronics (CE) video format. Such formats
-+ * differ from other formats (commonly called IT formats) in that if RGB
-+ * encoding is used then by default the RGB values use limited range (i.e.
-+ * use the range 16-235) as opposed to 0-255. All formats defined in CEA-861
-+ * except for the 640x480 format are CE formats.
-+ */
-+#define V4L2_DV_FL_IS_CE_VIDEO (1 << 4)
-+/* Some formats like SMPTE-125M have an interlaced signal with a odd
-+ * total height. For these formats, if this flag is set, the first
-+ * field has the extra line. If not, it is the second field.
-+ */
-+#define V4L2_DV_FL_FIRST_FIELD_EXTRA_LINE (1 << 5)
-+/*
-+ * If set, then the picture_aspect field is valid. Otherwise assume that the
-+ * pixels are square, so the picture aspect ratio is the same as the width to
-+ * height ratio.
-+ */
-+#define V4L2_DV_FL_HAS_PICTURE_ASPECT (1 << 6)
-+/*
-+ * If set, then the cea861_vic field is valid and contains the Video
-+ * Identification Code as per the CEA-861 standard.
-+ */
-+#define V4L2_DV_FL_HAS_CEA861_VIC (1 << 7)
-+/*
-+ * If set, then the hdmi_vic field is valid and contains the Video
-+ * Identification Code as per the HDMI standard (HDMI Vendor Specific
-+ * InfoFrame).
-+ */
-+#define V4L2_DV_FL_HAS_HDMI_VIC (1 << 8)
-
- /* A few useful defines to calculate the total blanking and frame sizes */
- #define V4L2_DV_BT_BLANKING_WIDTH(bt) \
-@@ -1252,6 +1523,7 @@ struct v4l2_input {
- /* Values for the 'type' field */
- #define V4L2_INPUT_TYPE_TUNER 1
- #define V4L2_INPUT_TYPE_CAMERA 2
-+#define V4L2_INPUT_TYPE_TOUCH 3
-
- /* field 'status' - general */
- #define V4L2_IN_ST_NO_POWER 0x00000001 /* Attached device is off */
-@@ -1266,6 +1538,8 @@ struct v4l2_input {
- /* field 'status' - analog */
- #define V4L2_IN_ST_NO_H_LOCK 0x00000100 /* No horizontal sync lock */
- #define V4L2_IN_ST_COLOR_KILL 0x00000200 /* Color killer is active */
-+#define V4L2_IN_ST_NO_V_LOCK 0x00000400 /* No vertical sync lock */
-+#define V4L2_IN_ST_NO_STD_LOCK 0x00000800 /* No standard format lock */
-
- /* field 'status' - digital */
- #define V4L2_IN_ST_NO_SYNC 0x00010000 /* No synchronization lock */
-@@ -1281,6 +1555,7 @@ struct v4l2_input {
- #define V4L2_IN_CAP_DV_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */
- #define V4L2_IN_CAP_CUSTOM_TIMINGS V4L2_IN_CAP_DV_TIMINGS /* For compatibility */
- #define V4L2_IN_CAP_STD 0x00000004 /* Supports S_STD */
-+#define V4L2_IN_CAP_NATIVE_SIZE 0x00000008 /* Supports setting native size */
-
- /*
- * V I D E O O U T P U T S
-@@ -1340,6 +1615,8 @@ struct v4l2_ext_controls {
- #define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL)
- #define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000)
- #define V4L2_CTRL_MAX_DIMS (4)
-+#define V4L2_CTRL_WHICH_CUR_VAL 0
-+#define V4L2_CTRL_WHICH_DEF_VAL 0x0f000000
-
- enum v4l2_ctrl_type {
- V4L2_CTRL_TYPE_INTEGER = 1,
-@@ -1410,6 +1687,8 @@ struct v4l2_querymenu {
- #define V4L2_CTRL_FLAG_WRITE_ONLY 0x0040
- #define V4L2_CTRL_FLAG_VOLATILE 0x0080
- #define V4L2_CTRL_FLAG_HAS_PAYLOAD 0x0100
-+#define V4L2_CTRL_FLAG_EXECUTE_ON_WRITE 0x0200
-+#define V4L2_CTRL_FLAG_MODIFY_LAYOUT 0x0400
-
- /* Query flags, to be ORed with the control ID */
- #define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000
-@@ -1562,8 +1841,6 @@ struct v4l2_audioout {
-
- /*
- * M P E G S E R V I C E S
-- *
-- * NOTE: EXPERIMENTAL API
- */
- #if 1
- #define V4L2_ENC_IDX_FRAME_I (0)
-@@ -1809,6 +2086,9 @@ struct v4l2_plane_pix_format {
- * @plane_fmt: per-plane information
- * @num_planes: number of planes for this format
- * @flags: format flags (V4L2_PIX_FMT_FLAG_*)
-+ * @ycbcr_enc: enum v4l2_ycbcr_encoding, Y'CbCr encoding
-+ * @quantization: enum v4l2_quantization, colorspace quantization
-+ * @xfer_func: enum v4l2_xfer_func, colorspace transfer function
- */
- struct v4l2_pix_format_mplane {
- uint32_t width;
-@@ -1820,7 +2100,13 @@ struct v4l2_pix_format_mplane {
- struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES];
- uint8_t num_planes;
- uint8_t flags;
-- uint8_t reserved[10];
-+ union {
-+ uint8_t ycbcr_enc;
-+ uint8_t hsv_enc;
-+ };
-+ uint8_t quantization;
-+ uint8_t xfer_func;
-+ uint8_t reserved[7];
- } __attribute__ ((packed));
-
- /**
-@@ -2094,45 +2380,32 @@ struct v4l2_create_buffers {
- #define VIDIOC_DBG_G_REGISTER _IOWR('V', 80, struct v4l2_dbg_register)
-
- #define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek)
--
- #define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings)
- #define VIDIOC_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings)
- #define VIDIOC_DQEVENT _IOR('V', 89, struct v4l2_event)
- #define VIDIOC_SUBSCRIBE_EVENT _IOW('V', 90, struct v4l2_event_subscription)
- #define VIDIOC_UNSUBSCRIBE_EVENT _IOW('V', 91, struct v4l2_event_subscription)
--
--/* Experimental, the below two ioctls may change over the next couple of kernel
-- versions */
- #define VIDIOC_CREATE_BUFS _IOWR('V', 92, struct v4l2_create_buffers)
- #define VIDIOC_PREPARE_BUF _IOWR('V', 93, struct v4l2_buffer)
--
--/* Experimental selection API */
- #define VIDIOC_G_SELECTION _IOWR('V', 94, struct v4l2_selection)
- #define VIDIOC_S_SELECTION _IOWR('V', 95, struct v4l2_selection)
--
--/* Experimental, these two ioctls may change over the next couple of kernel
-- versions. */
- #define VIDIOC_DECODER_CMD _IOWR('V', 96, struct v4l2_decoder_cmd)
- #define VIDIOC_TRY_DECODER_CMD _IOWR('V', 97, struct v4l2_decoder_cmd)
--
--/* Experimental, these three ioctls may change over the next couple of kernel
-- versions. */
- #define VIDIOC_ENUM_DV_TIMINGS _IOWR('V', 98, struct v4l2_enum_dv_timings)
- #define VIDIOC_QUERY_DV_TIMINGS _IOR('V', 99, struct v4l2_dv_timings)
- #define VIDIOC_DV_TIMINGS_CAP _IOWR('V', 100, struct v4l2_dv_timings_cap)
--
--/* Experimental, this ioctl may change over the next couple of kernel
-- versions. */
- #define VIDIOC_ENUM_FREQ_BANDS _IOWR('V', 101, struct v4l2_frequency_band)
-
--/* Experimental, meant for debugging, testing and internal use.
-- Never use these in applications! */
-+/*
-+ * Experimental, meant for debugging, testing and internal use.
-+ * Never use this in applications!
-+ */
- #define VIDIOC_DBG_G_CHIP_INFO _IOWR('V', 102, struct v4l2_dbg_chip_info)
-
- #define VIDIOC_QUERY_EXT_CTRL _IOWR('V', 103, struct v4l2_query_ext_ctrl)
-
- /* Reminder: when adding new ioctls please add support for them to
-- drivers/media/video/v4l2-compat-ioctl32.c as well! */
-+ drivers/media/v4l2-core/v4l2-compat-ioctl32.c as well! */
-
- #define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */
-
diff --git a/multimedia/libv4l/files/patch-include_linux_dvb_frontend.h b/multimedia/libv4l/files/patch-include_linux_dvb_frontend.h
deleted file mode 100644
index bb9b61dfe278..000000000000
--- a/multimedia/libv4l/files/patch-include_linux_dvb_frontend.h
+++ /dev/null
@@ -1,17 +0,0 @@
---- include/linux/dvb/frontend.h.orig 2015-01-10 15:04:07.446370686 +0100
-+++ include/linux/dvb/frontend.h 2015-01-10 15:05:20.367365809 +0100
-@@ -549,7 +549,13 @@
- };
-
- #define FE_SET_PROPERTY _IOW('o', 82, struct dtv_properties)
--#define FE_GET_PROPERTY _IOR('o', 83, struct dtv_properties)
-+/*
-+ * This is broken on linux as well but they workaround it in the driver.
-+ * Since this is impossible to do on FreeBSD fix the header instead.
-+ * Detailed and discussion :
-+ * http://lists.freebsd.org/pipermail/freebsd-multimedia/2010-April/010958.html
-+ */
-+#define FE_GET_PROPERTY _IOW('o', 83, struct dtv_properties)
-
-
- /**
diff --git a/multimedia/libv4l/files/patch-include_linux_dvb_video.h b/multimedia/libv4l/files/patch-include_linux_dvb_video.h
deleted file mode 100644
index eb05f38fb57f..000000000000
--- a/multimedia/libv4l/files/patch-include_linux_dvb_video.h
+++ /dev/null
@@ -1,11 +0,0 @@
---- include/linux/dvb/video.h.orig 2015-01-10 15:05:58.438363362 +0100
-+++ include/linux/dvb/video.h 2015-01-10 15:06:25.350361374 +0100
-@@ -133,7 +133,7 @@
- #define VIDEO_EVENT_FRAME_RATE_CHANGED 2
- #define VIDEO_EVENT_DECODER_STOPPED 3
- #define VIDEO_EVENT_VSYNC 4
-- __kernel_time_t timestamp;
-+ struct timespec timestamp;
- union {
- video_size_t size;
- unsigned int frame_rate; /* in frames per 1000sec */
diff --git a/multimedia/libv4l/files/patch-lib_Makefile.in b/multimedia/libv4l/files/patch-lib_Makefile.in
deleted file mode 100644
index e70776250578..000000000000
--- a/multimedia/libv4l/files/patch-lib_Makefile.in
+++ /dev/null
@@ -1,13 +0,0 @@
---- lib/Makefile.in.orig 2015-01-12 10:51:50.193906738 +0100
-+++ lib/Makefile.in 2015-01-12 10:52:04.848018891 +0100
-@@ -77,8 +77,8 @@
- POST_UNINSTALL = :
- build_triplet = @build@
- host_triplet = @host@
--@LINUX_OS_TRUE@am__append_1 = \
--@LINUX_OS_TRUE@ libdvbv5
-+am__append_1 = \
-+ libdvbv5
-
- subdir = lib
- DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
diff --git a/multimedia/libv4l/files/patch-lib_include_libdvbv5_descriptors.h b/multimedia/libv4l/files/patch-lib_include_libdvbv5_descriptors.h
new file mode 100644
index 000000000000..dcdef792822f
--- /dev/null
+++ b/multimedia/libv4l/files/patch-lib_include_libdvbv5_descriptors.h
@@ -0,0 +1,20 @@
+--- lib/include/libdvbv5/descriptors.h.orig 2020-04-09 16:29:54 UTC
++++ lib/include/libdvbv5/descriptors.h
+@@ -87,6 +87,9 @@ typedef void (*dvb_table_init_func)(struct dvb_v5_fe_p
+ extern const dvb_table_init_func dvb_table_initializers[256];
+
+ #ifndef _DOXYGEN
++#ifdef __FreeBSD__
++#include <sys/endian.h>
++#else
+ #define bswap16(b) do {\
+ b = ntohs(b); \
+ } while (0)
+@@ -94,6 +97,7 @@ extern const dvb_table_init_func dvb_table_initializer
+ #define bswap32(b) do {\
+ b = ntohl(b); \
+ } while (0)
++#endif
+
+ /* Deprecated */
+ #define DVB_DESC_HEADER() \
diff --git a/multimedia/libv4l/files/patch-lib_include_libdvbv5_dvb-frontend.h b/multimedia/libv4l/files/patch-lib_include_libdvbv5_dvb-frontend.h
index 1406a927ce45..18b0f86d9d19 100644
--- a/multimedia/libv4l/files/patch-lib_include_libdvbv5_dvb-frontend.h
+++ b/multimedia/libv4l/files/patch-lib_include_libdvbv5_dvb-frontend.h
@@ -1,17 +1,20 @@
---- ./lib/include/libdvbv5/dvb-frontend.h.orig 2016-09-13 19:57:29.863954000 +0200
-+++ ./lib/include/libdvbv5/dvb-frontend.h 2016-09-13 19:58:07.703108000 +0200
-@@ -553,7 +553,13 @@
- };
+--- lib/include/libdvbv5/dvb-frontend.h.orig 2020-04-09 16:29:54 UTC
++++ lib/include/libdvbv5/dvb-frontend.h
+@@ -908,7 +908,17 @@ struct dtv_properties {
+ #define FE_DISHNETWORK_SEND_LEGACY_CMD _IO('o', 80) /* unsigned int */
#define FE_SET_PROPERTY _IOW('o', 82, struct dtv_properties)
--#define FE_GET_PROPERTY _IOR('o', 83, struct dtv_properties)
-+/*
-+ * This is broken on linux as well but they workaround it in the driver.
++#ifdef __linux__
+ #define FE_GET_PROPERTY _IOR('o', 83, struct dtv_properties)
++#else
++/*
++ * This is broken on Linux as well but they workaround it in the driver.
+ * Since this is impossible to do on FreeBSD fix the header instead.
+ * Detailed and discussion :
+ * http://lists.freebsd.org/pipermail/freebsd-multimedia/2010-April/010958.html
+ */
+#define FE_GET_PROPERTY _IOW('o', 83, struct dtv_properties)
++#endif
- /**
+ /*
diff --git a/multimedia/libv4l/files/patch-lib_libdvbv5_dvb-dev-remote.c b/multimedia/libv4l/files/patch-lib_libdvbv5_dvb-dev-remote.c
new file mode 100644
index 000000000000..b35a4bf72868
--- /dev/null
+++ b/multimedia/libv4l/files/patch-lib_libdvbv5_dvb-dev-remote.c
@@ -0,0 +1,14 @@
+--- lib/libdvbv5/dvb-dev-remote.c.orig 2020-04-09 16:29:54 UTC
++++ lib/libdvbv5/dvb-dev-remote.c
+@@ -32,9 +32,11 @@
+ #include <libudev.h>
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <stdarg.h>
+ #include <locale.h>
+ #include <pthread.h>
+ #include <unistd.h>
++#include <netinet/in.h>
+ #include <resolv.h>
+ #include <string.h>
+ #include <sys/socket.h>
diff --git a/multimedia/libv4l/files/patch-lib_libv4lconvert_control_libv4lcontrol.c b/multimedia/libv4l/files/patch-lib_libv4lconvert_control_libv4lcontrol.c
index ada1fc0ce46b..b348cd8c503a 100644
--- a/multimedia/libv4l/files/patch-lib_libv4lconvert_control_libv4lcontrol.c
+++ b/multimedia/libv4l/files/patch-lib_libv4lconvert_control_libv4lcontrol.c
@@ -1,6 +1,6 @@
---- lib/libv4lconvert/control/libv4lcontrol.c.orig 2014-07-26 21:33:00.000000000 +0200
-+++ lib/libv4lconvert/control/libv4lcontrol.c 2015-01-11 09:40:05.521158993 +0100
-@@ -361,6 +361,16 @@
+--- lib/libv4lconvert/control/libv4lcontrol.c.orig 2020-04-09 16:29:54 UTC
++++ lib/libv4lconvert/control/libv4lcontrol.c
+@@ -360,6 +360,16 @@ static int v4lcontrol_get_usb_info(struct v4lcontrol_d
unsigned short *vendor_id, unsigned short *product_id,
int *speed)
{
@@ -15,9 +15,9 @@
+ return (0);
+#else
FILE *f;
- int i, minor;
+ int i, minor_dev;
struct stat st;
-@@ -457,6 +467,7 @@
+@@ -456,6 +466,7 @@ static int v4lcontrol_get_usb_info(struct v4lcontrol_d
return 0; /* Should never happen */
return 1;
diff --git a/multimedia/libv4l/files/patch-lib_libv4lconvert_jpeg__memsrcdest.h b/multimedia/libv4l/files/patch-lib_libv4lconvert_jpeg__memsrcdest.h
deleted file mode 100644
index cdd61113d73e..000000000000
--- a/multimedia/libv4l/files/patch-lib_libv4lconvert_jpeg__memsrcdest.h
+++ /dev/null
@@ -1,16 +0,0 @@
---- lib/libv4lconvert/jpeg_memsrcdest.h.orig 2012-05-10 18:10:34 UTC
-+++ lib/libv4lconvert/jpeg_memsrcdest.h
-@@ -1,5 +1,7 @@
- #include <jpeglib.h>
-
-+#if JPEG_LIB_VERSION < 80
-+
- void
- jpeg_mem_src (j_decompress_ptr cinfo, unsigned char * buffer,
- unsigned long bufsize);
-@@ -7,3 +9,5 @@ jpeg_mem_src (j_decompress_ptr cinfo, un
- void
- jpeg_mem_dest (j_compress_ptr cinfo, unsigned char ** outbuffer,
- unsigned long * outsize);
-+
-+#endif
diff --git a/multimedia/libv4l/files/patch-lib_libv4lconvert_rgbyuv.c b/multimedia/libv4l/files/patch-lib_libv4lconvert_rgbyuv.c
new file mode 100644
index 000000000000..79d8420a2ecd
--- /dev/null
+++ b/multimedia/libv4l/files/patch-lib_libv4lconvert_rgbyuv.c
@@ -0,0 +1,11 @@
+--- lib/libv4lconvert/rgbyuv.c.orig 2020-04-09 16:29:54 UTC
++++ lib/libv4lconvert/rgbyuv.c
+@@ -893,7 +893,7 @@ void v4lconvert_nv12_to_yuv420(const unsigned char *sr
+ }
+
+ for (i = 0; i < height; i++)
+- for (j = 0; i < width; j++) {
++ for (j = 0; j < width; j++) {
+ *ydst++ = *ysrc++;
+ if (((i % 2) == 0) && ((j % 2) == 0)) {
+ *udst++ = *uvsrc++;
diff --git a/multimedia/libv4l/files/patch-utils_Makefile.in b/multimedia/libv4l/files/patch-utils_Makefile.in
deleted file mode 100644
index 01ff4e13714c..000000000000
--- a/multimedia/libv4l/files/patch-utils_Makefile.in
+++ /dev/null
@@ -1,11 +0,0 @@
---- utils/Makefile.in.orig 2015-01-25 19:52:31.619994565 +0100
-+++ utils/Makefile.in 2015-01-25 19:53:34.975249497 +0100
-@@ -374,7 +374,7 @@
- top_srcdir = @top_srcdir@
- udevrulesdir = @udevrulesdir@
- SUBDIRS = dvb libv4l2util libmedia_dev decode_tm6000 keytable \
-- media-ctl v4l2-compliance v4l2-ctl v4l2-dbg v4l2-sysfs-path \
-+ v4l2-compliance v4l2-dbg v4l2-sysfs-path \
- rds-ctl $(am__append_1) $(am__append_2) $(am__append_3)
- all: all-recursive
-
diff --git a/multimedia/libv4l/files/patch-utils_cec-ctl_msg2ctl.pl b/multimedia/libv4l/files/patch-utils_cec-ctl_msg2ctl.pl
new file mode 100644
index 000000000000..c560b839f5a0
--- /dev/null
+++ b/multimedia/libv4l/files/patch-utils_cec-ctl_msg2ctl.pl
@@ -0,0 +1,11 @@
+--- utils/cec-ctl/msg2ctl.pl.orig 2020-04-09 16:29:54 UTC
++++ utils/cec-ctl/msg2ctl.pl
+@@ -49,7 +49,7 @@ sub process_func
+ }
+ my @args = split(/, */, $func_args);
+ my $has_struct = $func_args =~ /struct/;
+- return if ($func_args =~ /__u\d+\s*\*/);
++ return if ($func_args =~ /__u\d+\s*\*/ || $func_args =~ /uint\d+_t\s*\*/);
+
+ my $cec_msg = $msg;
+ while ($cec_msg ne "" && !exists($msgs{$cec_msg})) {
diff --git a/multimedia/libv4l/files/patch-utils_common_ir-encode.c b/multimedia/libv4l/files/patch-utils_common_ir-encode.c
new file mode 100644
index 000000000000..28fd25e966eb
--- /dev/null
+++ b/multimedia/libv4l/files/patch-utils_common_ir-encode.c
@@ -0,0 +1,322 @@
+--- utils/common/ir-encode.c.orig 2020-04-09 16:29:54 UTC
++++ utils/common/ir-encode.c
+@@ -34,17 +34,18 @@ static int nec_encode(enum rc_proto proto, unsigned sc
+ const int nec_unit = 562500;
+ int n = 0;
+
+- void add_byte(unsigned bits)
+- {
+- int i;
+- for (i=0; i<8; i++) {
+- buf[n++] = NS_TO_US(nec_unit);
+- if (bits & (1 << i))
+- buf[n++] = NS_TO_US(nec_unit * 3);
+- else
+- buf[n++] = NS_TO_US(nec_unit);
+- }
+- }
++#define add_byte(__bits) \
++ do { \
++ const unsigned bits = (__bits); \
++ int i; \
++ for (i=0; i<8; i++) { \
++ buf[n++] = NS_TO_US(nec_unit); \
++ if (bits & (1U << i)) \
++ buf[n++] = NS_TO_US(nec_unit * 3); \
++ else \
++ buf[n++] = NS_TO_US(nec_unit); \
++ } \
++ } while (0)
+
+ buf[n++] = NS_TO_US(nec_unit * 16);
+ buf[n++] = NS_TO_US(nec_unit * 8);
+@@ -73,7 +74,7 @@ static int nec_encode(enum rc_proto proto, unsigned sc
+ }
+
+ buf[n++] = NS_TO_US(nec_unit);
+-
++#undef add_bits
+ return n;
+ }
+
+@@ -108,19 +109,21 @@ static int sanyo_encode(enum rc_proto proto, unsigned
+ {
+ const int sanyo_unit = 562500;
+
+- void add_bits(int bits, int count)
+- {
+- int i;
+- for (i=0; i<count; i++) {
+- *buf++ = NS_TO_US(sanyo_unit);
++#define add_bits(__bits, __count) \
++ do { \
++ const unsigned bits = (__bits); \
++ const int count = (__count); \
++ int i; \
++ for (i=0; i<count; i++) { \
++ *buf++ = NS_TO_US(sanyo_unit); \
++ \
++ if (bits & (1U << i)) \
++ *buf++ = NS_TO_US(sanyo_unit * 3); \
++ else \
++ *buf++ = NS_TO_US(sanyo_unit); \
++ } \
++ } while (0)
+
+- if (bits & (1 << i))
+- *buf++ = NS_TO_US(sanyo_unit * 3);
+- else
+- *buf++ = NS_TO_US(sanyo_unit);
+- }
+- }
+-
+ *buf++ = NS_TO_US(sanyo_unit * 16);
+ *buf++ = NS_TO_US(sanyo_unit * 8);
+
+@@ -130,7 +133,7 @@ static int sanyo_encode(enum rc_proto proto, unsigned
+ add_bits(~scancode, 8);
+
+ *buf = NS_TO_US(sanyo_unit);
+-
++#undef add_bits
+ return 87;
+ }
+
+@@ -138,19 +141,21 @@ static int sharp_encode(enum rc_proto proto, unsigned
+ {
+ const int sharp_unit = 40000;
+
+- void add_bits(int bits, int count)
+- {
+- int i;
+- for (i=0; i<count; i++) {
+- *buf++ = NS_TO_US(sharp_unit * 8);
++#define add_bits(__bits, __count) \
++ do { \
++ const unsigned bits = (__bits); \
++ const int count = (__count); \
++ int i; \
++ for (i=0; i<count; i++) { \
++ *buf++ = NS_TO_US(sharp_unit * 8); \
++ \
++ if (bits & (1U << i)) \
++ *buf++ = NS_TO_US(sharp_unit * 50); \
++ else \
++ *buf++ = NS_TO_US(sharp_unit * 25); \
++ } \
++ } while (0)
+
+- if (bits & (1 << i))
+- *buf++ = NS_TO_US(sharp_unit * 50);
+- else
+- *buf++ = NS_TO_US(sharp_unit * 25);
+- }
+- }
+-
+ add_bits(scancode >> 8, 5);
+ add_bits(scancode, 8);
+ add_bits(1, 2);
+@@ -162,7 +167,7 @@ static int sharp_encode(enum rc_proto proto, unsigned
+ add_bits(~scancode, 8);
+ add_bits(~1, 2);
+ *buf++ = NS_TO_US(sharp_unit * 8);
+-
++#undef add_bits
+ return (13 + 2) * 4 + 3;
+ }
+
+@@ -171,19 +176,21 @@ static int sony_encode(enum rc_proto proto, unsigned s
+ const int sony_unit = 600000;
+ int n = 0;
+
+- void add_bits(int bits, int count)
+- {
+- int i;
+- for (i=0; i<count; i++) {
+- if (bits & (1 << i))
+- buf[n++] = NS_TO_US(sony_unit * 2);
+- else
+- buf[n++] = NS_TO_US(sony_unit);
++#define add_bits(__bits, __count) \
++ do { \
++ const unsigned bits = (__bits); \
++ const int count = (__count); \
++ int i; \
++ for (i=0; i<count; i++) { \
++ if (bits & (1U << i)) \
++ buf[n++] = NS_TO_US(sony_unit * 2); \
++ else \
++ buf[n++] = NS_TO_US(sony_unit); \
++ \
++ buf[n++] = NS_TO_US(sony_unit); \
++ } \
++ } while (0)
+
+- buf[n++] = NS_TO_US(sony_unit);
+- }
+- }
+-
+ buf[n++] = NS_TO_US(sony_unit * 4);
+ buf[n++] = NS_TO_US(sony_unit);
+
+@@ -204,7 +211,7 @@ static int sony_encode(enum rc_proto proto, unsigned s
+ default:
+ return 0;
+ }
+-
++#undef add_bits
+ /* ignore last space */
+ return n - 1;
+ }
+@@ -214,34 +221,38 @@ static int rc5_encode(enum rc_proto proto, unsigned sc
+ const unsigned int rc5_unit = 888888;
+ unsigned n = 0;
+
+- void advance_space(unsigned length)
+- {
+- if (n % 2)
+- buf[n] += length;
+- else
+- buf[++n] = length;
+- }
++#define advance_space(__length) \
++ do { \
++ const unsigned length = (__length); \
++ if (n % 2) \
++ buf[n] += length; \
++ else \
++ buf[++n] = length; \
++ } while (0)
+
+- void advance_pulse(unsigned length)
+- {
+- if (n % 2)
+- buf[++n] = length;
+- else
+- buf[n] += length;
+- }
++#define advance_pulse(__length) \
++ do { \
++ const unsigned length = (__length); \
++ if (n % 2) \
++ buf[++n] = length; \
++ else \
++ buf[n] += length; \
++ } while (0)
+
+- void add_bits(int bits, int count)
+- {
+- while (count--) {
+- if (bits & (1 << count)) {
+- advance_space(NS_TO_US(rc5_unit));
+- advance_pulse(NS_TO_US(rc5_unit));
+- } else {
+- advance_pulse(NS_TO_US(rc5_unit));
+- advance_space(NS_TO_US(rc5_unit));
+- }
+- }
+- }
++#define add_bits(__bits, __count) \
++ do { \
++ const unsigned bits = (__bits); \
++ int count = (__count); \
++ while (count--) { \
++ if (bits & (1U << count)) { \
++ advance_space(NS_TO_US(rc5_unit)); \
++ advance_pulse(NS_TO_US(rc5_unit)); \
++ } else { \
++ advance_pulse(NS_TO_US(rc5_unit)); \
++ advance_space(NS_TO_US(rc5_unit)); \
++ } \
++ } \
++ } while (0)
+
+ buf[n] = NS_TO_US(rc5_unit);
+
+@@ -269,7 +280,9 @@ static int rc5_encode(enum rc_proto proto, unsigned sc
+ add_bits(scancode, 6);
+ break;
+ }
+-
++#undef advance_space
++#undef advance_pulse
++#undef add_bits
+ /* drop any trailing pulse */
+ return (n % 2) ? n : n + 1;
+ }
+@@ -279,34 +292,38 @@ static int rc6_encode(enum rc_proto proto, unsigned sc
+ const unsigned int rc6_unit = 444444;
+ unsigned n = 0;
+
+- void advance_space(unsigned length)
+- {
+- if (n % 2)
+- buf[n] += length;
+- else
+- buf[++n] = length;
+- }
++#define advance_space(__length) \
++ do { \
++ const unsigned length = (__length); \
++ if (n % 2) \
++ buf[n] += length; \
++ else \
++ buf[++n] = length; \
++ } while (0)
+
+- void advance_pulse(unsigned length)
+- {
+- if (n % 2)
+- buf[++n] = length;
+- else
+- buf[n] += length;
+- }
++#define advance_pulse(__length) \
++ do { \
++ const unsigned length = (__length); \
++ if (n % 2) \
++ buf[++n] = length; \
++ else \
++ buf[n] += length; \
++ } while (0)
+
+- void add_bits(unsigned bits, unsigned count, unsigned length)
+- {
+- while (count--) {
+- if (bits & (1 << count)) {
+- advance_pulse(length);
+- advance_space(length);
+- } else {
+- advance_space(length);
+- advance_pulse(length);
+- }
+- }
+- }
++#define add_bits(__bits, __count, length) \
++ do { \
++ const unsigned bits = (__bits); \
++ int count = (__count); \
++ while (count--) { \
++ if (bits & (1U << count)) { \
++ advance_pulse(length); \
++ advance_space(length); \
++ } else { \
++ advance_space(length); \
++ advance_pulse(length); \
++ } \
++ } \
++ } while (0)
+
+ buf[n++] = NS_TO_US(rc6_unit * 6);
+ buf[n++] = NS_TO_US(rc6_unit * 2);
+@@ -337,7 +354,9 @@ static int rc6_encode(enum rc_proto proto, unsigned sc
+ add_bits(scancode, 32, NS_TO_US(rc6_unit));
+ break;
+ }
+-
++#undef advance_space
++#undef advance_pulse
++#undef add_bits
+ /* drop any trailing pulse */
+ return (n % 2) ? n : n + 1;
+ }
diff --git a/multimedia/libv4l/files/patch-utils_common_keymap.h b/multimedia/libv4l/files/patch-utils_common_keymap.h
new file mode 100644
index 000000000000..55c224bd2034
--- /dev/null
+++ b/multimedia/libv4l/files/patch-utils_common_keymap.h
@@ -0,0 +1,32 @@
+--- utils/common/keymap.h.orig 2020-04-09 16:29:54 UTC
++++ utils/common/keymap.h
+@@ -2,6 +2,8 @@
+ #ifndef __KEYMAP_H
+ #define __KEYMAP_H
+
++#include <stdint.h>
++
+ struct keymap {
+ struct keymap *next;
+ char *name;
+@@ -20,16 +22,16 @@ struct protocol_param {
+
+ struct scancode_entry {
+ struct scancode_entry *next;
+- u_int32_t scancode;
++ uint32_t scancode;
+ char *keycode;
+ };
+
+ struct raw_entry {
+ struct raw_entry *next;
+- u_int32_t scancode;
+- u_int32_t raw_length;
++ uint32_t scancode;
++ uint32_t raw_length;
+ char *keycode;
+- u_int32_t raw[1];
++ uint32_t raw[1];
+ };
+
+ void free_keymap(struct keymap *map);
diff --git a/multimedia/libv4l/files/patch-utils_common_v4l2-tpg.h b/multimedia/libv4l/files/patch-utils_common_v4l2-tpg.h
new file mode 100644
index 000000000000..ba4924f53e7c
--- /dev/null
+++ b/multimedia/libv4l/files/patch-utils_common_v4l2-tpg.h
@@ -0,0 +1,12 @@
+--- utils/common/v4l2-tpg.h.orig 2020-04-09 16:29:54 UTC
++++ utils/common/v4l2-tpg.h
+@@ -22,7 +22,9 @@ typedef int16_t s16;
+ typedef uint8_t u8;
+ typedef int8_t s8;
+
++#ifndef __packed
+ #define __packed __attribute__((packed))
++#endif
+ #define pr_info printf
+ #define noinline
+
diff --git a/multimedia/libv4l/files/patch-utils_dvb_dvbv5-daemon.c b/multimedia/libv4l/files/patch-utils_dvb_dvbv5-daemon.c
new file mode 100644
index 000000000000..9ea323aeb099
--- /dev/null
+++ b/multimedia/libv4l/files/patch-utils_dvb_dvbv5-daemon.c
@@ -0,0 +1,14 @@
+--- utils/dvb/dvbv5-daemon.c.orig 2020-04-09 16:29:54 UTC
++++ utils/dvb/dvbv5-daemon.c
+@@ -18,7 +18,11 @@
+ *
+ */
+
++#ifndef __FreeBSD__
+ #define _XOPEN_SOURCE 600
++#else
++#define tdestroy(...) do {} while (0)
++#endif
+
+ #define _FILE_OFFSET_BITS 64
+ #define _LARGEFILE_SOURCE 1
diff --git a/multimedia/libv4l/files/patch-utils_ir-ctl_bpf__encoder.c b/multimedia/libv4l/files/patch-utils_ir-ctl_bpf__encoder.c
new file mode 100644
index 000000000000..451a6e9b372e
--- /dev/null
+++ b/multimedia/libv4l/files/patch-utils_ir-ctl_bpf__encoder.c
@@ -0,0 +1,50 @@
+--- utils/ir-ctl/bpf_encoder.c.orig 2020-04-09 16:29:54 UTC
++++ utils/ir-ctl/bpf_encoder.c
+@@ -84,21 +84,23 @@ static void encode_manchester(struct keymap *map, uint
+ {
+ int len = 0, bits, i;
+
+- void advance_space(unsigned length)
+- {
+- if (len % 2)
+- buf[len] += length;
+- else
+- buf[++len] = length;
+- }
++#define advance_space(__length) \
++ do { \
++ const unsigned length = (__length); \
++ if (len % 2) \
++ buf[len] += length; \
++ else \
++ buf[++len] = length; \
++ } while (0)
+
+- void advance_pulse(unsigned length)
+- {
+- if (len % 2)
+- buf[++len] = length;
+- else
+- buf[len] += length;
+- }
++#define advance_pulse(__length) \
++ do { \
++ const unsigned length = (__length); \
++ if (len % 2) \
++ buf[++len] = length; \
++ else \
++ buf[len] += length; \
++ } while (0)
+
+ bits = keymap_param(map, "bits", 14);
+
+@@ -111,7 +113,8 @@ static void encode_manchester(struct keymap *map, uint
+ advance_pulse(keymap_param(map, "zero_pulse", 888));
+ }
+ }
+-
++#undef advance_space
++#undef advance_pulse
+ /* drop any trailing pulse */
+ *length = (len % 2) ? len : len + 1;
+ }
diff --git a/multimedia/libv4l/files/patch-utils_ir-ctl_ir-ctl.c b/multimedia/libv4l/files/patch-utils_ir-ctl_ir-ctl.c
new file mode 100644
index 000000000000..ef4b27f1b7ba
--- /dev/null
+++ b/multimedia/libv4l/files/patch-utils_ir-ctl_ir-ctl.c
@@ -0,0 +1,10 @@
+--- utils/ir-ctl/ir-ctl.c.orig 2020-04-09 16:29:54 UTC
++++ utils/ir-ctl/ir-ctl.c
+@@ -18,6 +18,7 @@
+ #include <stdlib.h>
+ #include <stdbool.h>
+ #include <stdint.h>
++#include <string.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sys/ioctl.h>
diff --git a/multimedia/libv4l/files/patch-utils_media-ctl_media-ctl.c b/multimedia/libv4l/files/patch-utils_media-ctl_media-ctl.c
new file mode 100644
index 000000000000..30cdf19e08db
--- /dev/null
+++ b/multimedia/libv4l/files/patch-utils_media-ctl_media-ctl.c
@@ -0,0 +1,11 @@
+--- utils/media-ctl/media-ctl.c.orig 2020-04-09 16:29:54 UTC
++++ utils/media-ctl/media-ctl.c
+@@ -213,7 +213,7 @@ static void v4l2_subdev_print_dv_timings(const struct
+
+ printf(" %ux%u%s%llu (%ux%u)",
+ bt->width, bt->height, bt->interlaced ? "i" : "p",
+- (htotal * vtotal) > 0 ? (bt->pixelclock / (htotal * vtotal)) : 0,
++ ((htotal * vtotal) > 0 ? (bt->pixelclock / (htotal * vtotal)) : 0ULL),
+ htotal, vtotal);
+
+ printf(" stds:");
diff --git a/multimedia/libv4l/files/patch-utils_v4l2-compliance_v4l2-test-buffers.cpp b/multimedia/libv4l/files/patch-utils_v4l2-compliance_v4l2-test-buffers.cpp
new file mode 100644
index 000000000000..f2f93cb2b88d
--- /dev/null
+++ b/multimedia/libv4l/files/patch-utils_v4l2-compliance_v4l2-test-buffers.cpp
@@ -0,0 +1,30 @@
+--- utils/v4l2-compliance/v4l2-test-buffers.cpp.orig 2020-04-09 16:29:54 UTC
++++ utils/v4l2-compliance/v4l2-test-buffers.cpp
+@@ -22,6 +22,7 @@
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <string.h>
++#include <signal.h>
+ #include <inttypes.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+@@ -48,8 +49,8 @@
+ #define VIVID_CID_QUEUE_ERROR (VIVID_CID_VIVID_BASE + 70)
+ #define VIVID_CID_REQ_VALIDATE_ERROR (VIVID_CID_VIVID_BASE + 72)
+
+-static struct cv4l_fmt cur_fmt;
+-static struct cv4l_fmt cur_m2m_fmt;
++static cv4l_fmt cur_fmt;
++static cv4l_fmt cur_m2m_fmt;
+ static int stream_from_fd = -1;
+ static bool stream_use_hdr;
+
+@@ -354,7 +355,7 @@ int buffer::check(unsigned type, unsigned memory, unsi
+ unsigned timestamp_src = g_timestamp_src();
+ unsigned frame_types = 0;
+ unsigned buf_states = 0;
+- const struct cv4l_fmt &fmt = is_m2m ? cur_m2m_fmt : cur_fmt;
++ const cv4l_fmt &fmt = is_m2m ? cur_m2m_fmt : cur_fmt;
+
+ fail_on_test(g_type() != type);
+ fail_on_test(g_memory() == 0);
diff --git a/multimedia/libv4l/files/patch-utils_v4l2-ctl_v4l2-ctl-overlay.cpp b/multimedia/libv4l/files/patch-utils_v4l2-ctl_v4l2-ctl-overlay.cpp
new file mode 100644
index 000000000000..4e10a8c8fdaa
--- /dev/null
+++ b/multimedia/libv4l/files/patch-utils_v4l2-ctl_v4l2-ctl-overlay.cpp
@@ -0,0 +1,42 @@
+--- utils/v4l2-ctl/v4l2-ctl-overlay.cpp.orig 2020-04-09 16:29:54 UTC
++++ utils/v4l2-ctl/v4l2-ctl-overlay.cpp
+@@ -14,11 +14,12 @@
+ #include <dirent.h>
+ #include <math.h>
+
++#include "v4l2-ctl.h"
++
++#ifndef __FreeBSD__
+ #include <linux/fb.h>
+ #include <vector>
+
+-#include "v4l2-ctl.h"
+-
+ static unsigned int set_fbuf;
+ static unsigned int set_overlay_fmt;
+ static struct v4l2_format overlay_fmt; /* set_format/get_format video overlay */
+@@ -546,3 +547,24 @@ void overlay_list(cv4l_fd &fd)
+ if (options[OptFindFb])
+ find_fb(fd.g_fd());
+ }
++#else
++void overlay_usage(void)
++{
++}
++
++void overlay_cmd(int ch, char *optarg)
++{
++}
++
++void overlay_set(cv4l_fd &_fd)
++{
++}
++
++void overlay_get(cv4l_fd &_fd)
++{
++}
++
++void overlay_list(cv4l_fd &fd)
++{
++}
++#endif
diff --git a/multimedia/libv4l/files/patch-utils_v4l2-ctl_v4l2-ctl.cpp b/multimedia/libv4l/files/patch-utils_v4l2-ctl_v4l2-ctl.cpp
deleted file mode 100644
index 6db9c5db638e..000000000000
--- a/multimedia/libv4l/files/patch-utils_v4l2-ctl_v4l2-ctl.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
---- utils/v4l2-ctl/v4l2-ctl.cpp.orig 2015-06-14 00:23:03.316457000 -0400
-+++ utils/v4l2-ctl/v4l2-ctl.cpp 2015-06-14 00:28:46.421843000 -0400
-@@ -614,9 +614,50 @@ static std::string cap2s(unsigned cap)
- return s;
- }
-
-+#if __FreeBSD_version < 1000000
-+/* from FreeBSD src/lib/libc/string/strchrnul.c: */
-+
-+char *strchrnul(const char *p, int ch);
-+
-+char *
-+strchrnul(const char *p, int ch)
-+{
-+ char c;
-+
-+ c = ch;
-+ for (;; ++p) {
-+ if (*p == c || *p == '\0')
-+ return ((char *)p);
-+ }
-+ /* NOTREACHED */
-+}
-+#endif
-+
-+int
-+my_getsubopt(char **optionp, char *const *tokens, char **valuep)
-+{
-+ char *endp, *vstart;
-+ int cnt;
-+
-+ if (**optionp == '\0')
-+ return -1;
-+
-+ /* Find end of next token. */
-+ endp = strchrnul (*optionp, ',');
-+
-+ /* The current suboption does not match any option. */
-+ *valuep = *optionp;
-+
-+ if (*endp != '\0')
-+ *endp++ = '\0';
-+ *optionp = endp;
-+
-+ return -1;
-+}
-+
- int parse_subopt(char **subs, const char * const *subopts, char **value)
- {
-- int opt = getsubopt(subs, (char * const *)subopts, value);
-+ int opt = my_getsubopt(subs, (char * const *)subopts, value);
-
- if (opt == -1) {
- fprintf(stderr, "Invalid suboptions specified\n");
diff --git a/multimedia/libv4l/files/types.h b/multimedia/libv4l/files/types.h
new file mode 100644
index 000000000000..eae4f45eddd7
--- /dev/null
+++ b/multimedia/libv4l/files/types.h
@@ -0,0 +1,35 @@
+#ifndef _LINUX_TYPES_H
+#define _LINUX_TYPES_H
+
+#include <stdint.h>
+
+#ifndef HAVE_LINUX_INTEGER_TYPES
+/* XXX remove when depending software has been updated */
+#ifndef __u64
+typedef uint64_t __u64;
+#endif
+#ifndef __u32
+typedef uint32_t __u32;
+#endif
+#ifndef __u16
+typedef uint16_t __u16;
+#endif
+#ifndef __u8
+typedef uint8_t __u8;
+#endif
+
+#ifndef __s64
+typedef int64_t __s64;
+#endif
+#ifndef __s32
+typedef int32_t __s32;
+#endif
+#ifndef __s16
+typedef int16_t __s16;
+#endif
+#ifndef __s8
+typedef int8_t __s8;
+#endif
+#endif
+
+#endif
diff --git a/multimedia/libv4l/pkg-plist b/multimedia/libv4l/pkg-plist
index 9d621d6c0155..295ea46cd24b 100644
--- a/multimedia/libv4l/pkg-plist
+++ b/multimedia/libv4l/pkg-plist
@@ -1,6 +1,7 @@
include/libdvbv5/atsc_eit.h
include/libdvbv5/atsc_header.h
include/libdvbv5/cat.h
+include/libdvbv5/countries.h
include/libdvbv5/crc32.h
include/libdvbv5/desc_atsc_service_location.h
include/libdvbv5/desc_ca.h
@@ -23,6 +24,7 @@ include/libdvbv5/desc_terrestrial_delivery.h
include/libdvbv5/desc_ts_info.h
include/libdvbv5/descriptors.h
include/libdvbv5/dvb-demux.h
+include/libdvbv5/dvb-dev.h
include/libdvbv5/dvb-fe.h
include/libdvbv5/dvb-file.h
include/libdvbv5/dvb-frontend.h
@@ -32,6 +34,7 @@ include/libdvbv5/dvb-scan.h
include/libdvbv5/dvb-v5-std.h
include/libdvbv5/eit.h
include/libdvbv5/header.h
+include/libdvbv5/libdvb-version.h
include/libdvbv5/mgt.h
include/libdvbv5/mpeg_es.h
include/libdvbv5/mpeg_pes.h
diff --git a/multimedia/v4l-utils/Makefile b/multimedia/v4l-utils/Makefile
index 0f7cfcf052d0..02d25a4b9e24 100644
--- a/multimedia/v4l-utils/Makefile
+++ b/multimedia/v4l-utils/Makefile
@@ -2,7 +2,6 @@
# $FreeBSD$
PORTNAME?= v4l-utils
-PORTREVISION= 0
COMMENT= Video4Linux utilities
diff --git a/multimedia/v4l-utils/pkg-plist b/multimedia/v4l-utils/pkg-plist
index 5b484a32d571..6a472a210031 100644
--- a/multimedia/v4l-utils/pkg-plist
+++ b/multimedia/v4l-utils/pkg-plist
@@ -1,17 +1,32 @@
-bin/decode_tm6000
-bin/dvb-fe-tool
-bin/dvb-format-convert
-bin/dvbv5-scan
-bin/dvbv5-zap
+bin/ivtv-ctl
+bin/ir-ctl
+bin/cx18-ctl
bin/ir-keytable
+bin/media-ctl
+bin/v4l2-ctl
+@comment bin/v4l2-sysfs-path
+bin/cec-ctl
+bin/cec-compliance
+bin/cec-follower
bin/rds-ctl
+bin/dvb-fe-tool
+bin/dvbv5-zap
+bin/dvbv5-scan
+bin/dvb-format-convert
+bin/dvbv5-daemon
bin/v4l2-compliance
-@comment bin/v4l2-sysfs-path
etc/rc_maps.cfg
+man/man1/v4l2-ctl.1.gz
+man/man1/cec-ctl.1.gz
+man/man1/cec-compliance.1.gz
+man/man1/cec-follower.1.gz
man/man1/dvb-fe-tool.1.gz
-man/man1/dvb-format-convert.1.gz
-man/man1/dvbv5-scan.1.gz
man/man1/dvbv5-zap.1.gz
+man/man1/dvbv5-scan.1.gz
+man/man1/v4l2-compliance.1.gz
+man/man1/ir-ctl.1.gz
man/man1/ir-keytable.1.gz
+man/man1/dvb-format-convert.1.gz
+man/man5/rc_keymap.5.gz
sbin/v4l2-dbg
@dir etc/rc_keymaps
diff --git a/multimedia/v4l_compat/Makefile b/multimedia/v4l_compat/Makefile
index 061d0a7d57e9..a816fe9e5416 100644
--- a/multimedia/v4l_compat/Makefile
+++ b/multimedia/v4l_compat/Makefile
@@ -1,7 +1,6 @@
# $FreeBSD$
PORTNAME= v4l_compat
-PORTREVISION= 3
COMMENT= Video4Linux IOCTL header files
@@ -9,33 +8,47 @@ NO_BUILD= yes
NO_ARCH= yes
MASTERDIR= ${.CURDIR}/../libv4l
-EXTRADIR= ${WRKSRC}/../linux
DESCR= ${.CURDIR}/pkg-descr
PLIST= ${.CURDIR}/pkg-plist
-BASE_HEADERS= ivtv.h v4l2-controls.h \
- v4l2-common.h videodev2.h
-DVB_HEADERS= audio.h dmx.h frontend.h video.h
-EXTRA_HEADERS= ca.h net.h osd.h version.h
+BASE_HEADERS= \
+ linux/cec.h \
+ linux/cec-funcs.h \
+ linux/dvb/audio.h \
+ linux/dvb/ca.h \
+ linux/dvb/dmx.h \
+ linux/dvb/frontend.h \
+ linux/dvb/net.h \
+ linux/dvb/osd.h \
+ linux/dvb/version.h \
+ linux/dvb/video.h \
+ linux/ivtv.h \
+ linux/lirc.h \
+ linux/media.h \
+ linux/media-bus-format.h \
+ linux/v4l2-common.h \
+ linux/v4l2-controls.h \
+ linux/v4l2-mediabus.h \
+ linux/v4l2-subdev.h \
+ linux/videodev2.h
do-install:
- @${MKDIR} ${STAGEDIR}${PREFIX}/include/linux/dvb/
-.for i in ${BASE_HEADERS}
- ${INSTALL_DATA} ${WRKSRC}/contrib/freebsd/include/linux/${i} \
- ${STAGEDIR}${PREFIX}/include/linux/
-.endfor
-.for i in ${DVB_HEADERS}
- ${INSTALL_DATA} ${WRKSRC}/include/linux/dvb/${i} \
- ${STAGEDIR}${PREFIX}/include/linux/dvb
+ @${MKDIR} ${STAGEDIR}${PREFIX}/include/linux/dvb
+
+.for F in ${BASE_HEADERS}
+ ${INSTALL_DATA} \
+ ${WRKDIR}/webcamd-${WEBCAMDVERSION}/media_tree/include/uapi/${F} \
+ ${STAGEDIR}${PREFIX}/include/${F}
.endfor
-# V4L1 is dead in linux, however webcamd still supports it.
- ${INSTALL_DATA} ${FILESDIR}/videodev.h \
+
+# V4L1 is dead in upstream Linux, however libv4l still supports it.
+ ${INSTALL_DATA} \
+ ${FILESDIR}/videodev.h \
+ ${STAGEDIR}${PREFIX}/include/linux/
+
+# Install types header file
+ ${INSTALL_DATA} \
+ ${FILESDIR}/types.h \
${STAGEDIR}${PREFIX}/include/linux/
-# Extra dvb headers supplied taken from the linux kernel distfile.
-# vdr and the gst dvb plugin need them at least
-.for i in ${EXTRA_HEADERS}
- ${INSTALL_DATA} ${EXTRADIR}/dvb/${i} \
- ${STAGEDIR}${PREFIX}/include/linux/dvb/
-.endfor
.include "${MASTERDIR}/Makefile"
diff --git a/multimedia/v4l_compat/pkg-plist b/multimedia/v4l_compat/pkg-plist
index 5f2581c698d8..145d2db16276 100644
--- a/multimedia/v4l_compat/pkg-plist
+++ b/multimedia/v4l_compat/pkg-plist
@@ -1,13 +1,21 @@
+include/linux/cec.h
+include/linux/cec-funcs.h
include/linux/dvb/audio.h
include/linux/dvb/ca.h
include/linux/dvb/dmx.h
-include/linux/dvb/net.h
include/linux/dvb/frontend.h
+include/linux/dvb/net.h
include/linux/dvb/osd.h
include/linux/dvb/version.h
include/linux/dvb/video.h
include/linux/ivtv.h
+include/linux/lirc.h
+include/linux/media.h
+include/linux/media-bus-format.h
+include/linux/types.h
include/linux/v4l2-common.h
include/linux/v4l2-controls.h
+include/linux/v4l2-mediabus.h
+include/linux/v4l2-subdev.h
include/linux/videodev.h
include/linux/videodev2.h