Skip to content

Commit ff5a36d

Browse files
authored
Merge pull request #12 from dtmuller/add-int-type
add pod type int
2 parents f34a784 + 7fc4348 commit ff5a36d

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

include/rohrkabel/spa/pod/pod.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ namespace pipewire::spa
2020
string = 8,
2121
boolean = 2,
2222
object = 15,
23+
num_int = 4,
2324
num_float = 6,
2425
array = 13,
2526
};
@@ -99,6 +100,8 @@ namespace pipewire::spa
99100
template <>
100101
bool pod::as() const;
101102
template <>
103+
int pod::as() const;
104+
template <>
102105
float pod::as() const;
103106
template <>
104107
pod_object pod::as() const;
@@ -108,6 +111,8 @@ namespace pipewire::spa
108111
template <>
109112
void pod::write(const bool &);
110113
template <>
114+
void pod::write(const int &);
115+
template <>
111116
void pod::write(const float &);
112117
} // namespace pipewire::spa
113118

src/spa/spa.pod.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,13 @@ namespace pipewire::spa
128128
return reinterpret_cast<spa_pod_bool *>(m_impl->pod.get())->value;
129129
}
130130

131+
template <>
132+
int pod::as() const
133+
{
134+
assert(type() == spa::type::num_int);
135+
return reinterpret_cast<spa_pod_int *>(m_impl->pod.get())->value;
136+
}
137+
131138
template <>
132139
float pod::as() const
133140
{
@@ -156,6 +163,13 @@ namespace pipewire::spa
156163
reinterpret_cast<spa_pod_bool *>(m_impl->pod.get())->value = value;
157164
}
158165

166+
template <>
167+
void pod::write(const int &value)
168+
{
169+
assert(type() == spa::type::num_int);
170+
reinterpret_cast<spa_pod_int *>(m_impl->pod.get())->value = value;
171+
}
172+
159173
template <>
160174
void pod::write(const float &value)
161175
{

0 commit comments

Comments
 (0)