v4l2-ctl: set bytesused for streaming to the output.
authorHans Verkuil <hans.verkuil@cisco.com>
Mon, 8 Apr 2013 10:31:55 +0000 (12:31 +0200)
committerHans Verkuil <hans.verkuil@cisco.com>
Mon, 8 Apr 2013 10:31:55 +0000 (12:31 +0200)
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 <hans.verkuil@cisco.com>
utils/v4l2-ctl/v4l2-ctl-streaming.cpp

index 43013ed..a6ea8b3 100644 (file)
@@ -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;