[media] v4l: VIDIOC_SUBDEV_S_SELECTION and VIDIOC_SUBDEV_G_SELECTION IOCTLs

Add support for VIDIOC_SUBDEV_S_SELECTION and VIDIOC_SUBDEV_G_SELECTION
IOCTLs. They replace functionality provided by VIDIOC_SUBDEV_S_CROP and
VIDIOC_SUBDEV_G_CROP IOCTLs and also add new functionality (composing).

VIDIOC_SUBDEV_G_CROP and VIDIOC_SUBDEV_S_CROP continue to be supported.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Sakari Ailus
2011-10-14 14:14:26 -03:00
committed by Mauro Carvalho Chehab
parent c520331a52
commit ae184cda8d
3 changed files with 90 additions and 14 deletions

View File

@@ -123,6 +123,43 @@ struct v4l2_subdev_frame_interval_enum {
__u32 reserved[9];
};
#define V4L2_SUBDEV_SEL_FLAG_SIZE_GE (1 << 0)
#define V4L2_SUBDEV_SEL_FLAG_SIZE_LE (1 << 1)
#define V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG (1 << 2)
/* active cropping area */
#define V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL 0x0000
/* cropping bounds */
#define V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS 0x0002
/* current composing area */
#define V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL 0x0100
/* composing bounds */
#define V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS 0x0102
/**
* struct v4l2_subdev_selection - selection info
*
* @which: either V4L2_SUBDEV_FORMAT_ACTIVE or V4L2_SUBDEV_FORMAT_TRY
* @pad: pad number, as reported by the media API
* @target: selection target, used to choose one of possible rectangles
* @flags: constraint flags
* @r: coordinates of the selection window
* @reserved: for future use, set to zero for now
*
* Hardware may use multiple helper windows to process a video stream.
* The structure is used to exchange this selection areas between
* an application and a driver.
*/
struct v4l2_subdev_selection {
__u32 which;
__u32 pad;
__u32 target;
__u32 flags;
struct v4l2_rect r;
__u32 reserved[8];
};
#define VIDIOC_SUBDEV_G_FMT _IOWR('V', 4, struct v4l2_subdev_format)
#define VIDIOC_SUBDEV_S_FMT _IOWR('V', 5, struct v4l2_subdev_format)
#define VIDIOC_SUBDEV_G_FRAME_INTERVAL \
@@ -137,5 +174,9 @@ struct v4l2_subdev_frame_interval_enum {
_IOWR('V', 75, struct v4l2_subdev_frame_interval_enum)
#define VIDIOC_SUBDEV_G_CROP _IOWR('V', 59, struct v4l2_subdev_crop)
#define VIDIOC_SUBDEV_S_CROP _IOWR('V', 60, struct v4l2_subdev_crop)
#define VIDIOC_SUBDEV_G_SELECTION \
_IOWR('V', 61, struct v4l2_subdev_selection)
#define VIDIOC_SUBDEV_S_SELECTION \
_IOWR('V', 62, struct v4l2_subdev_selection)
#endif