summaryrefslogtreecommitdiff
path: root/yavta.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2015-02-26 00:43:00 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2015-02-26 00:43:00 +0200
commit6fc99ac59e7c5173e646de4285681dd0e63d6924 (patch)
tree487cb855bc1cb7d0527311f48ac52285dde285be /yavta.c
parentfe279d823dc253a95002a0a73d9d791e372e156b (diff)
Prints bytes used for all planes
When using the multiplanar API the v4l2_buffer bytesused field is documented as ignored, and the planes array should be used instead. Compute the total number of bytes used to be printed during capture based on the planes array when using the multiplanar API. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'yavta.c')
-rw-r--r--yavta.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/yavta.c b/yavta.c
index 7c21db2..eedf889 100644
--- a/yavta.c
+++ b/yavta.c
@@ -1576,6 +1576,20 @@ static void video_save_image(struct device *dev, struct v4l2_buffer *buf,
close(fd);
}
+unsigned int video_buffer_bytes_used(struct device *dev, struct v4l2_buffer *buf)
+{
+ unsigned int bytesused = 0;
+ unsigned int i;
+
+ if (!video_is_mplane(dev))
+ return buf->bytesused;
+
+ for (i = 0; i < dev->num_planes; i++)
+ bytesused += buf->m.planes[i].bytesused;
+
+ return bytesused;
+}
+
static int video_do_capture(struct device *dev, unsigned int nframes,
unsigned int skip, unsigned int delay, const char *pattern,
int do_requeue_last, int do_queue_late, enum buffer_fill_mode fill)
@@ -1642,8 +1656,9 @@ static int video_do_capture(struct device *dev, unsigned int nframes,
printf("%u (%u) [%c] %s %u %u B %ld.%06ld %ld.%06ld %.3f fps ts %s/%s\n", i, buf.index,
(buf.flags & V4L2_BUF_FLAG_ERROR) ? 'E' : '-',
v4l2_field_name(buf.field),
- buf.sequence, buf.bytesused, buf.timestamp.tv_sec,
- buf.timestamp.tv_usec, ts.tv_sec, ts.tv_nsec/1000, fps,
+ buf.sequence, video_buffer_bytes_used(dev, &buf),
+ buf.timestamp.tv_sec, buf.timestamp.tv_usec,
+ ts.tv_sec, ts.tv_nsec/1000, fps,
ts_type, ts_source);
last = buf.timestamp;