diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-09-14 13:36:34 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-09-26 12:30:36 -0300 |
commit | 1c2d034e3c0ce4c1c89f1636a9f4aa7615cc7474 (patch) | |
tree | 53e7454a2dac4f21de1056f1fdc75ac73e855918 /drivers | |
parent | 3d265c96ccb8f72153b4e926053a79e1a52bf264 (diff) |
V4L/DVB (4637): Add a default method for VIDIOC_G_PARM
For most drivers, VIDIOC_G_PARM will just return the current standard fps.
So, instead of failing, drivers based on video_ioctl2 will implement the
default method.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/videodev.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c index 26e7ea252a0..479a0675cf6 100644 --- a/drivers/media/video/videodev.c +++ b/drivers/media/video/videodev.c @@ -1283,9 +1283,29 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, case VIDIOC_G_PARM: { struct v4l2_streamparm *p=arg; - if (!vfd->vidioc_g_parm) - break; - ret=vfd->vidioc_g_parm(file, fh, p); + if (vfd->vidioc_g_parm) { + ret=vfd->vidioc_g_parm(file, fh, p); + } else { + struct v4l2_standard s; + + if (!vfd->tvnormsize) { + printk (KERN_WARNING "%s: no TV norms defined!\n", + vfd->name); + break; + } + + if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + + v4l2_video_std_construct(&s, vfd->tvnorms[vfd->current_norm].id, + vfd->tvnorms[vfd->current_norm].name); + + memset(p,0,sizeof(*p)); + + p->parm.capture.timeperframe = s.frameperiod; + ret=0; + } + dbgarg (cmd, "type=%d\n", p->type); break; } |