summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Elder <paul.elder@ideasonboard.com>2018-06-07 20:01:24 +0900
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2018-06-09 02:30:24 +0300
commitadc1190eb4ff4b263b185c732b3a8bcedfc44f19 (patch)
tree1c1063d29ffd59e84b21934c80708900d779469a
parentbabe9a5aa7f6eb109e47bd8ded680d7087dd0ab2 (diff)
stream: add documentation
Add documentation to functions in stream.h header file. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--stream.h75
1 files changed, 75 insertions, 0 deletions
diff --git a/stream.h b/stream.h
index f3662d8..ba3d8af 100644
--- a/stream.h
+++ b/stream.h
@@ -25,6 +25,12 @@ struct uvc_device;
struct uvc_function_config;
struct v4l2_device;
+/*
+ * struct uvc_stream - Representation of a UVC stream
+ * @cap: V4L2 capture device
+ * @uvc: UVC V4L2 output device
+ * @events: struct events containing event information
+ */
struct uvc_stream
{
struct v4l2_device *cap;
@@ -33,14 +39,83 @@ struct uvc_stream
struct events *events;
};
+/*
+ * uvc_stream_new - Create a new UVC stream
+ * @uvc_device: Filename of UVC device node
+ * @cap_device: Filename of V4L2 capture device node
+ *
+ * Create a new UVC stream with V4L2 @uvc_device as the output and @cap_device
+ * as input.
+ *
+ * Streams allocated with this function can be deleted with uvc_stream_delete().
+ *
+ * On success, returns a pointer to newly allocated and populated struct uvc_stream.
+ * On failure, returns NULL.
+ */
struct uvc_stream *uvc_stream_new(const char *uvc_device,
const char *cap_device);
+
+/*
+ * uvc_stream_init_uvc - Initialize a UVC stream
+ * @stream: the UVC stream
+ * @fc: UVC function configuration
+ *
+ * Before it can be used, a UVC stream has to be initialized by calling this
+ * function with a UVC function configuration @fc. The function configuration
+ * contains all the parameters of the UVC function that will be handled by the
+ * UVC stream. It can be parsed from the UVC function ConfigFS directory using
+ * configfs_parse_uvc_function().
+ */
void uvc_stream_init_uvc(struct uvc_stream *stream,
struct uvc_function_config *fc);
+
+/*
+ * uvc_stream_set_event_handler - Set an event handler for a stream
+ * @stream: the UVC stream
+ * @events: the event handler
+ *
+ * This function sets the event handler that the stream can use to be notified
+ * of file descriptor events. Event notifiers can be registered by this
+ * function, the caller must ensure that the event handler is immediately
+ * usable. If the event loop is already running, all initialization steps
+ * required to handle events must be fully performed before calling this
+ * function.
+ */
void uvc_stream_set_event_handler(struct uvc_stream *stream,
struct events *events);
+
+/*
+ * uvc_stream_delete - Delete a UVC stream
+ * @stream: the UVC stream
+ *
+ * This functions deletes the @stream created with uvc_stream_new(). Upon return
+ * the stream object may be freed, the @stream pointer thus becomes invalid and
+ * the stream must not be touched anymore.
+ *
+ * Every stream allocated with uvc_stream_new() must be deleted when not needed
+ * anymore.
+ */
void uvc_stream_delete(struct uvc_stream *stream);
+
+/*
+ * uvc_stream_set_format - Set the active video format for the stream
+ * @stream: the UVC stream
+ *
+ * This function is called from the UVC protocol handler to configure the video
+ * format for the @stream. It must not be called directly by applications.
+ *
+ * Returns 0 on success, or a negative error code on failure.
+ */
int uvc_stream_set_format(struct uvc_stream *stream);
+
+/*
+ * uvc_stream_enable - Turn on/off video streaming for the UVC stream
+ * @stream: the UVC stream
+ * @enable: 0 to stop the stream, 1 to start it
+ *
+ * This function is called from the UVC protocol handler to start video transfer
+ * for the @stream. It must not be called directly by applications.
+ */
void uvc_stream_enable(struct uvc_stream *stream, int enable);
#endif /* __STREAM_H__ */