Commit da6e4674 authored by Florian Echtler's avatar Florian Echtler Committed by Mauro Carvalho Chehab

[media] add frame size/frame rate query functions

Add missing functions to query the single fixed frame size (960x540) and
supported frame rates. Technically, the SUR40 supports any arbitrary frame
rate up to 60 FPS, as it is polled and not interrupt-driven. For now, we
just report 30 and 60 FPS, which is sufficient to make most V4L2 tools work.
Signed-off-by: default avatarMartin Kaltenbrunner <modin@yuri.at>
Signed-off-by: default avatarFlorian Echtler <floe@butterbrot.org>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent ca27ab31
......@@ -778,6 +778,33 @@ static int sur40_vidioc_enum_fmt(struct file *file, void *priv,
return 0;
}
static int sur40_vidioc_enum_framesizes(struct file *file, void *priv,
struct v4l2_frmsizeenum *f)
{
if ((f->index != 0) || (f->pixel_format != V4L2_PIX_FMT_GREY))
return -EINVAL;
f->type = V4L2_FRMSIZE_TYPE_DISCRETE;
f->discrete.width = sur40_video_format.width;
f->discrete.height = sur40_video_format.height;
return 0;
}
static int sur40_vidioc_enum_frameintervals(struct file *file, void *priv,
struct v4l2_frmivalenum *f)
{
if ((f->index > 1) || (f->pixel_format != V4L2_PIX_FMT_GREY)
|| (f->width != sur40_video_format.width)
|| (f->height != sur40_video_format.height))
return -EINVAL;
f->type = V4L2_FRMIVAL_TYPE_DISCRETE;
f->discrete.denominator = 60/(f->index+1);
f->discrete.numerator = 1;
return 0;
}
static const struct usb_device_id sur40_table[] = {
{ USB_DEVICE(ID_MICROSOFT, ID_SUR40) }, /* Samsung SUR40 */
{ } /* terminating null entry */
......@@ -829,6 +856,9 @@ static const struct v4l2_ioctl_ops sur40_video_ioctl_ops = {
.vidioc_s_fmt_vid_cap = sur40_vidioc_fmt,
.vidioc_g_fmt_vid_cap = sur40_vidioc_fmt,
.vidioc_enum_framesizes = sur40_vidioc_enum_framesizes,
.vidioc_enum_frameintervals = sur40_vidioc_enum_frameintervals,
.vidioc_enum_input = sur40_vidioc_enum_input,
.vidioc_g_input = sur40_vidioc_g_input,
.vidioc_s_input = sur40_vidioc_s_input,
......
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