diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2018-10-04 17:06:32 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2018-11-20 13:37:18 -0500 |
commit | ee10dc36b485920e87eefa325d74fd8804648621 (patch) | |
tree | aff59557bb6ab1dee797943e7248d362bd429541 /drivers/media/usb/cpia2 | |
parent | 98af278b1e0fa6b7e6c762e185e99f0cc5e31cfe (diff) | |
download | linux-ee10dc36b485920e87eefa325d74fd8804648621.tar.gz |
media: cropcap/g_selection split
If g_selection is implemented, then the v4l2-ioctl cropcap code assumes
that cropcap just implements the pixelaspect part and that g_selection
provides the crop bounds and default rectangles.
There are still some drivers that only implement cropcap and not
g_selection. Split up cropcap into a cropcap and g_selection for those
drivers.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/usb/cpia2')
-rw-r--r-- | drivers/media/usb/cpia2/cpia2_v4l.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/drivers/media/usb/cpia2/cpia2_v4l.c b/drivers/media/usb/cpia2/cpia2_v4l.c index 3f401fbd0ecc..748739c2b8b2 100644 --- a/drivers/media/usb/cpia2/cpia2_v4l.c +++ b/drivers/media/usb/cpia2/cpia2_v4l.c @@ -479,24 +479,25 @@ static int cpia2_g_fmt_vid_cap(struct file *file, void *fh, * *****************************************************************************/ -static int cpia2_cropcap(struct file *file, void *fh, struct v4l2_cropcap *c) +static int cpia2_g_selection(struct file *file, void *fh, + struct v4l2_selection *s) { struct camera_data *cam = video_drvdata(file); - if (c->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) - return -EINVAL; - - c->bounds.left = 0; - c->bounds.top = 0; - c->bounds.width = cam->width; - c->bounds.height = cam->height; - c->defrect.left = 0; - c->defrect.top = 0; - c->defrect.width = cam->width; - c->defrect.height = cam->height; - c->pixelaspect.numerator = 1; - c->pixelaspect.denominator = 1; + if (s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + switch (s->target) { + case V4L2_SEL_TGT_CROP_BOUNDS: + case V4L2_SEL_TGT_CROP_DEFAULT: + s->r.left = 0; + s->r.top = 0; + s->r.width = cam->width; + s->r.height = cam->height; + break; + default: + return -EINVAL; + } return 0; } @@ -1047,7 +1048,7 @@ static const struct v4l2_ioctl_ops cpia2_ioctl_ops = { .vidioc_try_fmt_vid_cap = cpia2_try_fmt_vid_cap, .vidioc_g_jpegcomp = cpia2_g_jpegcomp, .vidioc_s_jpegcomp = cpia2_s_jpegcomp, - .vidioc_cropcap = cpia2_cropcap, + .vidioc_g_selection = cpia2_g_selection, .vidioc_reqbufs = cpia2_reqbufs, .vidioc_querybuf = cpia2_querybuf, .vidioc_qbuf = cpia2_qbuf, |