From 7fc434866e4ecd0c887b26f21528262ed9f12490 Mon Sep 17 00:00:00 2001 From: "van Veen, Stephan.ext" Date: Tue, 17 Dec 2024 09:41:32 +0100 Subject: [PATCH] add pod type int So far only few of the base types specified in spa are mapped in this library. Adding type int is crucial for e.g. brightness property in video inputs. --- include/rohrkabel/spa/pod/pod.hpp | 5 +++++ src/spa/spa.pod.cpp | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/include/rohrkabel/spa/pod/pod.hpp b/include/rohrkabel/spa/pod/pod.hpp index e3332b1..79cf74f 100644 --- a/include/rohrkabel/spa/pod/pod.hpp +++ b/include/rohrkabel/spa/pod/pod.hpp @@ -20,6 +20,7 @@ namespace pipewire::spa string = 8, boolean = 2, object = 15, + num_int = 4, num_float = 6, array = 13, }; @@ -99,6 +100,8 @@ namespace pipewire::spa template <> bool pod::as() const; template <> + int pod::as() const; + template <> float pod::as() const; template <> pod_object pod::as() const; @@ -108,6 +111,8 @@ namespace pipewire::spa template <> void pod::write(const bool &); template <> + void pod::write(const int &); + template <> void pod::write(const float &); } // namespace pipewire::spa diff --git a/src/spa/spa.pod.cpp b/src/spa/spa.pod.cpp index 71b09f6..e31ff07 100644 --- a/src/spa/spa.pod.cpp +++ b/src/spa/spa.pod.cpp @@ -128,6 +128,13 @@ namespace pipewire::spa return reinterpret_cast(m_impl->pod.get())->value; } + template <> + int pod::as() const + { + assert(type() == spa::type::num_int); + return reinterpret_cast(m_impl->pod.get())->value; + } + template <> float pod::as() const { @@ -156,6 +163,13 @@ namespace pipewire::spa reinterpret_cast(m_impl->pod.get())->value = value; } + template <> + void pod::write(const int &value) + { + assert(type() == spa::type::num_int); + reinterpret_cast(m_impl->pod.get())->value = value; + } + template <> void pod::write(const float &value) {