summaryrefslogtreecommitdiff
path: root/yavta.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2010-05-21 15:17:31 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2010-05-21 15:17:31 +0200
commit454203ed354c84c6947bb774c8deda9b2646e190 (patch)
treeaa083ad3b2f5cc076e557fdcce48a66804f892b5 /yavta.c
parentf2ff2bfef299e3ebddeb4962aef50d3c3012edb6 (diff)
Warn when v4l2_buffer::bytesused has an unexpected value
For uncompressed formats in capture devices, the v4l2_buffer::bytesused field should have the same value as the v4l2_pix_format::sizeimage field reported by the VIDIOC_G_FMT ioctl. Print a warning on VIDIOC_DQBUG when the values don't match. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'yavta.c')
-rw-r--r--yavta.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/yavta.c b/yavta.c
index 4c0d97b..3d42915 100644
--- a/yavta.c
+++ b/yavta.c
@@ -42,6 +42,7 @@ struct device
enum v4l2_memory memtype;
unsigned int nbufs;
unsigned int bufsize;
+ unsigned int imagesize;
void **mem;
};
@@ -186,6 +187,8 @@ static int video_get_format(struct device *dev)
return ret;
}
+ dev->imagesize = fmt.fmt.pix.bytesperline ? fmt.fmt.pix.sizeimage : 0;
+
printf("Video format: %c%c%c%c (%08x) %ux%u\n",
(fmt.fmt.pix.pixelformat >> 0) & 0xff,
(fmt.fmt.pix.pixelformat >> 8) & 0xff,
@@ -765,6 +768,11 @@ static int video_do_capture(struct device *dev, unsigned int nframes,
buf.m.userptr = (unsigned long)dev->mem[i];
}
+ if (dev->type == V4L2_BUF_TYPE_VIDEO_CAPTURE &&
+ dev->imagesize != 0 && buf.bytesused != dev->imagesize)
+ printf("Warning: bytes used %u != image size %u\n",
+ buf.bytesused, dev->imagesize);
+
size += buf.bytesused;
gettimeofday(&ts, NULL);