Skip to content

Commit

Permalink
V4L/DVB (5888): zr36067: Driver was not returning correct image size
Browse files Browse the repository at this point in the history
The driver was returning the size of the (fixed) buffer it allocated as the
sizeimage field in the v4l2 pixel format, rather than the actual size of the
image.  For example, a 192x128 YUYV image is 49152 bytes but the driver would
always return 131072 bytes since if that was the size of the v4l buffer.

This violates the v4l2 spec, which says that sizeimage should be the actual
size of the image for uncompressed formats.  It also caused mplayer to crash.

Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Acked-by: Ronald S. Bultje <rbultje@ronald.bitfreak.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
  • Loading branch information
Trent Piepho authored and Mauro Carvalho Chehab committed Jul 30, 2007
1 parent e42af83 commit bb2e033
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/media/video/zoran_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -2737,7 +2737,8 @@ zoran_do_ioctl (struct inode *inode,
fmt->fmt.pix.height =
fh->v4l_settings.height;
fmt->fmt.pix.sizeimage =
fh->v4l_buffers.buffer_size;
fh->v4l_settings.bytesperline *
fh->v4l_settings.height;
fmt->fmt.pix.pixelformat =
fh->v4l_settings.format->fourcc;
fmt->fmt.pix.colorspace =
Expand Down Expand Up @@ -2984,8 +2985,9 @@ zoran_do_ioctl (struct inode *inode,

/* tell the user the
* results/missing stuff */
fmt->fmt.pix.sizeimage = fh->v4l_buffers.buffer_size /*zr->gbpl * zr->gheight */
;
fmt->fmt.pix.sizeimage =
fh->v4l_settings.height *
fh->v4l_settings.bytesperline;
if (BUZ_MAX_HEIGHT <
(fh->v4l_settings.height * 2))
fmt->fmt.pix.field =
Expand Down

0 comments on commit bb2e033

Please sign in to comment.