Commit 5200ab6a authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

media: vidioc_cropcap -> vidioc_g_pixelaspect

Now vidioc_cropcap is only used to return the pixelaspect, so
rename it accordingly.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: default avatarNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Tested-by: default avatarNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Acked-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent ed3e2749
......@@ -2792,19 +2792,17 @@ static int bttv_g_tuner(struct file *file, void *priv,
return 0;
}
static int bttv_cropcap(struct file *file, void *priv,
struct v4l2_cropcap *cap)
static int bttv_g_pixelaspect(struct file *file, void *priv,
int type, struct v4l2_fract *f)
{
struct bttv_fh *fh = priv;
struct bttv *btv = fh->btv;
if (cap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE &&
cap->type != V4L2_BUF_TYPE_VIDEO_OVERLAY)
if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL;
/* defrect and bounds are set via g_selection */
cap->pixelaspect = bttv_tvnorms[btv->tvnorm].cropcap.pixelaspect;
*f = bttv_tvnorms[btv->tvnorm].cropcap.pixelaspect;
return 0;
}
......@@ -3162,7 +3160,7 @@ static const struct v4l2_ioctl_ops bttv_ioctl_ops = {
.vidioc_g_fmt_vbi_cap = bttv_g_fmt_vbi_cap,
.vidioc_try_fmt_vbi_cap = bttv_try_fmt_vbi_cap,
.vidioc_s_fmt_vbi_cap = bttv_s_fmt_vbi_cap,
.vidioc_cropcap = bttv_cropcap,
.vidioc_g_pixelaspect = bttv_g_pixelaspect,
.vidioc_reqbufs = bttv_reqbufs,
.vidioc_querybuf = bttv_querybuf,
.vidioc_qbuf = bttv_qbuf,
......
......@@ -1077,20 +1077,22 @@ static int cobalt_g_parm(struct file *file, void *fh, struct v4l2_streamparm *a)
return 0;
}
static int cobalt_cropcap(struct file *file, void *fh, struct v4l2_cropcap *cc)
static int cobalt_g_pixelaspect(struct file *file, void *fh,
int type, struct v4l2_fract *f)
{
struct cobalt_stream *s = video_drvdata(file);
struct v4l2_dv_timings timings;
int err = 0;
if (cc->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL;
if (s->input == 1)
timings = cea1080p60;
else
err = v4l2_subdev_call(s->sd, video, g_dv_timings, &timings);
if (!err)
cc->pixelaspect = v4l2_dv_timings_aspect_ratio(&timings);
*f = v4l2_dv_timings_aspect_ratio(&timings);
return err;
}
......@@ -1132,7 +1134,7 @@ static const struct v4l2_ioctl_ops cobalt_ioctl_ops = {
.vidioc_log_status = cobalt_log_status,
.vidioc_streamon = vb2_ioctl_streamon,
.vidioc_streamoff = vb2_ioctl_streamoff,
.vidioc_cropcap = cobalt_cropcap,
.vidioc_g_pixelaspect = cobalt_g_pixelaspect,
.vidioc_g_selection = cobalt_g_selection,
.vidioc_enum_input = cobalt_enum_input,
.vidioc_g_input = cobalt_g_input,
......
......@@ -441,15 +441,16 @@ static int cx18_enum_input(struct file *file, void *fh, struct v4l2_input *vin)
return cx18_get_input(cx, vin->index, vin);
}
static int cx18_cropcap(struct file *file, void *fh,
struct v4l2_cropcap *cropcap)
static int cx18_g_pixelaspect(struct file *file, void *fh,
int type, struct v4l2_fract *f)
{
struct cx18 *cx = fh2id(fh)->cx;
if (cropcap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL;
cropcap->pixelaspect.numerator = cx->is_50hz ? 54 : 11;
cropcap->pixelaspect.denominator = cx->is_50hz ? 59 : 10;
f->numerator = cx->is_50hz ? 54 : 11;
f->denominator = cx->is_50hz ? 59 : 10;
return 0;
}
......@@ -1079,7 +1080,7 @@ static const struct v4l2_ioctl_ops cx18_ioctl_ops = {
.vidioc_g_audio = cx18_g_audio,
.vidioc_enumaudio = cx18_enumaudio,
.vidioc_enum_input = cx18_enum_input,
.vidioc_cropcap = cx18_cropcap,
.vidioc_g_pixelaspect = cx18_g_pixelaspect,
.vidioc_g_selection = cx18_g_selection,
.vidioc_g_input = cx18_g_input,
.vidioc_s_input = cx18_s_input,
......
......@@ -668,17 +668,17 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
return 0;
}
static int vidioc_cropcap(struct file *file, void *priv,
struct v4l2_cropcap *cc)
static int vidioc_g_pixelaspect(struct file *file, void *priv,
int type, struct v4l2_fract *f)
{
struct cx23885_dev *dev = video_drvdata(file);
bool is_50hz = dev->tvnorm & V4L2_STD_625_50;
if (cc->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL;
cc->pixelaspect.numerator = is_50hz ? 54 : 11;
cc->pixelaspect.denominator = is_50hz ? 59 : 10;
f->numerator = is_50hz ? 54 : 11;
f->denominator = is_50hz ? 59 : 10;
return 0;
}
......@@ -1139,7 +1139,7 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
.vidioc_dqbuf = vb2_ioctl_dqbuf,
.vidioc_streamon = vb2_ioctl_streamon,
.vidioc_streamoff = vb2_ioctl_streamoff,
.vidioc_cropcap = vidioc_cropcap,
.vidioc_g_pixelaspect = vidioc_g_pixelaspect,
.vidioc_g_selection = vidioc_g_selection,
.vidioc_s_std = vidioc_s_std,
.vidioc_g_std = vidioc_g_std,
......
......@@ -829,17 +829,18 @@ static int ivtv_enum_output(struct file *file, void *fh, struct v4l2_output *vou
return ivtv_get_output(itv, vout->index, vout);
}
static int ivtv_cropcap(struct file *file, void *fh, struct v4l2_cropcap *cropcap)
static int ivtv_g_pixelaspect(struct file *file, void *fh,
int type, struct v4l2_fract *f)
{
struct ivtv_open_id *id = fh2id(fh);
struct ivtv *itv = id->itv;
if (cropcap->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
cropcap->pixelaspect.numerator = itv->is_50hz ? 54 : 11;
cropcap->pixelaspect.denominator = itv->is_50hz ? 59 : 10;
} else if (cropcap->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) {
cropcap->pixelaspect.numerator = itv->is_out_50hz ? 54 : 11;
cropcap->pixelaspect.denominator = itv->is_out_50hz ? 59 : 10;
if (type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
f->numerator = itv->is_50hz ? 54 : 11;
f->denominator = itv->is_50hz ? 59 : 10;
} else if (type == V4L2_BUF_TYPE_VIDEO_OUTPUT) {
f->numerator = itv->is_out_50hz ? 54 : 11;
f->denominator = itv->is_out_50hz ? 59 : 10;
} else {
return -EINVAL;
}
......@@ -1923,7 +1924,7 @@ static const struct v4l2_ioctl_ops ivtv_ioctl_ops = {
.vidioc_enum_input = ivtv_enum_input,
.vidioc_enum_output = ivtv_enum_output,
.vidioc_enumaudout = ivtv_enumaudout,
.vidioc_cropcap = ivtv_cropcap,
.vidioc_g_pixelaspect = ivtv_g_pixelaspect,
.vidioc_s_selection = ivtv_s_selection,
.vidioc_g_selection = ivtv_g_selection,
.vidioc_g_input = ivtv_g_input,
......
......@@ -1650,23 +1650,22 @@ int saa7134_querystd(struct file *file, void *priv, v4l2_std_id *std)
}
EXPORT_SYMBOL_GPL(saa7134_querystd);
static int saa7134_cropcap(struct file *file, void *priv,
struct v4l2_cropcap *cap)
static int saa7134_g_pixelaspect(struct file *file, void *priv,
int type, struct v4l2_fract *f)
{
struct saa7134_dev *dev = video_drvdata(file);
if (cap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE &&
cap->type != V4L2_BUF_TYPE_VIDEO_OVERLAY)
if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE &&
type != V4L2_BUF_TYPE_VIDEO_OVERLAY)
return -EINVAL;
cap->pixelaspect.numerator = 1;
cap->pixelaspect.denominator = 1;
if (dev->tvnorm->id & V4L2_STD_525_60) {
cap->pixelaspect.numerator = 11;
cap->pixelaspect.denominator = 10;
f->numerator = 11;
f->denominator = 10;
}
if (dev->tvnorm->id & V4L2_STD_625_50) {
cap->pixelaspect.numerator = 54;
cap->pixelaspect.denominator = 59;
f->numerator = 54;
f->denominator = 59;
}
return 0;
}
......@@ -1987,7 +1986,7 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
.vidioc_g_fmt_vbi_cap = saa7134_try_get_set_fmt_vbi_cap,
.vidioc_try_fmt_vbi_cap = saa7134_try_get_set_fmt_vbi_cap,
.vidioc_s_fmt_vbi_cap = saa7134_try_get_set_fmt_vbi_cap,
.vidioc_cropcap = saa7134_cropcap,
.vidioc_g_pixelaspect = saa7134_g_pixelaspect,
.vidioc_reqbufs = vb2_ioctl_reqbufs,
.vidioc_querybuf = vb2_ioctl_querybuf,
.vidioc_qbuf = vb2_ioctl_qbuf,
......
......@@ -2081,17 +2081,18 @@ static void vpfe_stop_streaming(struct vb2_queue *vq)
spin_unlock_irqrestore(&vpfe->dma_queue_lock, flags);
}
static int vpfe_cropcap(struct file *file, void *priv,
struct v4l2_cropcap *crop)
static int vpfe_g_pixelaspect(struct file *file, void *priv,
int type, struct v4l2_fract *f)
{
struct vpfe_device *vpfe = video_drvdata(file);
vpfe_dbg(2, vpfe, "vpfe_cropcap\n");
vpfe_dbg(2, vpfe, "vpfe_g_pixelaspect\n");
if (vpfe->std_index >= ARRAY_SIZE(vpfe_standards))
if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE ||
vpfe->std_index >= ARRAY_SIZE(vpfe_standards))
return -EINVAL;
crop->pixelaspect = vpfe_standards[vpfe->std_index].pixelaspect;
*f = vpfe_standards[vpfe->std_index].pixelaspect;
return 0;
}
......@@ -2280,7 +2281,7 @@ static const struct v4l2_ioctl_ops vpfe_ioctl_ops = {
.vidioc_subscribe_event = v4l2_ctrl_subscribe_event,
.vidioc_unsubscribe_event = v4l2_event_unsubscribe,
.vidioc_cropcap = vpfe_cropcap,
.vidioc_g_pixelaspect = vpfe_g_pixelaspect,
.vidioc_g_selection = vpfe_g_selection,
.vidioc_s_selection = vpfe_s_selection,
......
......@@ -759,18 +759,18 @@ static int vpbe_display_g_selection(struct file *file, void *priv,
return 0;
}
static int vpbe_display_cropcap(struct file *file, void *priv,
struct v4l2_cropcap *cropcap)
static int vpbe_display_g_pixelaspect(struct file *file, void *priv,
int type, struct v4l2_fract *f)
{
struct vpbe_layer *layer = video_drvdata(file);
struct vpbe_device *vpbe_dev = layer->disp_dev->vpbe_dev;
v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_CROPCAP ioctl\n");
if (cropcap->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
if (type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
return -EINVAL;
cropcap->pixelaspect = vpbe_dev->current_timings.aspect;
*f = vpbe_dev->current_timings.aspect;
return 0;
}
......@@ -1263,7 +1263,7 @@ static const struct v4l2_ioctl_ops vpbe_ioctl_ops = {
.vidioc_streamoff = vb2_ioctl_streamoff,
.vidioc_expbuf = vb2_ioctl_expbuf,
.vidioc_cropcap = vpbe_display_cropcap,
.vidioc_g_pixelaspect = vpbe_display_g_pixelaspect,
.vidioc_g_selection = vpbe_display_g_selection,
.vidioc_s_selection = vpbe_display_s_selection,
......
......@@ -1558,20 +1558,20 @@ static int vpfe_streamoff(struct file *file, void *priv,
return ret;
}
static int vpfe_cropcap(struct file *file, void *priv,
struct v4l2_cropcap *crop)
static int vpfe_g_pixelaspect(struct file *file, void *priv,
int type, struct v4l2_fract *f)
{
struct vpfe_device *vpfe_dev = video_drvdata(file);
v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_cropcap\n");
v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_g_pixelaspect\n");
if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL;
/* If std_index is invalid, then just return (== 1:1 aspect) */
if (vpfe_dev->std_index >= ARRAY_SIZE(vpfe_standards))
return 0;
crop->pixelaspect = vpfe_standards[vpfe_dev->std_index].pixelaspect;
*f = vpfe_standards[vpfe_dev->std_index].pixelaspect;
return 0;
}
......@@ -1677,7 +1677,7 @@ static const struct v4l2_ioctl_ops vpfe_ioctl_ops = {
.vidioc_dqbuf = vpfe_dqbuf,
.vidioc_streamon = vpfe_streamon,
.vidioc_streamoff = vpfe_streamoff,
.vidioc_cropcap = vpfe_cropcap,
.vidioc_g_pixelaspect = vpfe_g_pixelaspect,
.vidioc_g_selection = vpfe_g_selection,
.vidioc_s_selection = vpfe_s_selection,
};
......
......@@ -404,16 +404,16 @@ static int rvin_s_selection(struct file *file, void *fh,
return 0;
}
static int rvin_cropcap(struct file *file, void *priv,
struct v4l2_cropcap *crop)
static int rvin_g_pixelaspect(struct file *file, void *priv,
int type, struct v4l2_fract *f)
{
struct rvin_dev *vin = video_drvdata(file);
struct v4l2_subdev *sd = vin_to_source(vin);
if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL;
return v4l2_subdev_call(sd, video, g_pixelaspect, &crop->pixelaspect);
return v4l2_subdev_call(sd, video, g_pixelaspect, f);
}
static int rvin_enum_input(struct file *file, void *priv,
......@@ -620,7 +620,7 @@ static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
.vidioc_g_selection = rvin_g_selection,
.vidioc_s_selection = rvin_s_selection,
.vidioc_cropcap = rvin_cropcap,
.vidioc_g_pixelaspect = rvin_g_pixelaspect,
.vidioc_enum_input = rvin_enum_input,
.vidioc_g_input = rvin_g_input,
......
......@@ -324,13 +324,14 @@ static int vidioc_s_dv_timings(struct file *file, void *fh, struct v4l2_dv_timin
return vivid_vid_out_s_dv_timings(file, fh, timings);
}
static int vidioc_cropcap(struct file *file, void *fh, struct v4l2_cropcap *cc)
static int vidioc_g_pixelaspect(struct file *file, void *fh,
int type, struct v4l2_fract *f)
{
struct video_device *vdev = video_devdata(file);
if (vdev->vfl_dir == VFL_DIR_RX)
return vivid_vid_cap_cropcap(file, fh, cc);
return vivid_vid_out_cropcap(file, fh, cc);
return vivid_vid_cap_g_pixelaspect(file, fh, type, f);
return vivid_vid_out_g_pixelaspect(file, fh, type, f);
}
static int vidioc_g_selection(struct file *file, void *fh,
......@@ -519,7 +520,7 @@ static const struct v4l2_ioctl_ops vivid_ioctl_ops = {
.vidioc_g_selection = vidioc_g_selection,
.vidioc_s_selection = vidioc_s_selection,
.vidioc_cropcap = vidioc_cropcap,
.vidioc_g_pixelaspect = vidioc_g_pixelaspect,
.vidioc_g_fmt_vbi_cap = vidioc_g_fmt_vbi_cap,
.vidioc_try_fmt_vbi_cap = vidioc_g_fmt_vbi_cap,
......
......@@ -1016,26 +1016,24 @@ int vivid_vid_cap_s_selection(struct file *file, void *fh, struct v4l2_selection
return 0;
}
int vivid_vid_cap_cropcap(struct file *file, void *priv,
struct v4l2_cropcap *cap)
int vivid_vid_cap_g_pixelaspect(struct file *file, void *priv,
int type, struct v4l2_fract *f)
{
struct vivid_dev *dev = video_drvdata(file);
if (cap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL;
switch (vivid_get_pixel_aspect(dev)) {
case TPG_PIXEL_ASPECT_NTSC:
cap->pixelaspect.numerator = 11;
cap->pixelaspect.denominator = 10;
f->numerator = 11;
f->denominator = 10;
break;
case TPG_PIXEL_ASPECT_PAL:
cap->pixelaspect.numerator = 54;
cap->pixelaspect.denominator = 59;
f->numerator = 54;
f->denominator = 59;
break;
case TPG_PIXEL_ASPECT_SQUARE:
cap->pixelaspect.numerator = 1;
cap->pixelaspect.denominator = 1;
default:
break;
}
return 0;
......
......@@ -28,7 +28,7 @@ int vidioc_try_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f)
int vidioc_s_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f);
int vivid_vid_cap_g_selection(struct file *file, void *priv, struct v4l2_selection *sel);
int vivid_vid_cap_s_selection(struct file *file, void *fh, struct v4l2_selection *s);
int vivid_vid_cap_cropcap(struct file *file, void *priv, struct v4l2_cropcap *cap);
int vivid_vid_cap_g_pixelaspect(struct file *file, void *priv, int type, struct v4l2_fract *f);
int vidioc_enum_fmt_vid_overlay(struct file *file, void *priv, struct v4l2_fmtdesc *f);
int vidioc_g_fmt_vid_overlay(struct file *file, void *priv, struct v4l2_format *f);
int vidioc_try_fmt_vid_overlay(struct file *file, void *priv, struct v4l2_format *f);
......
......@@ -795,26 +795,24 @@ int vivid_vid_out_s_selection(struct file *file, void *fh, struct v4l2_selection
return 0;
}
int vivid_vid_out_cropcap(struct file *file, void *priv,
struct v4l2_cropcap *cap)
int vivid_vid_out_g_pixelaspect(struct file *file, void *priv,
int type, struct v4l2_fract *f)
{
struct vivid_dev *dev = video_drvdata(file);
if (cap->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
if (type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
return -EINVAL;
switch (vivid_get_pixel_aspect(dev)) {
case TPG_PIXEL_ASPECT_NTSC:
cap->pixelaspect.numerator = 11;
cap->pixelaspect.denominator = 10;
f->numerator = 11;
f->denominator = 10;
break;
case TPG_PIXEL_ASPECT_PAL:
cap->pixelaspect.numerator = 54;
cap->pixelaspect.denominator = 59;
f->numerator = 54;
f->denominator = 59;
break;
case TPG_PIXEL_ASPECT_SQUARE:
cap->pixelaspect.numerator = 1;
cap->pixelaspect.denominator = 1;
default:
break;
}
return 0;
......
......@@ -23,7 +23,7 @@ int vidioc_try_fmt_vid_out(struct file *file, void *priv, struct v4l2_format *f)
int vidioc_s_fmt_vid_out(struct file *file, void *priv, struct v4l2_format *f);
int vivid_vid_out_g_selection(struct file *file, void *priv, struct v4l2_selection *sel);
int vivid_vid_out_s_selection(struct file *file, void *fh, struct v4l2_selection *s);
int vivid_vid_out_cropcap(struct file *file, void *fh, struct v4l2_cropcap *cap);
int vivid_vid_out_g_pixelaspect(struct file *file, void *priv, int type, struct v4l2_fract *f);
int vidioc_enum_fmt_vid_out_overlay(struct file *file, void *priv, struct v4l2_fmtdesc *f);
int vidioc_g_fmt_vid_out_overlay(struct file *file, void *priv, struct v4l2_format *f);
int vidioc_try_fmt_vid_out_overlay(struct file *file, void *priv, struct v4l2_format *f);
......
......@@ -1616,19 +1616,19 @@ static int vidioc_g_fmt_vbi_cap(struct file *file, void *priv,
return 0;
}
static int vidioc_cropcap(struct file *file, void *priv,
struct v4l2_cropcap *cc)
static int vidioc_g_pixelaspect(struct file *file, void *priv,
int type, struct v4l2_fract *f)
{
struct au0828_dev *dev = video_drvdata(file);
if (cc->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL;
dprintk(1, "%s called std_set %d dev_state %ld\n", __func__,
dev->std_set_in_tuner_core, dev->dev_state);
cc->pixelaspect.numerator = 54;
cc->pixelaspect.denominator = 59;
f->numerator = 54;
f->denominator = 59;
return 0;
}
......@@ -1777,7 +1777,7 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
.vidioc_enumaudio = vidioc_enumaudio,
.vidioc_g_audio = vidioc_g_audio,
.vidioc_s_audio = vidioc_s_audio,
.vidioc_cropcap = vidioc_cropcap,
.vidioc_g_pixelaspect = vidioc_g_pixelaspect,
.vidioc_g_selection = vidioc_g_selection,
.vidioc_reqbufs = vb2_ioctl_reqbufs,
......
......@@ -1500,18 +1500,18 @@ static const struct videobuf_queue_ops cx231xx_qops = {
/* ------------------------------------------------------------------ */
static int vidioc_cropcap(struct file *file, void *priv,
struct v4l2_cropcap *cc)
static int vidioc_g_pixelaspect(struct file *file, void *priv,
int type, struct v4l2_fract *f)
{
struct cx231xx_fh *fh = priv;
struct cx231xx *dev = fh->dev;
bool is_50hz = dev->encodernorm.id & V4L2_STD_625_50;
if (cc->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL;
cc->pixelaspect.numerator = is_50hz ? 54 : 11;
cc->pixelaspect.denominator = is_50hz ? 59 : 10;
f->numerator = is_50hz ? 54 : 11;
f->denominator = is_50hz ? 59 : 10;
return 0;
}
......@@ -1883,7 +1883,7 @@ static const struct v4l2_ioctl_ops mpeg_ioctl_ops = {
.vidioc_g_input = cx231xx_g_input,
.vidioc_s_input = cx231xx_s_input,
.vidioc_s_ctrl = vidioc_s_ctrl,
.vidioc_cropcap = vidioc_cropcap,
.vidioc_g_pixelaspect = vidioc_g_pixelaspect,
.vidioc_g_selection = vidioc_g_selection,
.vidioc_querycap = cx231xx_querycap,
.vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap,
......
......@@ -1482,18 +1482,18 @@ int cx231xx_s_register(struct file *file, void *priv,
}
#endif
static int vidioc_cropcap(struct file *file, void *priv,
struct v4l2_cropcap *cc)
static int vidioc_g_pixelaspect(struct file *file, void *priv,
int type, struct v4l2_fract *f)
{
struct cx231xx_fh *fh = priv;
struct cx231xx *dev = fh->dev;
bool is_50hz = dev->norm & V4L2_STD_625_50;
if (cc->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL;
cc->pixelaspect.numerator = is_50hz ? 54 : 11;
cc->pixelaspect.denominator = is_50hz ? 59 : 10;
f->numerator = is_50hz ? 54 : 11;
f->denominator = is_50hz ? 59 : 10;
return 0;
}
......@@ -2111,7 +2111,7 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
.vidioc_g_fmt_vbi_cap = vidioc_g_fmt_vbi_cap,
.vidioc_try_fmt_vbi_cap = vidioc_try_fmt_vbi_cap,
.vidioc_s_fmt_vbi_cap = vidioc_s_fmt_vbi_cap,
.vidioc_cropcap = vidioc_cropcap,
.vidioc_g_pixelaspect = vidioc_g_pixelaspect,
.vidioc_g_selection = vidioc_g_selection,
.vidioc_reqbufs = vidioc_reqbufs,
.vidioc_querybuf = vidioc_querybuf,
......
......@@ -703,16 +703,19 @@ static int pvr2_try_ext_ctrls(struct file *file, void *priv,
return 0;
}
static int pvr2_cropcap(struct file *file, void *priv, struct v4l2_cropcap *cap)
static int pvr2_g_pixelaspect(struct file *file, void *priv,
int type, struct v4l2_fract *f)
{
struct pvr2_v4l2_fh *fh = file->private_data;
struct pvr2_hdw *hdw = fh->channel.mc_head->hdw;
struct v4l2_cropcap cap = { .type = type };
int ret;
if (cap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL;
ret = pvr2_hdw_get_cropcap(hdw, cap);
cap->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; /* paranoia */
ret = pvr2_hdw_get_cropcap(hdw, &cap);
if (!ret)
*f = cap.pixelaspect;
return ret;
}
......@@ -815,7 +818,7 @@ static const struct v4l2_ioctl_ops pvr2_ioctl_ops = {
.vidioc_g_audio = pvr2_g_audio,
.vidioc_enumaudio = pvr2_enumaudio,
.vidioc_enum_input = pvr2_enum_input,
.vidioc_cropcap = pvr2_cropcap,
.vidioc_g_pixelaspect = pvr2_g_pixelaspect,
.vidioc_s_selection = pvr2_s_selection,
.vidioc_g_selection = pvr2_g_selection,
.vidioc_g_input = pvr2_g_input,
......
......@@ -635,14 +635,14 @@ static void determine_valid_ioctls(struct video_device *vdev)
SET_VALID_IOCTL(ops, VIDIOC_TRY_DECODER_CMD, vidioc_try_decoder_cmd);
SET_VALID_IOCTL(ops, VIDIOC_ENUM_FRAMESIZES, vidioc_enum_framesizes);
SET_VALID_IOCTL(ops, VIDIOC_ENUM_FRAMEINTERVALS, vidioc_enum_frameintervals);
if (ops->vidioc_g_selection)
if (ops->vidioc_g_selection) {
set_bit(_IOC_NR(VIDIOC_G_CROP), valid_ioctls);
set_bit(_IOC_NR(VIDIOC_CROPCAP), valid_ioctls);
}
if (ops->vidioc_s_selection)
set_bit(_IOC_NR(VIDIOC_S_CROP), valid_ioctls);
SET_VALID_IOCTL(ops, VIDIOC_G_SELECTION, vidioc_g_selection);
SET_VALID_IOCTL(ops, VIDIOC_S_SELECTION, vidioc_s_selection);
if (ops->vidioc_cropcap || ops->vidioc_g_selection)
set_bit(_IOC_NR(VIDIOC_CROPCAP), valid_ioctls);
} else if (is_vbi) {
/* vbi specific ioctls */
if ((is_rx && (ops->vidioc_g_fmt_vbi_cap ||
......
......@@ -2266,18 +2266,21 @@ static int v4l_cropcap(const struct v4l2_ioctl_ops *ops,
p->pixelaspect.numerator = 1;
p->pixelaspect.denominator = 1;
if (s.type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
s.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
else if (s.type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
s.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
/*
* The determine_valid_ioctls() call already should ensure
* that this can never happen, but just in case...
*/
if (WARN_ON(!ops->vidioc_cropcap && !ops->vidioc_g_selection))
if (WARN_ON(!ops->vidioc_g_selection))
return -ENOTTY;
if (ops->vidioc_cropcap)
ret = ops->vidioc_cropcap(file, fh, p);
if (!ops->vidioc_g_selection)
return ret;
if (ops->vidioc_g_pixelaspect)
ret = ops->vidioc_g_pixelaspect(file, fh, s.type,
&p->pixelaspect);
/*
* Ignore ENOTTY or ENOIOCTLCMD error returns, just use the
......
......@@ -220,8 +220,8 @@ struct v4l2_fh;
* :ref:`VIDIOC_G_MODULATOR <vidioc_g_modulator>` ioctl
* @vidioc_s_modulator: pointer to the function that implements
* :ref:`VIDIOC_S_MODULATOR <vidioc_g_modulator>` ioctl
* @vidioc_cropcap: pointer to the function that implements
* :ref:`VIDIOC_CROPCAP <vidioc_cropcap>` ioctl
* @vidioc_g_pixelaspect: pointer to the function that implements
* the pixelaspect part of the :ref:`VIDIOC_CROPCAP <vidioc_cropcap>` ioctl
* @vidioc_g_selection: pointer to the function that implements
* :ref:`VIDIOC_G_SELECTION <vidioc_g_selection>` ioctl
* @vidioc_s_selection: pointer to the function that implements
......@@ -487,8 +487,8 @@ struct v4l2_ioctl_ops {
int (*vidioc_s_modulator)(struct file *file, void *fh,
const struct v4l2_modulator *a);
/* Crop ioctls */
int (*vidioc_cropcap)(struct file *file, void *fh,
struct v4l2_cropcap *a);
int (*vidioc_g_pixelaspect)(struct file *file, void *fh,
int buf_type, struct v4l2_fract *aspect);
int (*vidioc_g_selection)(struct file *file, void *fh,
struct v4l2_selection *s);
int (*vidioc_s_selection)(struct file *file, void *fh,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment