-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathframe.h
70 lines (56 loc) · 1.23 KB
/
frame.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
* frame.h
*
* Access video frames from the camera.
*/
#ifndef FRAME_H
#define FRAME_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <math.h>
#include <getopt.h> /* getopt_long() */
#include <fcntl.h> /* low-level i/o */
#include <unistd.h>
#include <errno.h>
#include <malloc.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <asm/types.h> /* for videodev2.h */
#include <linux/videodev2.h>
#define CLEAR(x) memset (&(x), 0, sizeof (x))
typedef enum {
IO_METHOD_READ,
IO_METHOD_MMAP,
IO_METHOD_USERPTR,
} io_method;
struct buffer {
void * start;
size_t length;
};
// TODO : documentation
extern unsigned char *pixels;
extern int fd;
extern char *dev_name;
extern io_method io;
/*
* close the video device
*/
void close_device(void);
/*
* open the video device
*/
void open_device (void);
void errno_exit(const char *s);
int xioctl (int fd, int request, void *arg);
int read_frame (void);
void stop_capturing (void);
void start_capturing (void);
void uninit_device (void);
void init_mmap (void);
void init_device (void);
#endif