forked from yuana1/facerec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
v4l2.h
50 lines (43 loc) · 957 Bytes
/
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
#ifndef V4L2_H
#define V4L2_H
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <linux/videodev2.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <stdlib.h>
//#define ANDROID_ENV
#ifdef ANDROID_ENV
#define LOG LOGV
#else
#define LOG printf
#endif
#define CAMERA_DEVICE "/dev/video0"
#define CAPTURE_FILE "frame.jpeg"
#define VIDEO_WIDTH 640
#define VIDEO_HEIGHT 480
#define VIDEO_FORMAT V4L2_PIX_FMT_YUYV
//#define VIDEO_FORMAT V4L2_PIX_FMT_JPEG
#define BUFFER_COUNT 1
class video
{
private:
struct fimc_buffer {
int length;
void *start;
} framebuf[BUFFER_COUNT];
int fd;
bool sign3;
public:
// explicit video(void);
int init_video();
int get_data();
void release_video();
int yuvtorgbO(unsigned char *rgb, unsigned int width,unsigned int height);
int yuvtorgb(int y, int u, int v);
struct v4l2_buffer buf;
};
#endif // V4L2_H