diff options
author | Tomasz Stanislawski <t.stanislaws@samsung.com> | 2011-08-10 09:37:47 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-01-10 20:17:45 -0500 |
commit | 0e8caaceff160ad821c83d798fc03812cb810560 (patch) | |
tree | fd5f0687bff110fddb62b8f22ac31f41e8bc11f6 /include | |
parent | dab734ec95168488c4b32632e968ce885a083078 (diff) |
[media] v4l: add support for selection api
This patch introduces new api for a precise control of cropping and composing
features for video devices. The new ioctls are VIDIOC_S_SELECTION and
VIDIOC_G_SELECTION.
Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/videodev2.h | 46 | ||||
-rw-r--r-- | include/media/v4l2-ioctl.h | 4 |
2 files changed, 50 insertions, 0 deletions
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index b2e1331ca76b..012a29604522 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h | |||
@@ -743,6 +743,48 @@ struct v4l2_crop { | |||
743 | struct v4l2_rect c; | 743 | struct v4l2_rect c; |
744 | }; | 744 | }; |
745 | 745 | ||
746 | /* Hints for adjustments of selection rectangle */ | ||
747 | #define V4L2_SEL_FLAG_GE 0x00000001 | ||
748 | #define V4L2_SEL_FLAG_LE 0x00000002 | ||
749 | |||
750 | /* Selection targets */ | ||
751 | |||
752 | /* current cropping area */ | ||
753 | #define V4L2_SEL_TGT_CROP_ACTIVE 0 | ||
754 | /* default cropping area */ | ||
755 | #define V4L2_SEL_TGT_CROP_DEFAULT 1 | ||
756 | /* cropping bounds */ | ||
757 | #define V4L2_SEL_TGT_CROP_BOUNDS 2 | ||
758 | /* current composing area */ | ||
759 | #define V4L2_SEL_TGT_COMPOSE_ACTIVE 256 | ||
760 | /* default composing area */ | ||
761 | #define V4L2_SEL_TGT_COMPOSE_DEFAULT 257 | ||
762 | /* composing bounds */ | ||
763 | #define V4L2_SEL_TGT_COMPOSE_BOUNDS 258 | ||
764 | /* current composing area plus all padding pixels */ | ||
765 | #define V4L2_SEL_TGT_COMPOSE_PADDED 259 | ||
766 | |||
767 | /** | ||
768 | * struct v4l2_selection - selection info | ||
769 | * @type: buffer type (do not use *_MPLANE types) | ||
770 | * @target: selection target, used to choose one of possible rectangles | ||
771 | * @flags: constraints flags | ||
772 | * @r: coordinates of selection window | ||
773 | * @reserved: for future use, rounds structure size to 64 bytes, set to zero | ||
774 | * | ||
775 | * Hardware may use multiple helper window to process a video stream. | ||
776 | * The structure is used to exchange this selection areas between | ||
777 | * an application and a driver. | ||
778 | */ | ||
779 | struct v4l2_selection { | ||
780 | __u32 type; | ||
781 | __u32 target; | ||
782 | __u32 flags; | ||
783 | struct v4l2_rect r; | ||
784 | __u32 reserved[9]; | ||
785 | }; | ||
786 | |||
787 | |||
746 | /* | 788 | /* |
747 | * A N A L O G V I D E O S T A N D A R D | 789 | * A N A L O G V I D E O S T A N D A R D |
748 | */ | 790 | */ |
@@ -2259,6 +2301,10 @@ struct v4l2_create_buffers { | |||
2259 | #define VIDIOC_CREATE_BUFS _IOWR('V', 92, struct v4l2_create_buffers) | 2301 | #define VIDIOC_CREATE_BUFS _IOWR('V', 92, struct v4l2_create_buffers) |
2260 | #define VIDIOC_PREPARE_BUF _IOWR('V', 93, struct v4l2_buffer) | 2302 | #define VIDIOC_PREPARE_BUF _IOWR('V', 93, struct v4l2_buffer) |
2261 | 2303 | ||
2304 | /* Experimental selection API */ | ||
2305 | #define VIDIOC_G_SELECTION _IOWR('V', 94, struct v4l2_selection) | ||
2306 | #define VIDIOC_S_SELECTION _IOWR('V', 95, struct v4l2_selection) | ||
2307 | |||
2262 | /* Reminder: when adding new ioctls please add support for them to | 2308 | /* Reminder: when adding new ioctls please add support for them to |
2263 | drivers/media/video/v4l2-compat-ioctl32.c as well! */ | 2309 | drivers/media/video/v4l2-compat-ioctl32.c as well! */ |
2264 | 2310 | ||
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h index 4d1c74ad4c84..3f5d60fc5df6 100644 --- a/include/media/v4l2-ioctl.h +++ b/include/media/v4l2-ioctl.h | |||
@@ -196,6 +196,10 @@ struct v4l2_ioctl_ops { | |||
196 | struct v4l2_crop *a); | 196 | struct v4l2_crop *a); |
197 | int (*vidioc_s_crop) (struct file *file, void *fh, | 197 | int (*vidioc_s_crop) (struct file *file, void *fh, |
198 | struct v4l2_crop *a); | 198 | struct v4l2_crop *a); |
199 | int (*vidioc_g_selection) (struct file *file, void *fh, | ||
200 | struct v4l2_selection *s); | ||
201 | int (*vidioc_s_selection) (struct file *file, void *fh, | ||
202 | struct v4l2_selection *s); | ||
199 | /* Compression ioctls */ | 203 | /* Compression ioctls */ |
200 | int (*vidioc_g_jpegcomp) (struct file *file, void *fh, | 204 | int (*vidioc_g_jpegcomp) (struct file *file, void *fh, |
201 | struct v4l2_jpegcompression *a); | 205 | struct v4l2_jpegcompression *a); |