1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Windows desktop capture (gdigrab)

This commit is contained in:
Tux3 / Mlkj / !Lev.uXFMLA 2015-06-03 11:11:07 +02:00 committed by tux3
parent 37a3a8d9d6
commit 44628373cd
No known key found for this signature in database
GPG Key ID: 7E086DD661263264

View File

@ -39,6 +39,11 @@ CameraDevice* CameraDevice::open(QString devName, AVDictionary** options)
devName = devName.mid(8); devName = devName.mid(8);
format = idesktopFormat; format = idesktopFormat;
} }
else if (devName.startsWith("gdigrab#"))
{
devName = devName.mid(8);
format = idesktopFormat;
}
else else
{ {
format = iformat; format = iformat;
@ -63,7 +68,7 @@ out:
CameraDevice* CameraDevice::open(QString devName) CameraDevice* CameraDevice::open(QString devName)
{ {
VideoMode mode{}; VideoMode mode{0,0,0};
return open(devName, mode); return open(devName, mode);
} }
@ -217,8 +222,13 @@ QVector<QPair<QString, QString>> CameraDevice::getDeviceList()
else else
devices = getRawDeviceListGeneric(); devices = getRawDeviceListGeneric();
if (idesktopFormat && idesktopFormat->name == QString("x11grab")) if (idesktopFormat)
devices.push_back(QPair<QString,QString>{"x11grab#:0", "Desktop"}); {
if (idesktopFormat->name == QString("x11grab"))
devices.push_back(QPair<QString,QString>{"x11grab#:0", "Desktop"});
if (idesktopFormat->name == QString("gdigrab"))
devices.push_back(QPair<QString,QString>{"gdigrab#desktop", "Desktop"});
}
return devices; return devices;
} }
@ -271,6 +281,9 @@ bool CameraDevice::getDefaultInputFormat()
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
idesktopFormat = av_find_input_format("x11grab"); idesktopFormat = av_find_input_format("x11grab");
#endif #endif
#ifdef Q_OS_WIN
idesktopFormat = av_find_input_format("gdigrab");
#endif
// Webcam input formats // Webcam input formats
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX