aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/ivtv/ivtv-ioctl.c41
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 1989ec1cb973..273d1154da17 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,
532 itv->yuv_info.yuv_forced_update = 1; 532 itv->yuv_info.yuv_forced_update = 1;
533 return 0; 533 return 0;
534 } 534 }
535 if (!ivtv_vapi(itv, CX2341X_OSD_SET_FRAMEBUFFER_WINDOW, 4,
536 r.width, r.height, r.left, r.top))
537 itv->main_rect = r;
538 else
539 return -EINVAL;
540 } 535 }
541 return 0; 536 return 0;
542 } 537 }
@@ -799,9 +794,39 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
799 return ivtv_get_fmt(itv, id->type, fmt); 794 return ivtv_get_fmt(itv, id->type, fmt);
800 } 795 }
801 796
797 case VIDIOC_CROPCAP: {
798 struct v4l2_cropcap *cropcap = arg;
799
800 if (cropcap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE &&
801 cropcap->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
802 return -EINVAL;
803 cropcap->bounds.top = cropcap->bounds.left = 0;
804 cropcap->bounds.width = 720;
805 if (cropcap->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
806 cropcap->bounds.height = itv->is_50hz ? 576 : 480;
807 cropcap->pixelaspect.numerator = itv->is_50hz ? 59 : 10;
808 cropcap->pixelaspect.denominator = itv->is_50hz ? 54 : 11;
809 } else {
810 cropcap->bounds.height = itv->is_out_50hz ? 576 : 480;
811 cropcap->pixelaspect.numerator = itv->is_out_50hz ? 59 : 10;
812 cropcap->pixelaspect.denominator = itv->is_out_50hz ? 54 : 11;
813 }
814 cropcap->defrect = cropcap->bounds;
815 return 0;
816 }
817
802 case VIDIOC_S_CROP: { 818 case VIDIOC_S_CROP: {
803 struct v4l2_crop *crop = arg; 819 struct v4l2_crop *crop = arg;
804 820
821 if (crop->type == V4L2_BUF_TYPE_VIDEO_OUTPUT &&
822 (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) {
823 if (!ivtv_vapi(itv, CX2341X_OSD_SET_FRAMEBUFFER_WINDOW, 4,
824 crop->c.width, crop->c.height, crop->c.left, crop->c.top)) {
825 itv->main_rect = crop->c;
826 return 0;
827 }
828 return -EINVAL;
829 }
805 if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 830 if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
806 return -EINVAL; 831 return -EINVAL;
807 return itv->video_dec_func(itv, VIDIOC_S_CROP, arg); 832 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
810 case VIDIOC_G_CROP: { 835 case VIDIOC_G_CROP: {
811 struct v4l2_crop *crop = arg; 836 struct v4l2_crop *crop = arg;
812 837
838 if (crop->type == V4L2_BUF_TYPE_VIDEO_OUTPUT &&
839 (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) {
840 crop->c = itv->main_rect;
841 return 0;
842 }
813 if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 843 if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
814 return -EINVAL; 844 return -EINVAL;
815 return itv->video_dec_func(itv, VIDIOC_G_CROP, arg); 845 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,
1455 case VIDIOC_S_FMT: 1485 case VIDIOC_S_FMT:
1456 case VIDIOC_TRY_FMT: 1486 case VIDIOC_TRY_FMT:
1457 case VIDIOC_ENUM_FMT: 1487 case VIDIOC_ENUM_FMT:
1488 case VIDIOC_CROPCAP:
1458 case VIDIOC_G_CROP: 1489 case VIDIOC_G_CROP:
1459 case VIDIOC_S_CROP: 1490 case VIDIOC_S_CROP:
1460 case VIDIOC_G_FREQUENCY: 1491 case VIDIOC_G_FREQUENCY: