v4l2-ctl: fix printing of buffer flags
authorHans Verkuil <hans.verkuil@cisco.com>
Tue, 11 Mar 2014 07:34:33 +0000 (08:34 +0100)
committerHans Verkuil <hans.verkuil@cisco.com>
Tue, 11 Mar 2014 07:34:33 +0000 (08:34 +0100)
Don't include timestamp_type and src masks with the buffer flags, those
are handled separately.

I also made a small change when capturing: if verbose is true then also
dump the contents of buffers marked with state ERROR.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
utils/v4l2-ctl/v4l2-ctl-streaming.cpp

index 8b16881..cf063e6 100644 (file)
@@ -163,9 +163,11 @@ static const flag_def tc_flags_def[] = {
 
 static void print_buffer(FILE *f, struct v4l2_buffer &buf)
 {
+       const unsigned ts_flags = V4L2_BUF_FLAG_TIMESTAMP_MASK | V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
+
        fprintf(f, "\tIndex    : %d\n", buf.index);
        fprintf(f, "\tType     : %s\n", buftype2s(buf.type).c_str());
-       fprintf(f, "\tFlags    : %s\n", flags2s(buf.flags, flags_def).c_str());
+       fprintf(f, "\tFlags    : %s\n", flags2s(buf.flags & ~ts_flags, flags_def).c_str());
        fprintf(f, "\tField    : %s\n", field2s(buf.field).c_str());
        fprintf(f, "\tSequence : %u\n", buf.sequence);
        fprintf(f, "\tLength   : %u\n", buf.length);
@@ -624,6 +626,8 @@ static int do_handle_cap(int fd, buffers &b, FILE *fout, int *index,
                }
                if (!(buf.flags & V4L2_BUF_FLAG_ERROR))
                        break;
+               if (verbose)
+                       print_buffer(stderr, buf);
                test_ioctl(fd, VIDIOC_QBUF, &buf);
        }
        if (fout && (!stream_skip || ignore_count_skip) && !(buf.flags & V4L2_BUF_FLAG_ERROR)) {