-
Notifications
You must be signed in to change notification settings - Fork 5
/
videodevice.h
executable file
·56 lines (44 loc) · 930 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
#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 <QString>
#include <QObject>
#include <QTextCodec>
#define CLEAR(x) memset(&(x), 0, sizeof(x))
class VideoDevice : public QObject
{
Q_OBJECT
public:
VideoDevice(QString dev_name);
//VideoDevice();
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();
private:
int init_mmap();
struct buffer
{
void * start;
size_t length;
};
QString dev_name;
int fd;
buffer* buffers;
unsigned int n_buffers;
int index;
signals:
void display_error(QString);
};
#endif // VIDEODEVICE_H