Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 306128
b: refs/heads/master
c: 5b9d770
h: refs/heads/master
v: v3
  • Loading branch information
Sakari Ailus authored and Mauro Carvalho Chehab committed Apr 10, 2012
1 parent f55fb22 commit 9affbfe
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5e6ff7c17bf468b8bc012e49174771e5f718e72c
refs/heads/master: 5b9d770fa3f5cf210b31137404ae702a33e00473
37 changes: 35 additions & 2 deletions trunk/drivers/media/video/v4l2-subdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)

case VIDIOC_SUBDEV_G_CROP: {
struct v4l2_subdev_crop *crop = arg;
struct v4l2_subdev_selection sel;
int rval;

if (crop->which != V4L2_SUBDEV_FORMAT_TRY &&
crop->which != V4L2_SUBDEV_FORMAT_ACTIVE)
Expand All @@ -236,11 +238,27 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
if (crop->pad >= sd->entity.num_pads)
return -EINVAL;

return v4l2_subdev_call(sd, pad, get_crop, subdev_fh, crop);
rval = v4l2_subdev_call(sd, pad, get_crop, subdev_fh, crop);
if (rval != -ENOIOCTLCMD)
return rval;

memset(&sel, 0, sizeof(sel));
sel.which = crop->which;
sel.pad = crop->pad;
sel.target = V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL;

rval = v4l2_subdev_call(
sd, pad, get_selection, subdev_fh, &sel);

crop->rect = sel.r;

return rval;
}

case VIDIOC_SUBDEV_S_CROP: {
struct v4l2_subdev_crop *crop = arg;
struct v4l2_subdev_selection sel;
int rval;

if (crop->which != V4L2_SUBDEV_FORMAT_TRY &&
crop->which != V4L2_SUBDEV_FORMAT_ACTIVE)
Expand All @@ -249,7 +267,22 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
if (crop->pad >= sd->entity.num_pads)
return -EINVAL;

return v4l2_subdev_call(sd, pad, set_crop, subdev_fh, crop);
rval = v4l2_subdev_call(sd, pad, set_crop, subdev_fh, crop);
if (rval != -ENOIOCTLCMD)
return rval;

memset(&sel, 0, sizeof(sel));
sel.which = crop->which;
sel.pad = crop->pad;
sel.target = V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL;
sel.r = crop->rect;

rval = v4l2_subdev_call(
sd, pad, set_selection, subdev_fh, &sel);

crop->rect = sel.r;

return rval;
}

case VIDIOC_SUBDEV_ENUM_MBUS_CODE: {
Expand Down

0 comments on commit 9affbfe

Please sign in to comment.