summaryrefslogtreecommitdiff
path: root/video-source.c
blob: 06092f5c26dc9dd9fe5c2da0c70eb2a72d104522 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
 * Abstract video source
 *
 * Copyright (C) 2018 Laurent Pinchart
 *
 * Contact: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
 */

#include "video-source.h"

void video_source_set_buffer_handler(struct video_source *src,
				     video_source_buffer_handler_t handler,
				     void *data)
{
	src->handler = handler;
	src->handler_data = data;
}

void video_source_destroy(struct video_source *src)
{
	if (src)
		src->ops->destroy(src);
}

int video_source_set_format(struct video_source *src,
			    struct v4l2_pix_format *fmt)
{
	return src->ops->set_format(src, fmt);
}

int video_source_alloc_buffers(struct video_source *src, unsigned int nbufs)
{
	return src->ops->alloc_buffers(src, nbufs);
}

int video_source_export_buffers(struct video_source *src,
				struct video_buffer_set **buffers)
{
	return src->ops->export_buffers(src, buffers);
}

int video_source_free_buffers(struct video_source *src)
{
	return src->ops->free_buffers(src);
}

int video_source_stream_on(struct video_source *src)
{
	return src->ops->stream_on(src);
}

int video_source_stream_off(struct video_source *src)
{
	return src->ops->stream_off(src);
}

int video_source_queue_buffer(struct video_source *src,
			      struct video_buffer *buf)
{
	return src->ops->queue_buffer(src, buf);
}