From 24655815f5d1643d22194d5abbd46c1bd43669e9 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 2 Jul 2009 17:49:43 -0300 Subject: v4l2grab: Be sure that libv4l is properly converting to RGB24 From: Mauro Carvalho Chehab To be simple, there's no format conversion inside v4l2grab. It relies that libv4l will do the hard work of converting whatever input format into RGB24. Instead of just proceeding and writing wrong images, die if libv4l can't convert into RGB24. Signed-off-by: Mauro Carvalho Chehab --- v4l2-apps/test/v4l2grab.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'v4l2-apps/test') diff --git a/v4l2-apps/test/v4l2grab.c b/v4l2-apps/test/v4l2grab.c index 20692117e..153a0dd30 100644 --- a/v4l2-apps/test/v4l2grab.c +++ b/v4l2-apps/test/v4l2grab.c @@ -72,6 +72,13 @@ int main(int argc, char **argv) fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_RGB24; fmt.fmt.pix.field = V4L2_FIELD_INTERLACED; xioctl(fd, VIDIOC_S_FMT, &fmt); + if (fmt.fmt.pix.pixelformat != V4L2_PIX_FMT_RGB24) { + printf("Libv4l didn't accept RGB24 format. Can't proceed.\n"); + exit(EXIT_FAILURE); + } + if ((fmt.fmt.pix.width != 640) || (fmt.fmt.pix.height != 480)) + printf("Warning: driver is sending image at %dx%d\n", + fmt.fmt.pix.width, fmt.fmt.pix.height); CLEAR(req); req.count = 2; -- cgit v1.2.3