Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=987e00ba5cf667beed2b88bd1d01150334cdb6dc
Commit:     987e00ba5cf667beed2b88bd1d01150334cdb6dc
Parent:     1f137600cacf9a2908529c7d544de82672226a98
Author:     Hans Verkuil <[EMAIL PROTECTED]>
AuthorDate: Tue May 29 13:03:27 2007 -0300
Committer:  Mauro Carvalho Chehab <[EMAIL PROTECTED]>
CommitDate: Fri Jun 8 08:21:15 2007 -0300

    V4L/DVB (5732): Add ivtv CROPCAP support and fix ivtv S_CROP for video 
output.
    
    The VIDIOC_CROPCAP ioctl was missing in ivtv.
    The handling of output video cropping was wrong. This has now been fixed.
    
    Signed-off-by: Hans Verkuil <[EMAIL PROTECTED]>
    Signed-off-by: Mauro Carvalho Chehab <[EMAIL PROTECTED]>
---
 drivers/media/video/ivtv/ivtv-ioctl.c |   41 +++++++++++++++++++++++++++++----
 1 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c 
b/drivers/media/video/ivtv/ivtv-ioctl.c
index 1989ec1..273d115 100644
--- a/drivers/media/video/ivtv/ivtv-ioctl.c
+++ b/drivers/media/video/ivtv/ivtv-ioctl.c
@@ -532,11 +532,6 @@ static int ivtv_try_or_set_fmt(struct ivtv *itv, int 
streamtype,
                                itv->yuv_info.yuv_forced_update = 1;
                                return 0;
                        }
-                       if (!ivtv_vapi(itv, CX2341X_OSD_SET_FRAMEBUFFER_WINDOW, 
4,
-                                r.width, r.height, r.left, r.top))
-                               itv->main_rect = r;
-                       else
-                               return -EINVAL;
                }
                return 0;
        }
@@ -799,9 +794,39 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, 
unsigned int cmd, void
                return ivtv_get_fmt(itv, id->type, fmt);
        }
 
+       case VIDIOC_CROPCAP: {
+               struct v4l2_cropcap *cropcap = arg;
+
+               if (cropcap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE &&
+                   cropcap->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
+                       return -EINVAL;
+               cropcap->bounds.top = cropcap->bounds.left = 0;
+               cropcap->bounds.width = 720;
+               if (cropcap->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
+                       cropcap->bounds.height = itv->is_50hz ? 576 : 480;
+                       cropcap->pixelaspect.numerator = itv->is_50hz ? 59 : 10;
+                       cropcap->pixelaspect.denominator = itv->is_50hz ? 54 : 
11;
+               } else {
+                       cropcap->bounds.height = itv->is_out_50hz ? 576 : 480;
+                       cropcap->pixelaspect.numerator = itv->is_out_50hz ? 59 
: 10;
+                       cropcap->pixelaspect.denominator = itv->is_out_50hz ? 
54 : 11;
+               }
+               cropcap->defrect = cropcap->bounds;
+               return 0;
+       }
+
        case VIDIOC_S_CROP: {
                struct v4l2_crop *crop = arg;
 
+               if (crop->type == V4L2_BUF_TYPE_VIDEO_OUTPUT &&
+                   (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) {
+                       if (!ivtv_vapi(itv, CX2341X_OSD_SET_FRAMEBUFFER_WINDOW, 
4,
+                                crop->c.width, crop->c.height, crop->c.left, 
crop->c.top)) {
+                               itv->main_rect = crop->c;
+                               return 0;
+                       }
+                       return -EINVAL;
+               }
                if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
                        return -EINVAL;
                return itv->video_dec_func(itv, VIDIOC_S_CROP, arg);
@@ -810,6 +835,11 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, 
unsigned int cmd, void
        case VIDIOC_G_CROP: {
                struct v4l2_crop *crop = arg;
 
+               if (crop->type == V4L2_BUF_TYPE_VIDEO_OUTPUT &&
+                   (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) {
+                       crop->c = itv->main_rect;
+                       return 0;
+               }
                if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
                        return -EINVAL;
                return itv->video_dec_func(itv, VIDIOC_G_CROP, arg);
@@ -1455,6 +1485,7 @@ static int ivtv_v4l2_do_ioctl(struct inode *inode, struct 
file *filp,
        case VIDIOC_S_FMT:
        case VIDIOC_TRY_FMT:
        case VIDIOC_ENUM_FMT:
+       case VIDIOC_CROPCAP:
        case VIDIOC_G_CROP:
        case VIDIOC_S_CROP:
        case VIDIOC_G_FREQUENCY:
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to