diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-04-22 23:54:36 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-04-22 23:54:36 -0300 |
commit | 28e3a27310e4ad865d4d4ff05c8af715bdb3f138 (patch) | |
tree | b6515bc36bbf0b05dbe4819d8be962e9e53c30b8 /linux/drivers/media/video/pwc/pwc-v4l.c | |
parent | 5ac5d525371f2b6af08d2fdca38d5dc99685413d (diff) | |
download | mediapointer-dvb-s2-28e3a27310e4ad865d4d4ff05c8af715bdb3f138.tar.gz mediapointer-dvb-s2-28e3a27310e4ad865d4d4ff05c8af715bdb3f138.tar.bz2 |
Add ENUM_FRAMESIZES and ENUM_FRAMEINTERVALS ioctls
From: Luc Saillard <luc@saillard.org>
This patch add support for the VIDIOC_ENUM_FRAMESIZES and
VIDIOC_ENUM_FRAMEINTERVALS ioctl.
* check if the maximum native framesize for raw mode is correct
* raw mode framerates for all three chipset types
Signed-off-by: Gregor Jasny <gjasny@web.de>
Signed-off-by: Luc Saillard <luc@saillard.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers/media/video/pwc/pwc-v4l.c')
-rw-r--r-- | linux/drivers/media/video/pwc/pwc-v4l.c | 60 |
1 files changed, 58 insertions, 2 deletions
diff --git a/linux/drivers/media/video/pwc/pwc-v4l.c b/linux/drivers/media/video/pwc/pwc-v4l.c index 2d5bb48f3..e20251d05 100644 --- a/linux/drivers/media/video/pwc/pwc-v4l.c +++ b/linux/drivers/media/video/pwc/pwc-v4l.c @@ -127,7 +127,6 @@ static struct v4l2_queryctrl pwc_controls[] = { .step = 1, .default_value = 0, }, -#ifndef BROKEN_XAWTV { .id = V4L2_CID_PRIVATE_SAVE_USER, .type = V4L2_CTRL_TYPE_BUTTON, @@ -209,7 +208,6 @@ static struct v4l2_queryctrl pwc_controls[] = { .step = 1, .default_value = 0, }, -#endif }; @@ -1195,6 +1193,64 @@ int pwc_video_do_ioctl(struct inode *inode, struct file *file, return 0; } + case VIDIOC_ENUM_FRAMESIZES: + { + struct v4l2_frmsizeenum *fsize = arg; + unsigned int i = 0, index = fsize->index; + + if (fsize->pixel_format == V4L2_PIX_FMT_YUV420) { + for (i = 0; i < PSZ_MAX; i++) { + if (pdev->image_mask & (1UL << i)) { + if (!index--) { + fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE; + fsize->discrete.width = pwc_image_sizes[i].x; + fsize->discrete.height = pwc_image_sizes[i].y; + return 0; + } + } + } + } else if (fsize->index == 0 && + ((fsize->pixel_format == V4L2_PIX_FMT_PWC1 && DEVICE_USE_CODEC1(pdev->type)) || + (fsize->pixel_format == V4L2_PIX_FMT_PWC2 && DEVICE_USE_CODEC23(pdev->type)))) { + + fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE; + fsize->discrete.width = pdev->abs_max.x; + fsize->discrete.height = pdev->abs_max.y; + return 0; + } + return -EINVAL; + } + + case VIDIOC_ENUM_FRAMEINTERVALS: + { + struct v4l2_frmivalenum *fival = arg; + int size = -1; + unsigned int i; + + for (i = 0; i < PSZ_MAX; i++) { + if (pwc_image_sizes[i].x == fival->width && + pwc_image_sizes[i].y == fival->height) { + size = i; + break; + } + } + + /* TODO: Support raw format */ + if (size < 0 || fival->pixel_format != V4L2_PIX_FMT_YUV420) { + return -EINVAL; + } + + i = pwc_get_fps(pdev, fival->index, size); + if (!i) + return -EINVAL; + + fival->type = V4L2_FRMIVAL_TYPE_DISCRETE; + fival->discrete.numerator = 1; + fival->discrete.denominator = i; + + return 0; + } + default: return pwc_ioctl(pdev, cmd, arg); } /* ..switch */ |