From babe9a5aa7f6eb109e47bd8ded680d7087dd0ab2 Mon Sep 17 00:00:00 2001 From: Paul Elder Date: Thu, 7 Jun 2018 20:01:23 +0900 Subject: uvc-gadget: factor out uvc protocol and stream handling code uvc-gadget.c has been getting cluttered with functions related to UVC protocol handling and stream handling. Additionally, it is forseen that we might want stream handling to be modular for different system models. Factor out code related to UVC protocol handling to uvc.c (and uvc.h) and code related to stream handling to stream.c (and stream.h), and update the Makefile accordingly. Signed-off-by: Paul Elder Signed-off-by: Laurent Pinchart --- stream.h | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 stream.h (limited to 'stream.h') diff --git a/stream.h b/stream.h new file mode 100644 index 0000000..f3662d8 --- /dev/null +++ b/stream.h @@ -0,0 +1,46 @@ +/* + * UVC gadget test application + * + * Copyright (C) 2010 Ideas on board SPRL + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + */ + +#ifndef __STREAM_H__ +#define __STREAM_H__ + +struct events; +struct uvc_device; +struct uvc_function_config; +struct v4l2_device; + +struct uvc_stream +{ + struct v4l2_device *cap; + struct uvc_device *uvc; + + struct events *events; +}; + +struct uvc_stream *uvc_stream_new(const char *uvc_device, + const char *cap_device); +void uvc_stream_init_uvc(struct uvc_stream *stream, + struct uvc_function_config *fc); +void uvc_stream_set_event_handler(struct uvc_stream *stream, + struct events *events); +void uvc_stream_delete(struct uvc_stream *stream); +int uvc_stream_set_format(struct uvc_stream *stream); +void uvc_stream_enable(struct uvc_stream *stream, int enable); + +#endif /* __STREAM_H__ */ -- cgit v1.2.3