summaryrefslogtreecommitdiffstats
path: root/src/pulse
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-01-20 21:00:35 +0100
committerLennart Poettering <lennart@poettering.net>2009-01-20 21:37:23 +0100
commit04e9214065637a6ad17983d18475eb4e67c2c680 (patch)
tree86fdad5b24d24ec9bcfe75f8375259b6e3c93aed /src/pulse
parent7368a6e6be5dbbdc8e13003ef6841fe3fe1840bc (diff)
export pa_channel_map_superset()
Diffstat (limited to 'src/pulse')
-rw-r--r--src/pulse/channelmap.c19
-rw-r--r--src/pulse/channelmap.h3
2 files changed, 22 insertions, 0 deletions
diff --git a/src/pulse/channelmap.c b/src/pulse/channelmap.c
index fd313bd3..26eae599 100644
--- a/src/pulse/channelmap.c
+++ b/src/pulse/channelmap.c
@@ -577,3 +577,22 @@ int pa_channel_map_compatible(const pa_channel_map *map, const pa_sample_spec *s
return map->channels == ss->channels;
}
+
+int pa_channel_map_superset(const pa_channel_map *a, const pa_channel_map *b) {
+ pa_bool_t in_a[PA_CHANNEL_POSITION_MAX];
+ unsigned i;
+
+ pa_assert(a);
+ pa_assert(b);
+
+ memset(in_a, 0, sizeof(in_a));
+
+ for (i = 0; i < a->channels; i++)
+ in_a[a->map[i]] = TRUE;
+
+ for (i = 0; i < b->channels; i++)
+ if (!in_a[b->map[i]])
+ return 0;
+
+ return 1;
+}
diff --git a/src/pulse/channelmap.h b/src/pulse/channelmap.h
index d7d19d79..a6c044f1 100644
--- a/src/pulse/channelmap.h
+++ b/src/pulse/channelmap.h
@@ -227,6 +227,9 @@ int pa_channel_map_valid(const pa_channel_map *map) PA_GCC_PURE;
* the specified sample spec. \since 0.9.12 */
int pa_channel_map_compatible(const pa_channel_map *map, const pa_sample_spec *ss) PA_GCC_PURE;
+/** Returns non-zero if every channel defined in b is also defined in a. \since 0.9.15 */
+int pa_channel_map_superset(const pa_channel_map *a, const pa_channel_map *b) PA_GCC_PURE;
+
PA_C_DECL_END
#endif