Commit 62e10618 authored by Andreas Traczyk's avatar Andreas Traczyk Committed by Sébastien Blin

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

Change-Id: Ib74def3d68155fa8c3ea5728d148c06e7bb840f1
parent 67d0902c
......@@ -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
{
......
Markdown is supported
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