diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2009-02-06 13:31:59 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:42:41 -0400 |
commit | a4a787187bcf94b1bf4deb74cbe30eb442519875 (patch) | |
tree | 833bb178c23fc385726f701fb6ac8f5d4d6d7a16 /drivers/media/video/cx18 | |
parent | fdf9c9979a355916433262ea5e5e64bed5def86e (diff) |
V4L/DVB (10486): ivtv/cx18: fix g_fmt and try_fmt for raw video
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.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx18')
-rw-r--r-- | drivers/media/video/cx18/cx18-ioctl.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/media/video/cx18/cx18-ioctl.c b/drivers/media/video/cx18/cx18-ioctl.c index 0f0cd560226c..5c8e9cb244f9 100644 --- a/drivers/media/video/cx18/cx18-ioctl.c +++ b/drivers/media/video/cx18/cx18-ioctl.c | |||
@@ -160,10 +160,8 @@ static int cx18_g_fmt_vid_cap(struct file *file, void *fh, | |||
160 | pixfmt->priv = 0; | 160 | pixfmt->priv = 0; |
161 | if (id->type == CX18_ENC_STREAM_TYPE_YUV) { | 161 | if (id->type == CX18_ENC_STREAM_TYPE_YUV) { |
162 | pixfmt->pixelformat = V4L2_PIX_FMT_HM12; | 162 | pixfmt->pixelformat = V4L2_PIX_FMT_HM12; |
163 | /* YUV size is (Y=(h*w) + UV=(h*(w/2))) */ | 163 | /* YUV size is (Y=(h*720) + UV=(h*(720/2))) */ |
164 | pixfmt->sizeimage = | 164 | pixfmt->sizeimage = pixfmt->height * 720 * 3 / 2; |
165 | pixfmt->height * pixfmt->width + | ||
166 | pixfmt->height * (pixfmt->width / 2); | ||
167 | pixfmt->bytesperline = 720; | 165 | pixfmt->bytesperline = 720; |
168 | } else { | 166 | } else { |
169 | pixfmt->pixelformat = V4L2_PIX_FMT_MPEG; | 167 | pixfmt->pixelformat = V4L2_PIX_FMT_MPEG; |
@@ -228,11 +226,18 @@ static int cx18_try_fmt_vid_cap(struct file *file, void *fh, | |||
228 | struct cx18 *cx = id->cx; | 226 | struct cx18 *cx = id->cx; |
229 | int w = fmt->fmt.pix.width; | 227 | int w = fmt->fmt.pix.width; |
230 | int h = fmt->fmt.pix.height; | 228 | int h = fmt->fmt.pix.height; |
229 | int min_h = 2; | ||
231 | 230 | ||
232 | w = min(w, 720); | 231 | w = min(w, 720); |
233 | w = max(w, 1); | 232 | w = max(w, 2); |
233 | if (id->type == CX18_ENC_STREAM_TYPE_YUV) { | ||
234 | /* YUV height must be a multiple of 32 */ | ||
235 | h &= ~0x1f; | ||
236 | min_h = 32; | ||
237 | } | ||
234 | h = min(h, cx->is_50hz ? 576 : 480); | 238 | h = min(h, cx->is_50hz ? 576 : 480); |
235 | h = max(h, 2); | 239 | h = max(h, min_h); |
240 | |||
236 | cx18_g_fmt_vid_cap(file, fh, fmt); | 241 | cx18_g_fmt_vid_cap(file, fh, fmt); |
237 | fmt->fmt.pix.width = w; | 242 | fmt->fmt.pix.width = w; |
238 | fmt->fmt.pix.height = h; | 243 | fmt->fmt.pix.height = h; |