summaryrefslogtreecommitdiff
path: root/stream.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2018-06-09 02:22:54 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2018-06-09 02:30:26 +0300
commiteed880da1cf4af845700e1caf68d4d689391d4d3 (patch)
treeaa53329c95672aec72cb08f919b081b658173f67 /stream.c
parentadc1190eb4ff4b263b185c732b3a8bcedfc44f19 (diff)
uvc: Handle UVC events internally in uvc.c
The event notifier for the UVC device is registered in uvc_stream_set_event_handler(), which requires exposing the uvc_events_process() event handler to the uvc_stream class. Make the event handler internal by registering it in uvc_events_init(). This requires passing the uvc_stream pointer to the uvc_open() function and storing it internally in the uvc_device object. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'stream.c')
-rw-r--r--stream.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/stream.c b/stream.c
index b6e0efe..2b95ee8 100644
--- a/stream.c
+++ b/stream.c
@@ -178,11 +178,6 @@ int uvc_stream_set_format(struct uvc_stream *stream)
return v4l2_set_format(cap, &fmt);
}
-static int uvc_video_init(struct uvc_device *dev __attribute__((__unused__)))
-{
- return 0;
-}
-
/* ---------------------------------------------------------------------------
* Stream handling
*/
@@ -202,7 +197,7 @@ struct uvc_stream *uvc_stream_new(const char *uvc_device,
if (stream->cap == NULL)
goto error;
- stream->uvc = uvc_open(uvc_device);
+ stream->uvc = uvc_open(uvc_device, stream);
if (stream->uvc == NULL)
goto error;
@@ -236,15 +231,11 @@ void uvc_stream_init_uvc(struct uvc_stream *stream,
stream->uvc->maxsize = 0;
stream->uvc->fc = fc;
- uvc_events_init(stream->uvc);
- uvc_video_init(stream->uvc);
+ uvc_events_init(stream->uvc, stream->events);
}
void uvc_stream_set_event_handler(struct uvc_stream *stream,
struct events *events)
{
stream->events = events;
-
- events_watch_fd(stream->events, stream->uvc->vdev->fd, EVENT_EXCEPTION,
- uvc_events_process, stream);
}