mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
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:
parent
e379267274
commit
8673f17c0a
1 changed files with 15 additions and 0 deletions
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue