[PATCH v8 04/15] media:Add v4l2 event codec_error and skip

From: Ming Qian
Date: Tue Sep 07 2021 - 05:50:20 EST


The codec_error event can tell client that
there are some error occurs in the decoder engine.

The skip event can tell the client that
there are a frame has been decoded,
but it won't be outputed.

Signed-off-by: Ming Qian <ming.qian@xxxxxxx>
Signed-off-by: Shijie Qin <shijie.qin@xxxxxxx>
Signed-off-by: Zhou Peng <eagle.zhou@xxxxxxx>
---
.../userspace-api/media/v4l/vidioc-dqevent.rst | 12 ++++++++++++
include/uapi/linux/videodev2.h | 2 ++
2 files changed, 14 insertions(+)

diff --git a/Documentation/userspace-api/media/v4l/vidioc-dqevent.rst b/Documentation/userspace-api/media/v4l/vidioc-dqevent.rst
index 6eb40073c906..87d40ad25604 100644
--- a/Documentation/userspace-api/media/v4l/vidioc-dqevent.rst
+++ b/Documentation/userspace-api/media/v4l/vidioc-dqevent.rst
@@ -182,6 +182,18 @@ call.
the regions changes. This event has a struct
:c:type:`v4l2_event_motion_det`
associated with it.
+ * - ``V4L2_EVENT_CODEC_ERROR``
+ - 7
+ - This event is triggered when some error occurs inside the codec engine,
+ usually it can be replaced by a POLLERR event, but in some cases, the POLLERR
+ may cause the application to exit, but this event can allow the application to
+ handle the codec error without exiting.
+ * - ``V4L2_EVENT_SKIP``
+ - 8
+ - This event is triggered when one frame is decoded, but it won't be outputed
+ to the display. So the application can't get this frame, and the input frame count
+ is dismatch with the output frame count. And this evevt is telling the client to
+ handle this case.
* - ``V4L2_EVENT_PRIVATE_START``
- 0x08000000
- Base event number for driver-private events.
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 5bb0682b4a23..c56640d42dc5 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -2369,6 +2369,8 @@ struct v4l2_streamparm {
#define V4L2_EVENT_FRAME_SYNC 4
#define V4L2_EVENT_SOURCE_CHANGE 5
#define V4L2_EVENT_MOTION_DET 6
+#define V4L2_EVENT_CODEC_ERROR 7
+#define V4L2_EVENT_SKIP 8
#define V4L2_EVENT_PRIVATE_START 0x08000000

/* Payload for V4L2_EVENT_VSYNC */
--
2.32.0