-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvideodevice.h
57 lines (46 loc) · 963 Bytes
/
videodevice.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
#ifndef VIDEODEVICE_H
#define VIDEODEVICE_H
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <asm/types.h>
#include <linux/videodev2.h>
#include <linux/videodev.h>
#include <QString>
#include <QObject>
#include "widget.h"
#define CLEAR(x) memset(&(x), 0, sizeof(x))
class Udp;
class VideoDevice : public QObject
{
Q_OBJECT
public:
VideoDevice(QString dev_name);
Udp *udp;
int open_device();
int close_device();
int init_device();
int start_capturing();
int stop_capturing();
int uninit_device();
int get_frame(void **, size_t*);
int unget_frame();
void readOneframe();
void sendData();
private:
int init_mmap();
struct buffer
{
void * start;
size_t length;
};
QString dev_name;
int fd;
buffer* buffers;
unsigned int n_buffers;
int index;
};
#endif // VIDEODEVICE_H