-
Notifications
You must be signed in to change notification settings - Fork 2
/
v4l2.h
60 lines (46 loc) · 1.44 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
52
53
54
55
56
57
58
59
//=============================================================================
// Cam
// Webcam client
//
// Copyright (C) 2016 Werner Schweer
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2
// as published by the Free Software Foundation and appearing in
// the file LICENCE.GPL
//=============================================================================
#ifndef __V4L2_H__
#define __V4L2_H__
#include <QString>
#include <QImage>
#define NB_BUFFER 4
//---------------------------------------------------------
// V4l2
// video for linux II c++ wrapper
//---------------------------------------------------------
class V4l2 {
int fd { -1 };
QString path;
void* mem[NB_BUFFER];
int isControl(int control, struct v4l2_queryctrl* queryctrl);
public:
V4l2();
~V4l2();
bool open(const QString&);
bool close();
int getFd() { return fd; }
int getControl(int control);
int setControl(int control, int value);
int upControl(int control);
int downControl(int control);
int toggleControl(int control);
bool resetControl(int control);
bool canVideoCapture();
bool canStreaming();
bool setMjpegFormat(int w, int h);
bool setFramerate(int fps);
QImage grab();
bool initBuffers();
bool freeBuffers();
};
#endif