Skip to content

Commit

Permalink
V4L/DVB (12400): em28xx: Allow changing fps on webcams
Browse files Browse the repository at this point in the history
em28xx doesn't have temporal scaling. However, on webcams, sensors are
capable of changing the output rate. So, VIDIOC_[G|S]_PARM ioctls should
be passed to the sensor for it to properly set frame rate.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Mauro Carvalho Chehab committed Aug 13, 2009
1 parent 83053f7 commit d96ecda
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions drivers/media/video/em28xx/em28xx-video.c
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,41 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *norm)
return 0;
}

static int vidioc_g_parm(struct file *file, void *priv,
struct v4l2_streamparm *p)
{
struct em28xx_fh *fh = priv;
struct em28xx *dev = fh->dev;
int rc = 0;

if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL;

if (dev->board.is_webcam)
rc = v4l2_device_call_until_err(&dev->v4l2_dev, 0,
video, g_parm, p);
else
v4l2_video_std_frame_period(dev->norm,
&p->parm.capture.timeperframe);

return rc;
}

static int vidioc_s_parm(struct file *file, void *priv,
struct v4l2_streamparm *p)
{
struct em28xx_fh *fh = priv;
struct em28xx *dev = fh->dev;

if (!dev->board.is_webcam)
return -EINVAL;

if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL;

return v4l2_device_call_until_err(&dev->v4l2_dev, 0, video, s_parm, p);
}

static const char *iname[] = {
[EM28XX_VMUX_COMPOSITE1] = "Composite1",
[EM28XX_VMUX_COMPOSITE2] = "Composite2",
Expand Down Expand Up @@ -1885,6 +1920,8 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
.vidioc_qbuf = vidioc_qbuf,
.vidioc_dqbuf = vidioc_dqbuf,
.vidioc_s_std = vidioc_s_std,
.vidioc_g_parm = vidioc_g_parm,
.vidioc_s_parm = vidioc_s_parm,
.vidioc_enum_input = vidioc_enum_input,
.vidioc_g_input = vidioc_g_input,
.vidioc_s_input = vidioc_s_input,
Expand Down

0 comments on commit d96ecda

Please sign in to comment.