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/ivtv/ivtv-ioctl.c | |
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/ivtv/ivtv-ioctl.c')
-rw-r--r-- | drivers/media/video/ivtv/ivtv-ioctl.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index c13bd2aa0bea..e8621da26d80 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c | |||
@@ -345,10 +345,8 @@ static int ivtv_g_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *f | |||
345 | pixfmt->priv = 0; | 345 | pixfmt->priv = 0; |
346 | if (id->type == IVTV_ENC_STREAM_TYPE_YUV) { | 346 | if (id->type == IVTV_ENC_STREAM_TYPE_YUV) { |
347 | pixfmt->pixelformat = V4L2_PIX_FMT_HM12; | 347 | pixfmt->pixelformat = V4L2_PIX_FMT_HM12; |
348 | /* YUV size is (Y=(h*w) + UV=(h*(w/2))) */ | 348 | /* YUV size is (Y=(h*720) + UV=(h*(720/2))) */ |
349 | pixfmt->sizeimage = | 349 | pixfmt->sizeimage = pixfmt->height * 720 * 3 / 2; |
350 | pixfmt->height * pixfmt->width + | ||
351 | pixfmt->height * (pixfmt->width / 2); | ||
352 | pixfmt->bytesperline = 720; | 350 | pixfmt->bytesperline = 720; |
353 | } else { | 351 | } else { |
354 | pixfmt->pixelformat = V4L2_PIX_FMT_MPEG; | 352 | pixfmt->pixelformat = V4L2_PIX_FMT_MPEG; |
@@ -469,11 +467,17 @@ static int ivtv_try_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format | |||
469 | struct ivtv *itv = id->itv; | 467 | struct ivtv *itv = id->itv; |
470 | int w = fmt->fmt.pix.width; | 468 | int w = fmt->fmt.pix.width; |
471 | int h = fmt->fmt.pix.height; | 469 | int h = fmt->fmt.pix.height; |
470 | int min_h = 2; | ||
472 | 471 | ||
473 | w = min(w, 720); | 472 | w = min(w, 720); |
474 | w = max(w, 2); | 473 | w = max(w, 2); |
474 | if (id->type == IVTV_ENC_STREAM_TYPE_YUV) { | ||
475 | /* YUV height must be a multiple of 32 */ | ||
476 | h &= ~0x1f; | ||
477 | min_h = 32; | ||
478 | } | ||
475 | h = min(h, itv->is_50hz ? 576 : 480); | 479 | h = min(h, itv->is_50hz ? 576 : 480); |
476 | h = max(h, 2); | 480 | h = max(h, min_h); |
477 | ivtv_g_fmt_vid_cap(file, fh, fmt); | 481 | ivtv_g_fmt_vid_cap(file, fh, fmt); |
478 | fmt->fmt.pix.width = w; | 482 | fmt->fmt.pix.width = w; |
479 | fmt->fmt.pix.height = h; | 483 | fmt->fmt.pix.height = h; |