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) {