|
@@ -1659,8 +1659,6 @@ static int saa7134_cropcap(struct file *file, void *priv,
|
|
if (cap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE &&
|
|
if (cap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE &&
|
|
cap->type != V4L2_BUF_TYPE_VIDEO_OVERLAY)
|
|
cap->type != V4L2_BUF_TYPE_VIDEO_OVERLAY)
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
- cap->bounds = dev->crop_bounds;
|
|
|
|
- cap->defrect = dev->crop_defrect;
|
|
|
|
cap->pixelaspect.numerator = 1;
|
|
cap->pixelaspect.numerator = 1;
|
|
cap->pixelaspect.denominator = 1;
|
|
cap->pixelaspect.denominator = 1;
|
|
if (dev->tvnorm->id & V4L2_STD_525_60) {
|
|
if (dev->tvnorm->id & V4L2_STD_525_60) {
|
|
@@ -1674,25 +1672,41 @@ static int saa7134_cropcap(struct file *file, void *priv,
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-static int saa7134_g_crop(struct file *file, void *f, struct v4l2_crop *crop)
|
|
|
|
|
|
+static int saa7134_g_selection(struct file *file, void *f, struct v4l2_selection *sel)
|
|
{
|
|
{
|
|
struct saa7134_dev *dev = video_drvdata(file);
|
|
struct saa7134_dev *dev = video_drvdata(file);
|
|
|
|
|
|
- if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE &&
|
|
|
|
- crop->type != V4L2_BUF_TYPE_VIDEO_OVERLAY)
|
|
|
|
|
|
+ if (sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE &&
|
|
|
|
+ sel->type != V4L2_BUF_TYPE_VIDEO_OVERLAY)
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
- crop->c = dev->crop_current;
|
|
|
|
|
|
+
|
|
|
|
+ switch (sel->target) {
|
|
|
|
+ case V4L2_SEL_TGT_CROP:
|
|
|
|
+ sel->r = dev->crop_current;
|
|
|
|
+ break;
|
|
|
|
+ case V4L2_SEL_TGT_CROP_DEFAULT:
|
|
|
|
+ sel->r = dev->crop_defrect;
|
|
|
|
+ break;
|
|
|
|
+ case V4L2_SEL_TGT_CROP_BOUNDS:
|
|
|
|
+ sel->r = dev->crop_bounds;
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ return -EINVAL;
|
|
|
|
+ }
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-static int saa7134_s_crop(struct file *file, void *f, const struct v4l2_crop *crop)
|
|
|
|
|
|
+static int saa7134_s_selection(struct file *file, void *f, struct v4l2_selection *sel)
|
|
{
|
|
{
|
|
struct saa7134_dev *dev = video_drvdata(file);
|
|
struct saa7134_dev *dev = video_drvdata(file);
|
|
struct v4l2_rect *b = &dev->crop_bounds;
|
|
struct v4l2_rect *b = &dev->crop_bounds;
|
|
struct v4l2_rect *c = &dev->crop_current;
|
|
struct v4l2_rect *c = &dev->crop_current;
|
|
|
|
|
|
- if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE &&
|
|
|
|
- crop->type != V4L2_BUF_TYPE_VIDEO_OVERLAY)
|
|
|
|
|
|
+ if (sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE &&
|
|
|
|
+ sel->type != V4L2_BUF_TYPE_VIDEO_OVERLAY)
|
|
|
|
+ return -EINVAL;
|
|
|
|
+
|
|
|
|
+ if (sel->target != V4L2_SEL_TGT_CROP)
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
|
|
|
|
if (dev->overlay_owner)
|
|
if (dev->overlay_owner)
|
|
@@ -1700,7 +1714,7 @@ static int saa7134_s_crop(struct file *file, void *f, const struct v4l2_crop *cr
|
|
if (vb2_is_streaming(&dev->video_vbq))
|
|
if (vb2_is_streaming(&dev->video_vbq))
|
|
return -EBUSY;
|
|
return -EBUSY;
|
|
|
|
|
|
- *c = crop->c;
|
|
|
|
|
|
+ *c = sel->r;
|
|
if (c->top < b->top)
|
|
if (c->top < b->top)
|
|
c->top = b->top;
|
|
c->top = b->top;
|
|
if (c->top > b->top + b->height)
|
|
if (c->top > b->top + b->height)
|
|
@@ -1714,6 +1728,7 @@ static int saa7134_s_crop(struct file *file, void *f, const struct v4l2_crop *cr
|
|
c->left = b->left + b->width;
|
|
c->left = b->left + b->width;
|
|
if (c->width > b->left - c->left + b->width)
|
|
if (c->width > b->left - c->left + b->width)
|
|
c->width = b->left - c->left + b->width;
|
|
c->width = b->left - c->left + b->width;
|
|
|
|
+ sel->r = *c;
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1989,8 +2004,8 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
|
|
.vidioc_streamoff = vb2_ioctl_streamoff,
|
|
.vidioc_streamoff = vb2_ioctl_streamoff,
|
|
.vidioc_g_tuner = saa7134_g_tuner,
|
|
.vidioc_g_tuner = saa7134_g_tuner,
|
|
.vidioc_s_tuner = saa7134_s_tuner,
|
|
.vidioc_s_tuner = saa7134_s_tuner,
|
|
- .vidioc_g_crop = saa7134_g_crop,
|
|
|
|
- .vidioc_s_crop = saa7134_s_crop,
|
|
|
|
|
|
+ .vidioc_g_selection = saa7134_g_selection,
|
|
|
|
+ .vidioc_s_selection = saa7134_s_selection,
|
|
.vidioc_g_fbuf = saa7134_g_fbuf,
|
|
.vidioc_g_fbuf = saa7134_g_fbuf,
|
|
.vidioc_s_fbuf = saa7134_s_fbuf,
|
|
.vidioc_s_fbuf = saa7134_s_fbuf,
|
|
.vidioc_overlay = saa7134_overlay,
|
|
.vidioc_overlay = saa7134_overlay,
|