diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-02-06 19:31:59 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-02-06 19:31:59 +0100 |
commit | 2190a34473772cfc12d3d8cbdd441bbff2a84c25 (patch) | |
tree | bf9c87ab234bf3d5aa77b22e62e5e228b5ea2b7a /linux/drivers/media/video/cx18 | |
parent | 9c3099aba6097fe4ea7199d02a1bf3d8049e9316 (diff) | |
download | mediapointer-dvb-s2-2190a34473772cfc12d3d8cbdd441bbff2a84c25.tar.gz mediapointer-dvb-s2-2190a34473772cfc12d3d8cbdd441bbff2a84c25.tar.bz2 |
ivtv/cx18: fix g_fmt and try_fmt for raw video
From: Hans Verkuil <hverkuil@xs4all.nl>
The raw video device didn't report the image size correctly.
When setting a new image the image height has to be a multiple of 32 lines.
Priority: normal
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'linux/drivers/media/video/cx18')
-rw-r--r-- | linux/drivers/media/video/cx18/cx18-ioctl.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/linux/drivers/media/video/cx18/cx18-ioctl.c b/linux/drivers/media/video/cx18/cx18-ioctl.c index c023c79cf..995e19c23 100644 --- a/linux/drivers/media/video/cx18/cx18-ioctl.c +++ b/linux/drivers/media/video/cx18/cx18-ioctl.c @@ -160,10 +160,8 @@ static int cx18_g_fmt_vid_cap(struct file *file, void *fh, pixfmt->priv = 0; if (id->type == CX18_ENC_STREAM_TYPE_YUV) { pixfmt->pixelformat = V4L2_PIX_FMT_HM12; - /* YUV size is (Y=(h*w) + UV=(h*(w/2))) */ - pixfmt->sizeimage = - pixfmt->height * pixfmt->width + - pixfmt->height * (pixfmt->width / 2); + /* YUV size is (Y=(h*720) + UV=(h*(720/2))) */ + pixfmt->sizeimage = pixfmt->height * 720 * 3 / 2; pixfmt->bytesperline = 720; } else { pixfmt->pixelformat = V4L2_PIX_FMT_MPEG; @@ -228,11 +226,18 @@ static int cx18_try_fmt_vid_cap(struct file *file, void *fh, struct cx18 *cx = id->cx; int w = fmt->fmt.pix.width; int h = fmt->fmt.pix.height; + int min_h = 2; w = min(w, 720); - w = max(w, 1); + w = max(w, 2); + if (id->type == CX18_ENC_STREAM_TYPE_YUV) { + /* YUV height must be a multiple of 32 */ + h &= ~0x1f; + min_h = 32; + } h = min(h, cx->is_50hz ? 576 : 480); - h = max(h, 2); + h = max(h, min_h); + cx18_g_fmt_vid_cap(file, fh, fmt); fmt->fmt.pix.width = w; fmt->fmt.pix.height = h; |