v4l2: improve buffer flag decoding
* xlat/v4l2_buf_flags.in: Add fallback values. * xlat/v4l2_buf_flags_masks.in: New file. * xlat/v4l2_buf_flags_ts_src.in: Likewise. * xlat/v4l2_buf_flags_ts_type.in: Likewise. * v4l2.c: Include xlat/v4l2_buf_flags_ts_type.h, xlat/v4l2_buf_flags_ts_src.h, xlat/v4l2_buf_flags_masks.h. (print_v4l2_buffer_flags): New function. (print_v4l2_buffer): Call print_v4l2_buffer_flags for printing flags field.
This commit is contained in:
25
v4l2.c
25
v4l2.c
@ -412,6 +412,29 @@ print_v4l2_requestbuffers(struct tcb *const tcp, const kernel_ulong_t arg)
|
||||
}
|
||||
|
||||
#include "xlat/v4l2_buf_flags.h"
|
||||
#include "xlat/v4l2_buf_flags_ts_type.h"
|
||||
#include "xlat/v4l2_buf_flags_ts_src.h"
|
||||
|
||||
#define XLAT_MACROS_ONLY
|
||||
# include "xlat/v4l2_buf_flags_masks.h"
|
||||
#undef XLAT_MACROS_ONLY
|
||||
|
||||
static void
|
||||
print_v4l2_buffer_flags(uint32_t val)
|
||||
{
|
||||
const uint32_t ts_type = val & V4L2_BUF_FLAG_TIMESTAMP_MASK;
|
||||
const uint32_t ts_src = val & V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
|
||||
const uint32_t flags = val & ~ts_type & ~ts_src;
|
||||
|
||||
|
||||
printflags(v4l2_buf_flags, flags, "V4L2_BUF_FLAG_???");
|
||||
tprints("|");
|
||||
printxval(v4l2_buf_flags_ts_type, ts_type,
|
||||
"V4L2_BUF_FLAG_TIMESTAMP_???");
|
||||
tprints("|");
|
||||
printxval(v4l2_buf_flags_ts_type, ts_src,
|
||||
"V4L2_BUF_FLAG_TSTAMP_SRC_???");
|
||||
}
|
||||
|
||||
static int
|
||||
print_v4l2_buffer(struct tcb *const tcp, const unsigned int code,
|
||||
@ -446,7 +469,7 @@ print_v4l2_buffer(struct tcb *const tcp, const unsigned int code,
|
||||
|
||||
tprintf(", length=%u, bytesused=%u, flags=",
|
||||
b.length, b.bytesused);
|
||||
printflags(v4l2_buf_flags, b.flags, "V4L2_BUF_FLAG_???");
|
||||
print_v4l2_buffer_flags(b.flags);
|
||||
if (code == VIDIOC_DQBUF) {
|
||||
tprints(", timestamp = ");
|
||||
MPERS_FUNC_NAME(print_struct_timeval)(&b.timestamp,
|
||||
|
@ -1,19 +1,14 @@
|
||||
V4L2_BUF_FLAG_MAPPED
|
||||
V4L2_BUF_FLAG_QUEUED
|
||||
V4L2_BUF_FLAG_DONE
|
||||
V4L2_BUF_FLAG_KEYFRAME
|
||||
V4L2_BUF_FLAG_PFRAME
|
||||
V4L2_BUF_FLAG_BFRAME
|
||||
V4L2_BUF_FLAG_TIMECODE
|
||||
V4L2_BUF_FLAG_INPUT
|
||||
V4L2_BUF_FLAG_PREPARED
|
||||
V4L2_BUF_FLAG_NO_CACHE_INVALIDATE
|
||||
V4L2_BUF_FLAG_NO_CACHE_CLEAN
|
||||
V4L2_BUF_FLAG_TIMESTAMP_MASK
|
||||
V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN
|
||||
V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC
|
||||
V4L2_BUF_FLAG_TIMESTAMP_COPY
|
||||
V4L2_BUF_FLAG_TSTAMP_SRC_MASK
|
||||
V4L2_BUF_FLAG_TSTAMP_SRC_EOF
|
||||
V4L2_BUF_FLAG_TSTAMP_SRC_SOE
|
||||
V4L2_BUF_FLAG_LAST
|
||||
V4L2_BUF_FLAG_MAPPED 0x00000001
|
||||
V4L2_BUF_FLAG_QUEUED 0x00000002
|
||||
V4L2_BUF_FLAG_DONE 0x00000004
|
||||
V4L2_BUF_FLAG_KEYFRAME 0x00000008
|
||||
V4L2_BUF_FLAG_PFRAME 0x00000010
|
||||
V4L2_BUF_FLAG_BFRAME 0x00000020
|
||||
V4L2_BUF_FLAG_ERROR 0x00000040
|
||||
V4L2_BUF_FLAG_IN_REQUEST 0x00000080
|
||||
V4L2_BUF_FLAG_TIMECODE 0x00000100
|
||||
V4L2_BUF_FLAG_PREPARED 0x00000400
|
||||
V4L2_BUF_FLAG_NO_CACHE_INVALIDATE 0x00000800
|
||||
V4L2_BUF_FLAG_NO_CACHE_CLEAN 0x00001000
|
||||
V4L2_BUF_FLAG_LAST 0x00100000
|
||||
V4L2_BUF_FLAG_REQUEST_FD 0x00800000
|
||||
|
2
xlat/v4l2_buf_flags_masks.in
Normal file
2
xlat/v4l2_buf_flags_masks.in
Normal file
@ -0,0 +1,2 @@
|
||||
V4L2_BUF_FLAG_TIMESTAMP_MASK 0x0000e000
|
||||
V4L2_BUF_FLAG_TSTAMP_SRC_MASK 0x00070000
|
3
xlat/v4l2_buf_flags_ts_src.in
Normal file
3
xlat/v4l2_buf_flags_ts_src.in
Normal file
@ -0,0 +1,3 @@
|
||||
/* V4L2_BUF_FLAG_TSTAMP_SRC_MASK 0x00070000 */
|
||||
V4L2_BUF_FLAG_TSTAMP_SRC_EOF 0x00000000
|
||||
V4L2_BUF_FLAG_TSTAMP_SRC_SOE 0x00010000
|
4
xlat/v4l2_buf_flags_ts_type.in
Normal file
4
xlat/v4l2_buf_flags_ts_type.in
Normal file
@ -0,0 +1,4 @@
|
||||
/* V4L2_BUF_FLAG_TIMESTAMP_MASK 0x0000e000 */
|
||||
V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN 0x00000000
|
||||
V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC 0x00002000
|
||||
V4L2_BUF_FLAG_TIMESTAMP_COPY 0x00004000
|
Reference in New Issue
Block a user