Skip to content
Snippets Groups Projects
Commit 62e10618 authored by Andreas Traczyk's avatar Andreas Traczyk Committed by Sébastien Blin
Browse files

avmodel: add helper function to get video device id from name

Change-Id: Ib74def3d68155fa8c3ea5728d148c06e7bb840f1
parent 67d0902c
No related branches found
No related tags found
No related merge requests found
......@@ -110,6 +110,11 @@ public:
* @return possibilities of the device
*/
video::Capabilities getDeviceCapabilities(const std::string& deviceId) const;
/**
* Get the deviceId corresponding to a given device friendly name
* @return deviceId
*/
std::string getDeviceIdFromName(const std::string& deviceName) const;
/**
* Get supported audio managers
......
......@@ -290,6 +290,22 @@ AVModel::setDeviceSettings(video::Settings& settings)
}
}
std::string
AVModel::getDeviceIdFromName(const std::string& deviceName) const
{
auto devices = getDevices();
auto iter = std::find_if(devices.begin(), devices.end(),
[this, deviceName](const std::string& d) {
auto settings = getDeviceSettings(d);
return settings.name == deviceName;
});
if (iter == devices.end()) {
qWarning() << "Couldn't find device: " << deviceName.c_str();
return {};
}
return *iter;
}
std::vector<std::string>
AVModel::getSupportedAudioManagers() const
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment