-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathv4l2.h
51 lines (45 loc) · 1.07 KB
/
v4l2.h
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
#ifndef _V4L2_H
#define _V4L2_H
#ifdef __cplusplus
extern "C"
{
#endif
#include <stddef.h>
#include <stdint.h>
#include <linux/videodev2.h>
enum IO_METHOD
{
IO_METHOD_READ,
IO_METHOD_MMAP,
};
struct buffer
{
void *start;
size_t length;
};
typedef struct
{
int64_t *fd;
char *dev_name;
enum IO_METHOD io_method;
struct buffer *buffers;
uint32_t n_buffers;
_Bool force_format;
uint32_t width;
uint32_t height;
uint32_t pixelformat;
uint32_t field;
/*call back function*/
_Bool (*process_image)(uint8_t *p, int size);
/*function pointer*/
int (*open_device)(char * device,void *ctx);
int (*init_device)(void *ctx);
int (*start_capturing)(void *ctx);
void (*main_loop)(void *ctx);
int (*close)(void *ctx);
}V4l2Context;
V4l2Context * alloc_v4l2_context();
#ifdef __cplusplus
}
#endif
#endif /* !_V4L2_H */