static int dmabufs[VIDEO_MAX_FRAME][VIDEO_MAX_PLANES];
static struct v4l2_format cur_fmt;
-static const unsigned valid_output_flags = V4L2_BUF_FLAG_TIMECODE |
+static const unsigned valid_output_flags =
+ V4L2_BUF_FLAG_TIMECODE | V4L2_BUF_FLAG_TSTAMP_SRC_MASK |
V4L2_BUF_FLAG_KEYFRAME | V4L2_BUF_FLAG_PFRAME | V4L2_BUF_FLAG_BFRAME;
bool operator<(struct timeval const& n1, struct timeval const& n2)
struct buf_seq &seq)
{
unsigned timestamp = buf.flags & V4L2_BUF_FLAG_TIMESTAMP_MASK;
+ bool ts_copy = timestamp == V4L2_BUF_FLAG_TIMESTAMP_COPY;
+ unsigned timestamp_src = buf.flags & V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
unsigned frame_types = 0;
unsigned buf_states = 0;
fail_on_test(buf.reserved2 || buf.reserved);
fail_on_test(timestamp != V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC &&
timestamp != V4L2_BUF_FLAG_TIMESTAMP_COPY);
+ fail_on_test(timestamp_src != V4L2_BUF_FLAG_TSTAMP_SRC_SOE &&
+ timestamp_src != V4L2_BUF_FLAG_TSTAMP_SRC_EOF);
+ fail_on_test(!ts_copy && V4L2_TYPE_IS_OUTPUT(buf.type) &&
+ timestamp_src == V4L2_BUF_FLAG_TSTAMP_SRC_SOE);
if (buf.flags & V4L2_BUF_FLAG_KEYFRAME)
frame_types++;
if (buf.flags & V4L2_BUF_FLAG_PFRAME)
}
}
- if (!V4L2_TYPE_IS_OUTPUT(buf.type) &&
- timestamp != V4L2_BUF_FLAG_TIMESTAMP_COPY &&
+ if (!V4L2_TYPE_IS_OUTPUT(buf.type) && !ts_copy &&
(buf.flags & V4L2_BUF_FLAG_TIMECODE))
warn("V4L2_BUF_FLAG_TIMECODE was used!\n");
seq.last_field = buf.field;
} else {
fail_on_test(buf.sequence);
- if (mode == Queued && timestamp == V4L2_BUF_FLAG_TIMESTAMP_COPY &&
- V4L2_TYPE_IS_OUTPUT(buf.type)) {
+ if (mode == Queued && ts_copy && V4L2_TYPE_IS_OUTPUT(buf.type)) {
fail_on_test(!buf.timestamp.tv_sec && !buf.timestamp.tv_usec);
} else {
fail_on_test(buf.timestamp.tv_sec || buf.timestamp.tv_usec);
if ((buf.flags & V4L2_BUF_FLAG_TIMESTAMP_MASK) == V4L2_BUF_FLAG_TIMESTAMP_COPY) {
buf.timestamp.tv_sec = ts.tv_sec;
buf.timestamp.tv_usec = ts.tv_nsec / 1000;
+ buf.flags |= V4L2_BUF_FLAG_TSTAMP_SRC_SOE;
}
buf.flags |= V4L2_BUF_FLAG_TIMECODE | V4L2_BUF_FLAG_KEYFRAME;
buf.timecode.type = V4L2_TC_TYPE_30FPS;