spa: libcamera: fix build error due to return type change

libcamera commit 1c4d4801850559d6f919eef5c2ffbaf7675dbc46
changed the return type of libcamera::ControlList::get()
to be std::optional<T>. Adapt the code to this change.

Fixes #2575
This commit is contained in:
Barnabás Pőcze 2022-07-20 03:11:58 +02:00 committed by Wim Taymans
parent 0bf7911b37
commit 89d5d51bb3

View file

@ -81,32 +81,29 @@ struct impl {
std::string cameraModel(const Camera *camera)
{
const ControlList &props = camera->properties();
std::string name;
if (props.contains(properties::Model))
name = props.get(properties::Model);
else
name = camera->id();
return name;
if (auto model = props.get(properties::Model))
return std::move(model.value());
return camera->id();
}
std::string cameraLoc(const Camera *camera)
{
const ControlList &props = camera->properties();
std::string location;
if (props.contains(properties::Location)) {
switch (props.get(properties::Location)) {
if (auto location = props.get(properties::Location)) {
switch (location.value()) {
case properties::CameraLocationFront:
location = "front";
break;
return "front";
case properties::CameraLocationBack:
location = "back";
break;
return "back";
case properties::CameraLocationExternal:
location = "external";
break;
return "external";
}
}
return location;
return {};
}
static int emit_info(struct impl *impl, bool full)