Tested with VIVID ./v4l2-ctl -C rect -d 0 rect: 300x400@200x100 ./v4l2-ctl -c rect=1000x2000@0x0 ./v4l2-ctl -C rect -d 0 rect: 1000x2000@0x0 Signed-off-by: Yunke Cao <yunkec@xxxxxxxxxx> --- include/linux/videodev2.h | 2 ++ utils/v4l2-ctl/v4l2-ctl-common.cpp | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index c19441a1..a27ea755 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -1776,6 +1776,7 @@ struct v4l2_ext_control { struct v4l2_ctrl_hevc_slice_params *p_hevc_slice_params; struct v4l2_ctrl_hevc_scaling_matrix *p_hevc_scaling_matrix; struct v4l2_ctrl_hevc_decode_params *p_hevc_decode_params; + struct v4l2_rect *p_rect; void *ptr; }; } __attribute__ ((packed)); @@ -1818,6 +1819,7 @@ enum v4l2_ctrl_type { V4L2_CTRL_TYPE_U16 = 0x0101, V4L2_CTRL_TYPE_U32 = 0x0102, V4L2_CTRL_TYPE_AREA = 0x0106, + V4L2_CTRL_TYPE_RECT = 0x0107, V4L2_CTRL_TYPE_HDR10_CLL_INFO = 0x0110, V4L2_CTRL_TYPE_HDR10_MASTERING_DISPLAY = 0x0111, diff --git a/utils/v4l2-ctl/v4l2-ctl-common.cpp b/utils/v4l2-ctl/v4l2-ctl-common.cpp index a1cc93c8..07d2e34b 100644 --- a/utils/v4l2-ctl/v4l2-ctl-common.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-common.cpp @@ -516,6 +516,13 @@ static void print_value(int fd, const v4l2_query_ext_ctrl &qc, const v4l2_ext_co case V4L2_CTRL_TYPE_AREA: printf("%dx%d", ctrl.p_area->width, ctrl.p_area->height); break; + case V4L2_CTRL_TYPE_RECT: + printf("%ux%u@%dx%d", + ctrl.p_rect->width, + ctrl.p_rect->height, + ctrl.p_rect->left, + ctrl.p_rect->top); + break; default: printf("unsupported payload type"); break; @@ -604,6 +611,9 @@ static void print_qctrl(int fd, const v4l2_query_ext_ctrl &qc, case V4L2_CTRL_TYPE_AREA: printf("%31s %#8.8x (area) :", s.c_str(), qc.id); break; + case V4L2_CTRL_TYPE_RECT: + printf("%31s %#8.8x (rect) :", s.c_str(), qc.id); + break; case V4L2_CTRL_TYPE_HDR10_CLL_INFO: printf("%31s %#8.8x (hdr10-cll-info):", s.c_str(), qc.id); break; @@ -1157,6 +1167,11 @@ void common_set(cv4l_fd &_fd) sscanf(set_ctrl.second.c_str(), "%ux%u", &ctrl.p_area->width, &ctrl.p_area->height); break; + case V4L2_CTRL_TYPE_RECT: + sscanf(set_ctrl.second.c_str(), "%ux%u@%dx%d", + &ctrl.p_rect->width, &ctrl.p_rect->height, + &ctrl.p_rect->left, &ctrl.p_rect->top); + break; default: fprintf(stderr, "%s: unsupported payload type\n", qc.name); -- 2.41.0.694.ge786442a9b-goog