summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-05-08 22:45:24 +0200
committerLennart Poettering <lennart@poettering.net>2009-05-08 22:49:47 +0200
commita714861cc1fa2e06c5f5509880fcbfbc334c2812 (patch)
treecab089dcb4842a47355f877ce230ae9c83dde6cd /src
parent44e566ade8a62163007780f7f81b514705e3233b (diff)
channelmap: add pa_channel_map_has_position()
Diffstat (limited to 'src')
-rw-r--r--src/pulse/channelmap.c13
-rw-r--r--src/pulse/channelmap.h4
2 files changed, 17 insertions, 0 deletions
diff --git a/src/pulse/channelmap.c b/src/pulse/channelmap.c
index ce7dadc9..fe14df24 100644
--- a/src/pulse/channelmap.c
+++ b/src/pulse/channelmap.c
@@ -839,3 +839,16 @@ const char* pa_channel_map_to_pretty_name(const pa_channel_map *map) {
return NULL;
}
+
+int pa_channel_map_has_position(const pa_channel_map *map, pa_channel_position_t p) {
+ unsigned c;
+
+ pa_return_val_if_fail(pa_channel_map_valid(map), 0);
+ pa_return_val_if_fail(p < PA_CHANNEL_POSITION_MAX, 0);
+
+ for (c = 0; c < map->channels; c++)
+ if (map->map[c] == p)
+ return 1;
+
+ return 0;
+}
diff --git a/src/pulse/channelmap.h b/src/pulse/channelmap.h
index d4db45b0..a2925c1e 100644
--- a/src/pulse/channelmap.h
+++ b/src/pulse/channelmap.h
@@ -325,6 +325,10 @@ mapping. I.e. "Stereo", "Surround 7.1" and so on. If the channel
mapping is unknown NULL will be returned. \since 0.9.15 */
const char* pa_channel_map_to_pretty_name(const pa_channel_map *map) PA_GCC_PURE;
+/** Returns TRUE if the specified channel position is available at
+ * least once in the channel map. \since 0.9.16 */
+int pa_channel_map_has_position(const pa_channel_map *map, pa_channel_position_t p) PA_GCC_PURE;
+
PA_C_DECL_END
#endif