From 8673f17c0ab8937ac304edd06348569edf999af7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Wed, 23 Jul 2025 14:39:46 +0200 Subject: [PATCH] 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`. --- spa/plugins/libcamera/libcamera-source.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/spa/plugins/libcamera/libcamera-source.cpp b/spa/plugins/libcamera/libcamera-source.cpp index a983a9de2..0ec270111 100644 --- a/spa/plugins/libcamera/libcamera-source.cpp +++ b/spa/plugins/libcamera/libcamera-source.cpp @@ -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()); + 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_builder_pop(&b, &f));