summaryrefslogtreecommitdiff
path: root/lib/video-buffers.h
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2018-06-09 14:29:41 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2018-06-12 21:19:58 +0300
commit2bb0cfbf8137e02cc32aae3b36f85ef7300e8936 (patch)
tree42899dbeb32459722d27606bd79848a25a8c5e16 /lib/video-buffers.h
parentdf21a9349a256fd2bea1f8701af198b312682d39 (diff)
Split UVC gadget into a library and test application
Split the project into a UVC gadget library and a test application. To avoid rolling out a custom build system, switch to CMake. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'lib/video-buffers.h')
-rw-r--r--lib/video-buffers.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/lib/video-buffers.h b/lib/video-buffers.h
new file mode 100644
index 0000000..001f75e
--- /dev/null
+++ b/lib/video-buffers.h
@@ -0,0 +1,48 @@
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+/*
+ * Video buffers
+ *
+ * Copyright (C) 2018 Laurent Pinchart
+ *
+ * Contact: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+ */
+#ifndef __VIDEO_BUFFERS_H__
+#define __VIDEO_BUFFERS_H__
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <sys/time.h>
+
+/*
+ *
+ * struct video_buffer - Video buffer information
+ * @index: Zero-based buffer index, limited to the number of buffers minus one
+ * @size: Size of the video memory, in bytes
+ * @bytesused: Number of bytes used by video data, smaller or equal to @size
+ * @timestamp: Time stamp at which the buffer has been captured
+ * @error: True if an error occured while capturing video data for the buffer
+ * @allocated: True if memory for the buffer has been allocated
+ * @mem: Video data memory
+ * @dmabuf: Video data dmabuf handle
+ */
+struct video_buffer
+{
+ unsigned int index;
+ unsigned int size;
+ unsigned int bytesused;
+ struct timeval timestamp;
+ bool error;
+ void *mem;
+ int dmabuf;
+};
+
+struct video_buffer_set
+{
+ struct video_buffer *buffers;
+ unsigned int nbufs;
+};
+
+struct video_buffer_set *video_buffer_set_new(unsigned int nbufs);
+void video_buffer_set_delete(struct video_buffer_set *buffers);
+
+#endif /* __VIDEO_BUFFERS_H__ */