Hi,

in a previous commit
(http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/sys/videoio.h?rev=1.12&content-type=text/x-cvsweb-markup)
we updated our V4L2 API. However, one file (v4l2-common.h) could not be
inlined as it was only GPL2 licensed.

After discussion with the authors they agreed to dual license (GPL + BSD) this
file as well
(https://git.linuxtv.org/media_tree.git/commit/?id=80100fd9ebb9f2414892a1178d26a4253e6c0bcf)
which allows us to fully comply with the V4L2 API. The attached diff
implements this and syncs with videodev2.h from the Linux kernel version
4.10-rc5 at the same time
(https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/include/uapi/linux/videodev2.h?id=refs/tags/v4.10-rc5).

(The sync with a recent Linux videodev2.h is a prerequisite for updating the
port multimedia/libv4l to 1.12.2.)

I compiled a current kernel on amd64. My camera still works fine (tested with
luvcview and baresip in combination with libv4l 1.12.2).

OK?

Best regards,
Ingo

Index: sys/sys/videoio.h
===================================================================
RCS file: /cvs/src/sys/sys/videoio.h,v
retrieving revision 1.14
diff -u -p -r1.14 videoio.h
--- sys/sys/videoio.h   27 Jan 2016 13:07:09 -0000      1.14
+++ sys/sys/videoio.h   28 Jan 2017 10:45:55 -0000
@@ -3,6 +3,8 @@
  *  Video for Linux Two header file
  *
  *  Copyright (C) 1999-2012 the contributors
+ *  Copyright (C) 2012 Nokia Corporation
+ *  Contact: Sakari Ailus <sakari.ai...@iki.fi>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -47,7 +49,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 <b...@thedirks.org>
  *             Justin Schoeman
@@ -60,8 +62,84 @@
 #include <sys/time.h>
 #include <sys/types.h>
 #include <sys/ioccom.h>
-/* Ignore #include <linux/v4l2-common.h> as it is GPL2.
- * Inline #include <linux/v4l2-controls.h>
+#ifndef __u8
+typedef u_int8_t __u8;
+#endif
+#ifndef __u16
+typedef u_int16_t __u16;
+#endif
+#ifndef __u32
+typedef u_int32_t __u32;
+#endif
+#ifndef __u64
+typedef u_int64_t __u64;
+#endif
+#ifndef __s32
+typedef int32_t __s32;
+#endif
+#ifndef __s64
+typedef int64_t __s64;
+#endif
+#ifndef __le32
+typedef __u32 __le32;
+#endif
+/* Inline #include <linux/v4l2-common.h>
+ * (v4l2-common.h was split off from videodev2.h and has the same BSD license.)
+ *
+ * Begin of v4l2-common.h
+ */
+/*
+ *
+ * Selection interface definitions
+ *
+ */
+
+/* Current cropping area */
+#define V4L2_SEL_TGT_CROP              0x0000
+/* Default cropping area */
+#define V4L2_SEL_TGT_CROP_DEFAULT      0x0001
+/* Cropping bounds */
+#define V4L2_SEL_TGT_CROP_BOUNDS       0x0002
+/* Native frame size */
+#define V4L2_SEL_TGT_NATIVE_SIZE       0x0003
+/* Current composing area */
+#define V4L2_SEL_TGT_COMPOSE           0x0100
+/* Default composing area */
+#define V4L2_SEL_TGT_COMPOSE_DEFAULT   0x0101
+/* Composing bounds */
+#define V4L2_SEL_TGT_COMPOSE_BOUNDS    0x0102
+/* Current composing area plus all padding pixels */
+#define V4L2_SEL_TGT_COMPOSE_PADDED    0x0103
+
+/* Backward compatibility target definitions --- to be removed. */
+#define V4L2_SEL_TGT_CROP_ACTIVE       V4L2_SEL_TGT_CROP
+#define V4L2_SEL_TGT_COMPOSE_ACTIVE    V4L2_SEL_TGT_COMPOSE
+#define V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL        V4L2_SEL_TGT_CROP
+#define V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL V4L2_SEL_TGT_COMPOSE
+#define V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS        V4L2_SEL_TGT_CROP_BOUNDS
+#define V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS V4L2_SEL_TGT_COMPOSE_BOUNDS
+
+/* Selection flags */
+#define V4L2_SEL_FLAG_GE               (1 << 0)
+#define V4L2_SEL_FLAG_LE               (1 << 1)
+#define V4L2_SEL_FLAG_KEEP_CONFIG      (1 << 2)
+
+/* Backward compatibility flag definitions --- to be removed. */
+#define V4L2_SUBDEV_SEL_FLAG_SIZE_GE   V4L2_SEL_FLAG_GE
+#define V4L2_SUBDEV_SEL_FLAG_SIZE_LE   V4L2_SEL_FLAG_LE
+#define V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG V4L2_SEL_FLAG_KEEP_CONFIG
+
+struct v4l2_edid {
+       __u32 pad;
+       __u32 start_block;
+       __u32 blocks;
+       __u32 reserved[5];
+       __u8  *edid;
+};
+/*
+ * End of v4l2-common.h
+ */
+/* Inline #include <linux/v4l2-controls.h>
  * (v4l2-controls.h was split off from videodev2.h and has the same BSD 
license.)
  *
  * Begin of v4l2-controls.h
@@ -175,8 +253,10 @@ enum v4l2_colorfx {
  * We reserve 16 controls for this driver. */
 #define V4L2_CID_USER_S2255_BASE               (V4L2_CID_USER_BASE + 0x1030)
 
-/* The base for the si476x driver controls. See include/media/si476x.h for the 
list
- * of controls. Total of 16 controls is reserved for this driver */
+/*
+ * The base for the si476x driver controls. See include/media/drv-intf/si476x.h
+ * for the list of controls. Total of 16 controls is reserved for this driver
+ */
 #define V4L2_CID_USER_SI476X_BASE              (V4L2_CID_USER_BASE + 0x1040)
 
 /* The base for the TI VPE driver controls. Total of 16 controls is reserved 
for
@@ -405,6 +485,7 @@ enum v4l2_mpeg_video_multi_slice_mode {
 #define V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER          (V4L2_CID_MPEG_BASE+226)
 #define V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE          (V4L2_CID_MPEG_BASE+227)
 #define V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE          (V4L2_CID_MPEG_BASE+228)
+#define V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME            (V4L2_CID_MPEG_BASE+229)
 
 #define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP            (V4L2_CID_MPEG_BASE+300)
 #define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP            (V4L2_CID_MPEG_BASE+301)
@@ -906,6 +987,7 @@ enum v4l2_jpeg_chroma_subsampling {
 #define V4L2_CID_LINK_FREQ                     (V4L2_CID_IMAGE_PROC_CLASS_BASE 
+ 1)
 #define V4L2_CID_PIXEL_RATE                    (V4L2_CID_IMAGE_PROC_CLASS_BASE 
+ 2)
 #define V4L2_CID_TEST_PATTERN                  (V4L2_CID_IMAGE_PROC_CLASS_BASE 
+ 3)
+#define V4L2_CID_DEINTERLACING_MODE            (V4L2_CID_IMAGE_PROC_CLASS_BASE 
+ 4)
 
 
 /*  DV-class control IDs defined by V4L2 */
@@ -927,8 +1009,18 @@ enum v4l2_dv_rgb_range {
        V4L2_DV_RGB_RANGE_FULL    = 2,
 };
 
+#define V4L2_CID_DV_TX_IT_CONTENT_TYPE         (V4L2_CID_DV_CLASS_BASE + 6)
+enum v4l2_dv_it_content_type {
+       V4L2_DV_IT_CONTENT_TYPE_GRAPHICS  = 0,
+       V4L2_DV_IT_CONTENT_TYPE_PHOTO     = 1,
+       V4L2_DV_IT_CONTENT_TYPE_CINEMA    = 2,
+       V4L2_DV_IT_CONTENT_TYPE_GAME      = 3,
+       V4L2_DV_IT_CONTENT_TYPE_NO_ITC    = 4,
+};
+
 #define        V4L2_CID_DV_RX_POWER_PRESENT            (V4L2_CID_DV_CLASS_BASE 
+ 100)
 #define V4L2_CID_DV_RX_RGB_RANGE               (V4L2_CID_DV_CLASS_BASE + 101)
+#define V4L2_CID_DV_RX_IT_CONTENT_TYPE         (V4L2_CID_DV_CLASS_BASE + 102)
 
 #define V4L2_CID_FM_RX_CLASS_BASE              (V4L2_CTRL_CLASS_FM_RX | 0x900)
 #define V4L2_CID_FM_RX_CLASS                   (V4L2_CTRL_CLASS_FM_RX | 1)
@@ -985,29 +1077,6 @@ enum v4l2_detect_md_mode {
 #define __user
 #endif
 
-#ifndef __u8
-typedef u_int8_t __u8;
-#endif
-#ifndef __u16
-typedef u_int16_t __u16;
-#endif
-#ifndef __u32
-typedef u_int32_t __u32;
-#endif
-#ifndef __u64
-typedef u_int64_t __u64;
-#endif
-#ifndef __s32
-typedef int32_t __s32;
-#endif
-#ifndef __s64
-typedef int64_t __s64;
-#endif
-#ifndef __le32
-typedef __u32 __le32;
-#endif
-
-
 /*
  * Common stuff for both V4L1 and V4L2
  * Moved from videodev.h
@@ -1081,10 +1150,7 @@ 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,
@@ -1238,13 +1304,11 @@ enum v4l2_ycbcr_encoding {
         * various colorspaces:
         *
         * V4L2_COLORSPACE_SMPTE170M, V4L2_COLORSPACE_470_SYSTEM_M,
-        * V4L2_COLORSPACE_470_SYSTEM_BG, V4L2_COLORSPACE_ADOBERGB and
-        * V4L2_COLORSPACE_JPEG: V4L2_YCBCR_ENC_601
+        * 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_SRGB: V4L2_YCBCR_ENC_SYCC
-        *
         * V4L2_COLORSPACE_BT2020: V4L2_YCBCR_ENC_BT2020
         *
         * V4L2_COLORSPACE_SMPTE240M: V4L2_YCBCR_ENC_SMPTE240M
@@ -1263,8 +1327,14 @@ enum v4l2_ycbcr_encoding {
        /* Rec. 709/EN 61966-2-4 Extended Gamut -- HDTV */
        V4L2_YCBCR_ENC_XV709          = 4,
 
-       /* sYCC (Y'CbCr encoding of sRGB) */
+#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,
@@ -1277,6 +1347,19 @@ enum v4l2_ycbcr_encoding {
 };
 
 /*
+ * 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.
  */
@@ -1291,8 +1374,8 @@ 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, SYCC, XV601 or XV709:
-        * those are full range.
+        * limited range, except for COLORSPACE_JPEG, SRGB, ADOBERGB,
+        * XV601 or XV709: those are full range.
         */
        V4L2_QUANTIZATION_DEFAULT     = 0,
        V4L2_QUANTIZATION_FULL_RANGE  = 1,
@@ -1304,10 +1387,12 @@ enum v4l2_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, colsp, ycbcr_enc) \
-       (((is_rgb) && (colsp) == V4L2_COLORSPACE_BT2020) ? 
V4L2_QUANTIZATION_LIM_RANGE : \
-        (((is_rgb) || (ycbcr_enc) == V4L2_YCBCR_ENC_XV601 || \
-         (ycbcr_enc) == V4L2_YCBCR_ENC_XV709 || (colsp) == 
V4L2_COLORSPACE_JPEG) ? \
+#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) || (ycbcr_enc) == V4L2_YCBCR_ENC_XV601 || \
+         (ycbcr_enc) == V4L2_YCBCR_ENC_XV709 || (colsp) == 
V4L2_COLORSPACE_JPEG) || \
+         (colsp) == V4L2_COLORSPACE_ADOBERGB || (colsp) == 
V4L2_COLORSPACE_SRGB ? \
         V4L2_QUANTIZATION_FULL_RANGE : V4L2_QUANTIZATION_LIM_RANGE))
 
 enum v4l2_priority {
@@ -1386,6 +1471,8 @@ struct v4l2_capability {
 #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 */
 
 /*
@@ -1401,7 +1488,12 @@ struct v4l2_pix_format {
        __u32                   colorspace;     /* enum v4l2_colorspace */
        __u32                   priv;           /* private data, depends on 
pixelformat */
        __u32                   flags;          /* format flags 
(V4L2_PIX_FMT_FLAG_*) */
-       __u32                   ycbcr_enc;      /* enum v4l2_ycbcr_encoding */
+       union {
+               /* enum v4l2_ycbcr_encoding */
+               __u32                   ycbcr_enc;
+               /* enum v4l2_hsv_encoding */
+               __u32                   hsv_enc;
+       };
        __u32                   quantization;   /* enum v4l2_quantization */
        __u32                   xfer_func;      /* enum v4l2_xfer_func */
 };
@@ -1450,22 +1542,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 */
@@ -1486,9 +1572,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.. */
@@ -1519,6 +1617,13 @@ struct v4l2_pix_format {
 #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.. */
 #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   
*/
@@ -1536,6 +1641,7 @@ 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 */
 
 /*  Vendor-specific formats   */
 #define V4L2_PIX_FMT_CPIA1    v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */
@@ -1564,6 +1670,10 @@ 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  */
 
 /* SDR formats - used only for Software Defined Radio devices */
 #define V4L2_SDR_FMT_CU8          v4l2_fourcc('C', 'U', '0', '8') /* IQ u8 */
@@ -1572,6 +1682,12 @@ struct v4l2_pix_format {
 #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 */
 
+/* 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 */
+
 /* priv field value to indicates that subsequent fields are valid. */
 #define V4L2_PIX_FMT_PRIV_MAGIC                0xfeedcafe
 
@@ -1593,8 +1709,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
  */
@@ -1660,7 +1775,6 @@ struct v4l2_frmivalenum {
 
        __u32   reserved[2];                    /* Reserved space for future 
use */
 };
-#endif
 
 /*
  *     T I M E C O D E
@@ -2155,6 +2269,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
@@ -2184,7 +2301,10 @@ struct v4l2_bt_timings {
        __u32   il_vbackporch;
        __u32   standards;
        __u32   flags;
-       __u32   reserved[14];
+       struct v4l2_fract picture_aspect;
+       __u8    cea861_vic;
+       __u8    hdmi_vic;
+       __u8    reserved[46];
 } __attribute__ ((packed));
 
 /* Interlaced or progressive format */
@@ -2200,37 +2320,70 @@ 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 */
 
-/* CVT/GTF specific: timing uses reduced blanking (CVT) or the 'Secondary
-   GTF' curve (GTF). In both cases the horizontal and/or vertical blanking
-   intervals are reduced, allowing a higher resolution over the same
-   bandwidth. This is a read-only flag. */
+/*
+ * CVT/GTF specific: timing uses reduced blanking (CVT) or the 'Secondary
+ * GTF' curve (GTF). In both cases the horizontal and/or vertical blanking
+ * intervals are reduced, allowing a higher resolution over the same
+ * bandwidth. This is a read-only flag.
+ */
 #define V4L2_DV_FL_REDUCED_BLANKING            (1 << 0)
-/* CEA-861 specific: set for CEA-861 formats with a framerate of a multiple
-   of six. These formats can be optionally played at 1 / 1.001 speed.
-   This is a read-only flag. */
+/*
+ * CEA-861 specific: set for CEA-861 formats with a framerate of a multiple
+ * of six. These formats can be optionally played at 1 / 1.001 speed.
+ * This is a read-only flag.
+ */
 #define V4L2_DV_FL_CAN_REDUCE_FPS              (1 << 1)
-/* CEA-861 specific: only valid for video transmitters, the flag is cleared
-   by receivers.
-   If the framerate of the format is a multiple of six, then the pixelclock
-   used to set up the transmitter is divided by 1.001 to make it compatible
-   with 60 Hz based standards such as NTSC and PAL-M that use a framerate of
-   29.97 Hz. Otherwise this flag is cleared. If the transmitter can't generate
-   such frequencies, then the flag will also be cleared. */
+/*
+ * CEA-861 specific: only valid for video transmitters, the flag is cleared
+ * by receivers.
+ * If the framerate of the format is a multiple of six, then the pixelclock
+ * used to set up the transmitter is divided by 1.001 to make it compatible
+ * with 60 Hz based standards such as NTSC and PAL-M that use a framerate of
+ * 29.97 Hz. Otherwise this flag is cleared. If the transmitter can't generate
+ * such frequencies, then the flag will also be cleared.
+ */
 #define V4L2_DV_FL_REDUCED_FPS                 (1 << 2)
-/* Specific to interlaced formats: if set, then field 1 is really one half-line
-   longer and field 2 is really one half-line shorter, so each field has
-   exactly the same number of half-lines. Whether half-lines can be detected
-   or used depends on the hardware. */
+/*
+ * Specific to interlaced formats: if set, then field 1 is really one half-line
+ * longer and field 2 is really one half-line shorter, so each field has
+ * 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
+/*
+ * 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. */
+ * 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) \
@@ -2340,6 +2493,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 */
@@ -2354,6 +2508,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 */
@@ -2419,7 +2575,12 @@ struct v4l2_ext_control {
 } __attribute__ ((packed));
 
 struct v4l2_ext_controls {
-       __u32 ctrl_class;
+       union {
+#ifndef __KERNEL__
+               __u32 ctrl_class;
+#endif
+               __u32 which;
+       };
        __u32 count;
        __u32 error_idx;
        __u32 reserved[2];
@@ -2427,9 +2588,14 @@ struct v4l2_ext_controls {
 };
 
 #define V4L2_CTRL_ID_MASK                (0x0fffffff)
+#ifndef __KERNEL__
 #define V4L2_CTRL_ID2CLASS(id)    ((id) & 0x0fff0000UL)
+#endif
+#define V4L2_CTRL_ID2WHICH(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,
@@ -2654,8 +2820,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)
@@ -2915,7 +3079,10 @@ struct v4l2_pix_format_mplane {
        struct v4l2_plane_pix_format    plane_fmt[VIDEO_MAX_PLANES];
        __u8                            num_planes;
        __u8                            flags;
-       __u8                            ycbcr_enc;
+        union {
+               __u8                            ycbcr_enc;
+               __u8                            hsv_enc;
+       };
        __u8                            quantization;
        __u8                            xfer_func;
        __u8                            reserved[7];
@@ -3152,11 +3319,8 @@ struct v4l2_create_buffers {
 #define VIDIOC_QUERYMENU       _IOWR('V', 37, struct v4l2_querymenu)
 #define VIDIOC_G_INPUT          _IOR('V', 38, int)
 #define VIDIOC_S_INPUT         _IOWR('V', 39, int)
-/* Ignore as we do not have v4l2-common.h */
-#if 0
 #define VIDIOC_G_EDID          _IOWR('V', 40, struct v4l2_edid)
 #define VIDIOC_S_EDID          _IOWR('V', 41, struct v4l2_edid)
-#endif
 #define VIDIOC_G_OUTPUT                 _IOR('V', 46, int)
 #define VIDIOC_S_OUTPUT                _IOWR('V', 47, int)
 #define VIDIOC_ENUMOUTPUT      _IOWR('V', 48, struct v4l2_output)
@@ -3188,46 +3352,35 @@ struct v4l2_create_buffers {
 #define VIDIOC_ENCODER_CMD      _IOWR('V', 77, struct v4l2_encoder_cmd)
 #define VIDIOC_TRY_ENCODER_CMD  _IOWR('V', 78, struct v4l2_encoder_cmd)
 
-/* Experimental, meant for debugging, testing and internal use.
-   Only implemented if CONFIG_VIDEO_ADV_DEBUG is defined.
-   You must be root to use these ioctls. Never use these in applications! */
+/*
+ * Experimental, meant for debugging, testing and internal use.
+ * Only implemented if CONFIG_VIDEO_ADV_DEBUG is defined.
+ * You must be root to use these ioctls. Never use these in applications!
+ */
 #define        VIDIOC_DBG_S_REGISTER    _IOW('V', 79, struct v4l2_dbg_register)
 #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)
@@ -3237,4 +3390,4 @@ struct v4l2_create_buffers {
 
 #define BASE_VIDIOC_PRIVATE    192             /* 192-255 are private */
 
-#endif                         /* _SYS_VIDEOIO_H */
+#endif /* _SYS_VIDEOIO_H */

Reply via email to