From: Hans Verkuil Date: Mon, 8 Apr 2013 10:31:55 +0000 (+0200) Subject: v4l2-ctl: set bytesused for streaming to the output. X-Git-Tag: v4l-utils-0.9.4~21 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3185bebe6c93ef117eb6424124c3da45b28fc572;p=platform%2Fupstream%2Fv4l-utils.git v4l2-ctl: set bytesused for streaming to the output. For output stream I/O bytesused should be filled in. Note that v4l2-ctl only supports uncompressed formats for output streaming or compressed streams where each buffer is fully filled up (i.e. bytesused == buffer length). Signed-off-by: Hans Verkuil --- diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp index 43013ed..a6ea8b3 100644 --- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp @@ -816,6 +816,7 @@ void streaming_set(int fd) unsigned p = i * num_planes + j; buffer_lengths[p] = planes[j].length; + buf.m.planes[j].bytesused = planes[j].length; if (is_mmap) { buffers[p] = mmap(NULL, planes[j].length, PROT_READ | PROT_WRITE, MAP_SHARED, @@ -836,6 +837,7 @@ void streaming_set(int fd) buf.index, num_planes, fin); } else { buffer_lengths[i] = buf.length; + buf.bytesused = buf.length; if (is_mmap) { buffers[i] = mmap(NULL, buf.length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, buf.m.offset); @@ -918,6 +920,12 @@ void streaming_set(int fd) if (fin && !fill_buffer_from_file(buffers, buffer_lengths, buf.index, num_planes, fin)) break; + if (is_mplane) { + for (unsigned j = 0; j < buf.length; j++) + buf.m.planes[j].bytesused = buf.m.planes[j].length; + } else { + buf.bytesused = buf.length; + } if (test_ioctl(fd, VIDIOC_QBUF, &buf)) return;