diff --git a/sys/sys/videoio.h b/sys/sys/videoio.h --- a/sys/sys/videoio.h +++ b/sys/sys/videoio.h @@ -165,6 +165,13 @@ u_int32_t denominator; }; +struct v4l2_rect { + int32_t left; + int32_t top; + u_int32_t width; + u_int32_t height; +}; + struct v4l2_capability { u_int8_t driver[16]; u_int8_t card[32]; @@ -228,11 +235,27 @@ ((type) == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE || \ (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) +struct v4l2_clip { + struct v4l2_rect c; + struct v4l2_clip *next; +}; + +struct v4l2_window { + struct v4l2_rect w; + u_int32_t field; + u_int32_t chromakey; + struct v4l2_clip *clips; + u_int32_t clipcount; + void *bitmap; + u_int8_t global_alpha; +}; + struct v4l2_format { u_int32_t type; union { struct v4l2_pix_format pix; struct v4l2_pix_format_mplane pix_mp; + struct v4l2_window win; void *_align; u_int8_t raw_data[200]; } fmt; @@ -361,6 +384,28 @@ u_int32_t reserved[2]; }; +struct v4l2_querymenu { + u_int32_t id; + u_int32_t index; + union { + u_int8_t name[32]; + int64_t value; + }; + u_int32_t reserved; +} __packed; + +struct v4l2_cropcap { + u_int32_t type; + struct v4l2_rect bounds; + struct v4l2_rect defrect; + struct v4l2_fract pixelaspect; +}; + +struct v4l2_crop { + u_int32_t type; + struct v4l2_rect c; +}; + struct v4l2_frmsize_discrete { u_int32_t width; /* Frame width [pixel] */ u_int32_t height; /* Frame height [pixel] */ @@ -511,6 +556,7 @@ /* * Input types */ +#define V4L2_INPUT_TYPE_TUNER 1 #define V4L2_INPUT_TYPE_CAMERA 2 /* @@ -544,11 +590,14 @@ #define V4L2_CID_BLUE_BALANCE (V4L2_CID_BASE + 15) #define V4L2_CID_GAMMA (V4L2_CID_BASE + 16) #define V4L2_CID_GAIN (V4L2_CID_BASE + 19) +#define V4L2_CID_HFLIP (V4L2_CID_BASE + 20) +#define V4L2_CID_VFLIP (V4L2_CID_BASE + 21) #define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_BASE + 24) #define V4L2_CID_HUE_AUTO (V4L2_CID_BASE + 25) #define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_BASE + 26) #define V4L2_CID_SHARPNESS (V4L2_CID_BASE + 27) #define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_BASE + 28) +#define V4L2_CID_LASTP1 (V4L2_CID_BASE + 44) #define V4L2_CID_CAMERA_CLASS_BASE 0x009a0000 #define V4L2_CID_EXPOSURE_AUTO (V4L2_CID_CAMERA_CLASS_BASE + 1) @@ -563,6 +612,23 @@ #define V4L2_CID_ZOOM_CONTINUOUS (V4L2_CID_CAMERA_CLASS_BASE + 15) #define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE + 16) +/* + * IDs reserved for driver specific controls + */ +#define V4L2_CID_PRIVATE_BASE 0x08000000 + +/* + * Control flags + */ +#define V4L2_CTRL_FLAG_DISABLED 0x0001 +#define V4L2_CTRL_FLAG_GRABBED 0x0002 +#define V4L2_CTRL_FLAG_READ_ONLY 0x0004 +#define V4L2_CTRL_FLAG_UPDATE 0x0008 +#define V4L2_CTRL_FLAG_INACTIVE 0x0010 +#define V4L2_CTRL_FLAG_SLIDER 0x0020 +#define V4L2_CTRL_FLAG_WRITE_ONLY 0x0040 +#define V4L2_CTRL_FLAG_VOLATILE 0x0080 + /* * V4L2 ioctl definitions */ @@ -585,8 +651,12 @@ #define VIDIOC_G_CTRL _IOWR('V', 27, struct v4l2_control) #define VIDIOC_S_CTRL _IOWR('V', 28, struct v4l2_control) #define VIDIOC_QUERYCTRL _IOWR('V', 36, struct v4l2_queryctrl) +#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) +#define VIDIOC_CROPCAP _IOWR('V', 58, struct v4l2_cropcap) +#define VIDIOC_G_CROP _IOWR('V', 59, struct v4l2_crop) +#define VIDIOC_S_CROP _IOW('V', 60, struct v4l2_crop) #define VIDIOC_G_PRIORITY _IOR('V', 67, u_int32_t) #define VIDIOC_S_PRIORITY _IOW('V', 68, u_int32_t) #define VIDIOC_TRY_FMT _IOWR('V', 64, struct v4l2_format) @@ -597,6 +667,9 @@ _Static_assert(sizeof(struct v4l2_capability) == 104, "v4l2_capability layout"); _Static_assert(sizeof(struct v4l2_requestbuffers) == 20, "v4l2_requestbuffers layout"); +_Static_assert(sizeof(struct v4l2_querymenu) == 44, "v4l2_querymenu layout"); +_Static_assert(sizeof(struct v4l2_cropcap) == 44, "v4l2_cropcap layout"); +_Static_assert(sizeof(struct v4l2_crop) == 20, "v4l2_crop layout"); #ifdef __LP64__ _Static_assert(__offsetof(struct v4l2_format, fmt) == 8, "v4l2_format layout"); _Static_assert(sizeof(struct v4l2_format) == 208, "v4l2_format layout");