summaryrefslogtreecommitdiff
path: root/include/uvcgadget/video-source.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 /include/uvcgadget/video-source.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 'include/uvcgadget/video-source.h')
-rw-r--r--include/uvcgadget/video-source.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/include/uvcgadget/video-source.h b/include/uvcgadget/video-source.h
new file mode 100644
index 0000000..fffcba3
--- /dev/null
+++ b/include/uvcgadget/video-source.h
@@ -0,0 +1,55 @@
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+/*
+ * Abstract video source
+ *
+ * Copyright (C) 2018 Laurent Pinchart
+ *
+ * Contact: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+ */
+#ifndef __VIDEO_SOURCE_H__
+#define __VIDEO_SOURCE_H__
+
+struct v4l2_buffer;
+struct v4l2_pix_format;
+struct video_buffer;
+struct video_buffer_set;
+struct video_source;
+
+struct video_source_ops {
+ void(*destroy)(struct video_source *src);
+ int(*set_format)(struct video_source *src, struct v4l2_pix_format *fmt);
+ int(*alloc_buffers)(struct video_source *src, unsigned int nbufs);
+ int(*export_buffers)(struct video_source *src,
+ struct video_buffer_set **buffers);
+ int(*free_buffers)(struct video_source *src);
+ int(*stream_on)(struct video_source *src);
+ int(*stream_off)(struct video_source *src);
+ int(*queue_buffer)(struct video_source *src, struct video_buffer *buf);
+};
+
+typedef void(*video_source_buffer_handler_t)(void *, struct video_source *,
+ struct video_buffer *);
+
+struct video_source {
+ const struct video_source_ops *ops;
+ struct events *events;
+ video_source_buffer_handler_t handler;
+ void *handler_data;
+};
+
+void video_source_set_buffer_handler(struct video_source *src,
+ video_source_buffer_handler_t handler,
+ void *data);
+void video_source_destroy(struct video_source *src);
+int video_source_set_format(struct video_source *src,
+ struct v4l2_pix_format *fmt);
+int video_source_alloc_buffers(struct video_source *src, unsigned int nbufs);
+int video_source_export_buffers(struct video_source *src,
+ struct video_buffer_set **buffers);
+int video_source_free_buffers(struct video_source *src);
+int video_source_stream_on(struct video_source *src);
+int video_source_stream_off(struct video_source *src);
+int video_source_queue_buffer(struct video_source *src,
+ struct video_buffer *buf);
+
+#endif /* __VIDEO_SOURCE_H__ */