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 /drivers/media | |
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 'drivers/media')
-rw-r--r-- | drivers/media/video/v4l2-compat-ioctl32.c | 2 | ||||
-rw-r--r-- | drivers/media/video/v4l2-ioctl.c | 34 |
2 files changed, 36 insertions, 0 deletions
diff --git a/drivers/media/video/v4l2-compat-ioctl32.c b/drivers/media/video/v4l2-compat-ioctl32.c index c68531b88279..af4419e6c658 100644 --- a/drivers/media/video/v4l2-compat-ioctl32.c +++ b/drivers/media/video/v4l2-compat-ioctl32.c | |||
@@ -985,6 +985,8 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg) | |||
985 | case VIDIOC_CROPCAP: | 985 | case VIDIOC_CROPCAP: |
986 | case VIDIOC_G_CROP: | 986 | case VIDIOC_G_CROP: |
987 | case VIDIOC_S_CROP: | 987 | case VIDIOC_S_CROP: |
988 | case VIDIOC_G_SELECTION: | ||
989 | case VIDIOC_S_SELECTION: | ||
988 | case VIDIOC_G_JPEGCOMP: | 990 | case VIDIOC_G_JPEGCOMP: |
989 | case VIDIOC_S_JPEGCOMP: | 991 | case VIDIOC_S_JPEGCOMP: |
990 | case VIDIOC_QUERYSTD: | 992 | case VIDIOC_QUERYSTD: |
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index 639abeee3392..072cfc1a166f 100644 --- a/drivers/media/video/v4l2-ioctl.c +++ b/drivers/media/video/v4l2-ioctl.c | |||
@@ -238,6 +238,8 @@ static const char *v4l2_ioctls[] = { | |||
238 | [_IOC_NR(VIDIOC_CROPCAP)] = "VIDIOC_CROPCAP", | 238 | [_IOC_NR(VIDIOC_CROPCAP)] = "VIDIOC_CROPCAP", |
239 | [_IOC_NR(VIDIOC_G_CROP)] = "VIDIOC_G_CROP", | 239 | [_IOC_NR(VIDIOC_G_CROP)] = "VIDIOC_G_CROP", |
240 | [_IOC_NR(VIDIOC_S_CROP)] = "VIDIOC_S_CROP", | 240 | [_IOC_NR(VIDIOC_S_CROP)] = "VIDIOC_S_CROP", |
241 | [_IOC_NR(VIDIOC_G_SELECTION)] = "VIDIOC_G_SELECTION", | ||
242 | [_IOC_NR(VIDIOC_S_SELECTION)] = "VIDIOC_S_SELECTION", | ||
241 | [_IOC_NR(VIDIOC_G_JPEGCOMP)] = "VIDIOC_G_JPEGCOMP", | 243 | [_IOC_NR(VIDIOC_G_JPEGCOMP)] = "VIDIOC_G_JPEGCOMP", |
242 | [_IOC_NR(VIDIOC_S_JPEGCOMP)] = "VIDIOC_S_JPEGCOMP", | 244 | [_IOC_NR(VIDIOC_S_JPEGCOMP)] = "VIDIOC_S_JPEGCOMP", |
243 | [_IOC_NR(VIDIOC_QUERYSTD)] = "VIDIOC_QUERYSTD", | 245 | [_IOC_NR(VIDIOC_QUERYSTD)] = "VIDIOC_QUERYSTD", |
@@ -1571,6 +1573,38 @@ static long __video_do_ioctl(struct file *file, | |||
1571 | ret = ops->vidioc_s_crop(file, fh, p); | 1573 | ret = ops->vidioc_s_crop(file, fh, p); |
1572 | break; | 1574 | break; |
1573 | } | 1575 | } |
1576 | case VIDIOC_G_SELECTION: | ||
1577 | { | ||
1578 | struct v4l2_selection *p = arg; | ||
1579 | |||
1580 | if (!ops->vidioc_g_selection) | ||
1581 | break; | ||
1582 | |||
1583 | dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names)); | ||
1584 | |||
1585 | ret = ops->vidioc_g_selection(file, fh, p); | ||
1586 | if (!ret) | ||
1587 | dbgrect(vfd, "", &p->r); | ||
1588 | break; | ||
1589 | } | ||
1590 | case VIDIOC_S_SELECTION: | ||
1591 | { | ||
1592 | struct v4l2_selection *p = arg; | ||
1593 | |||
1594 | if (!ops->vidioc_s_selection) | ||
1595 | break; | ||
1596 | |||
1597 | if (ret_prio) { | ||
1598 | ret = ret_prio; | ||
1599 | break; | ||
1600 | } | ||
1601 | |||
1602 | dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names)); | ||
1603 | dbgrect(vfd, "", &p->r); | ||
1604 | |||
1605 | ret = ops->vidioc_s_selection(file, fh, p); | ||
1606 | break; | ||
1607 | } | ||
1574 | case VIDIOC_CROPCAP: | 1608 | case VIDIOC_CROPCAP: |
1575 | { | 1609 | { |
1576 | struct v4l2_cropcap *p = arg; | 1610 | struct v4l2_cropcap *p = arg; |