[PATCH] media: add V4L2_BUF_FLAG_TIMESTAMP_UTC and V4L2_BUF_FLAG_TIMESTAMP_TAI.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN and
V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC were added long ago, no other flag
was introduced to indicate precisely the reference clock used for
timestamps associated to v4l2 buffers.  Add here the ability for drivers
to use the realtime (= UTC) or TAI clock.

Signed-off-by: Philippe De Muyter <phdm@xxxxxxxxx>
---
 Documentation/userspace-api/media/v4l/buffer.rst | 14 ++++++++++++++
 include/trace/events/v4l2.h                      |  2 ++
 include/uapi/linux/videodev2.h                   |  2 ++
 3 files changed, 18 insertions(+)

diff --git a/Documentation/userspace-api/media/v4l/buffer.rst b/Documentation/userspace-api/media/v4l/buffer.rst
index 1b0fdc1..44cb59b 100644
--- a/Documentation/userspace-api/media/v4l/buffer.rst
+++ b/Documentation/userspace-api/media/v4l/buffer.rst
@@ -637,6 +637,20 @@ Buffer Flags
       - The buffer timestamp has been taken from the ``CLOCK_MONOTONIC``
 	clock. To access the same clock outside V4L2, use
 	:c:func:`clock_gettime`.
+    * .. _`V4L2-BUF-FLAG-TIMESTAMP-UTC`:
+
+      - ``V4L2_BUF_FLAG_TIMESTAMP_UTC``
+      - 0x00008000
+      - The buffer timestamp has been taken from the ``CLOCK_REALTIME``
+	clock. To access the same clock outside V4L2, use
+	:c:func:`clock_gettime`.
+    * .. _`V4L2-BUF-FLAG-TIMESTAMP-TAI`:
+
+      - ``V4L2_BUF_FLAG_TIMESTAMP_TAI``
+      - 0x0000a000
+      - The buffer timestamp has been taken from the ``CLOCK_TAI``
+	clock. To access the same clock outside V4L2, use
+	:c:func:`clock_gettime`.
     * .. _`V4L2-BUF-FLAG-TIMESTAMP-COPY`:
 
       - ``V4L2_BUF_FLAG_TIMESTAMP_COPY``
diff --git a/include/trace/events/v4l2.h b/include/trace/events/v4l2.h
index 248bc09..ce93c88 100644
--- a/include/trace/events/v4l2.h
+++ b/include/trace/events/v4l2.h
@@ -88,6 +88,8 @@
 		{ V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN,   "TIMESTAMP_UNKNOWN" },   \
 		{ V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC, "TIMESTAMP_MONOTONIC" }, \
 		{ V4L2_BUF_FLAG_TIMESTAMP_COPY,	     "TIMESTAMP_COPY" },      \
+		{ V4L2_BUF_FLAG_TIMESTAMP_UTC,	     "TIMESTAMP_UTC" },       \
+		{ V4L2_BUF_FLAG_TIMESTAMP_TAI,	     "TIMESTAMP_TAI" },       \
 		{ V4L2_BUF_FLAG_LAST,                "LAST" })
 
 #define show_timecode_flags(flags)					  \
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 79dbde3..87502ab 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -1101,6 +1101,8 @@ static inline __u64 v4l2_timeval_to_ns(const struct timeval *tv)
 #define V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN		0x00000000
 #define V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC	0x00002000
 #define V4L2_BUF_FLAG_TIMESTAMP_COPY		0x00004000
+#define V4L2_BUF_FLAG_TIMESTAMP_UTC		0x00008000
+#define V4L2_BUF_FLAG_TIMESTAMP_TAI		0x0000a000
 /* Timestamp sources. */
 #define V4L2_BUF_FLAG_TSTAMP_SRC_MASK		0x00070000
 #define V4L2_BUF_FLAG_TSTAMP_SRC_EOF		0x00000000
-- 
1.8.4




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux