spa: libcamera: source: provide value labels if available

For enumerated controls of type `libcamera::ControlTypeInteger32`, libcamera
provides the names of the enumerators, so add them to `SPA_PROP_INFO_labels`.
This commit is contained in:
Barnabás Pőcze 2025-07-23 14:39:46 +02:00 committed by Wim Taymans
parent e379267274
commit 8673f17c0a

View file

@ -857,6 +857,21 @@ spa_pod *control_details_to_pod(spa_pod_builder& b,
}
spa_pod_builder_pop(&b, &f);
if (cid.type() == libcamera::ControlTypeInteger32) {
spa_pod_builder_prop(&b, SPA_PROP_INFO_labels, 0);
spa_pod_builder_push_struct(&b, &f);
for (const auto& cv : cinfo.values()) {
auto it = cid.enumerators().find(cv.get<int32_t>());
if (it == cid.enumerators().end())
continue;
spa_pod_builder_int(&b, it->first);
spa_pod_builder_string_len(&b, it->second.data(), it->second.size());
}
spa_pod_builder_pop(&b, &f);
}
}
return reinterpret_cast<spa_pod *>(spa_pod_builder_pop(&b, &f));