blob: 24b5b98c3aaa6de812874b32a7dc07af2f9331da (
plain) (
blame)
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
|
#include "videodevice.h"
#include <QFile>
VideoDevice::VideoDevice()
{
}
VideoDevice::~VideoDevice()
{
}
void VideoDevice::Capture()
{
}
void VideoDevice::Play()
{
}
void VideoDevice::Close()
{
}
QList<MediaDeviceInfo> VideoDevice::Enumerate()
{
QList<MediaDeviceInfo> result;
int index = 0;
#ifdef Q_OS_LINUX
for (int i = 0; i < 64; i++)
{
QString device = QString(QLatin1String("/dev/video%1")).arg(i);
if (QFile::exists(device))
{
MediaDeviceInfo d;
d.device = device;
QFile v4l2_name(QString(QLatin1String("/sys/class/video4linux/video%1/name")).arg(i));
if (v4l2_name.open((QIODevice::ReadOnly | QIODevice::Text)))
{
d.humanReadable = QString(v4l2_name.readLine()).trimmed();
v4l2_name.close();
}
d.index = index++;
result << d;
}
}
#endif
return result;
}
|