From 33609003dc1b983286f588e84b3df2dd61130be5 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 4 Mar 2013 16:01:09 +0100 Subject: [PATCH] v4l2-ctl: support data_offset when streaming multiplanar formats. Signed-off-by: Hans Verkuil --- utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp index e23e317..015ec84 100644 --- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp @@ -675,7 +675,17 @@ void streaming_set(int fd) for (unsigned j = 0; j < num_planes; j++) { unsigned p = buf.index * num_planes + j; unsigned used = is_mplane ? planes[j].bytesused : buf.bytesused; - unsigned sz = fwrite(buffers[p], 1, used, fout); + unsigned offset = is_mplane ? planes[j].data_offset : 0; + unsigned sz; + + if (offset > used) { + // Should never happen + fprintf(stderr, "offset %d > used %d!\n", + offset, used); + offset = 0; + } + used -= offset; + sz = fwrite((char *)buffers[p] + offset, 1, used, fout); if (sz != used) fprintf(stderr, "%u != %u\n", sz, used); -- 2.7.4