This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] v4l: Support s_crop and g_crop through s/g_selection
Author:  Sakari Ailus <[email protected]>
Date:    Mon Nov 14 15:30:24 2011 -0300

Fall back to s_selection if s_crop isn't implemented by a driver. Same for
g_selection / g_crop.

Signed-off-by: Sakari Ailus <[email protected]>
Acked-by: Laurent Pinchart <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>

 drivers/media/video/v4l2-subdev.c |   37 +++++++++++++++++++++++++++++++++++--
 1 files changed, 35 insertions(+), 2 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=5b9d770fa3f5cf210b31137404ae702a33e00473

diff --git a/drivers/media/video/v4l2-subdev.c 
b/drivers/media/video/v4l2-subdev.c
index 7d22538..268d805 100644
--- a/drivers/media/video/v4l2-subdev.c
+++ b/drivers/media/video/v4l2-subdev.c
@@ -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)
@@ -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)
@@ -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: {

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to