Commit 43eeb5f2 authored by Casian Andrei's avatar Casian Andrei
Browse files

Add screen capture virtual device for video capture

parent acb27cce
......@@ -157,7 +157,10 @@ void DeviceManager::updateDeviceList()
int i;
// Setup a list of available capture devices
// TODO
DeviceInfo screenDevice("Screen", "Virtual device for screen capture", false);
screenDevice.capabilities = DeviceInfo::VideoCapture;
screenDevice.accessList.append(QPair<QByteArray, QString>("screen", ""));
vcs.append(screenDevice);
// See the device capabilities and sort them accordingly
for (i = 0; i < devices.count(); ++ i) {
......
......@@ -262,12 +262,15 @@ void MediaObject::setSource(const MediaSource &source)
{
debug() << Q_FUNC_INFO;
// Reset previous streameraders
// Reset previous streamereaders
if (m_streamReader) {
m_streamReader->unlock();
m_streamReader = 0;
}
// Reset previous isScreen flag
m_isScreen = false;
m_mediaSource = source;
QByteArray driverName;
......@@ -346,6 +349,11 @@ void MediaObject::setSource(const MediaSource &source)
}
loadMedia("alsa://" + deviceName);
} else if (driverName == "screen") {
loadMedia("screen://" + deviceName);
// Set the isScreen flag needed to add extra options in playInternal
m_isScreen = true;
} else {
error() << Q_FUNC_INFO << "unsupported MediaSource::CaptureDevice:" << driverName;
break;
......@@ -536,6 +544,11 @@ void MediaObject::playInternal()
}
}
if (m_isScreen) {
addOption(m_media, QString("screen-fps=24.0"));
addOption(m_media, QString("screen-caching=300"));
}
foreach (SinkNode * sink, m_sinks) {
sink->addToMedia(m_media);
}
......
......@@ -453,6 +453,7 @@ private:
QList<SinkNode *> m_sinks;
bool m_hasVideo;
bool m_isScreen;
bool m_seekable;
qint64 m_seekpoint;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment