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 <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
This commit is contained in:
parent
1f137600ca
commit
987e00ba5c
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user