]> code.delx.au - pulseaudio/commitdiff
export pa_channel_map_superset()
authorLennart Poettering <lennart@poettering.net>
Tue, 20 Jan 2009 20:00:35 +0000 (21:00 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 20 Jan 2009 20:37:23 +0000 (21:37 +0100)
src/map-file
src/modules/alsa/alsa-util.c
src/pulse/channelmap.c
src/pulse/channelmap.h

index 042e2adb2e252c93afb8f9c9070c389696ff823f..55b13e13f45287d039bc8b3bb860ab5155ed5fd2 100644 (file)
@@ -18,6 +18,7 @@ pa_channel_map_init_mono;
 pa_channel_map_init_stereo;
 pa_channel_map_parse;
 pa_channel_map_snprint;
+pa_channel_map_superset;
 pa_channel_map_valid;
 pa_channel_position_to_pretty_string;
 pa_channel_position_to_string;
index eb7042b8197b7bea09357fa8909d57a230a8759a..b7f44b8535432025dc4b4354dc036849e85ae0ec 100644 (file)
@@ -574,25 +574,6 @@ static const struct pa_alsa_profile_info device_table[] = {
     {{ 0, { 0 }}, NULL, NULL, NULL, 0 }
 };
 
-static pa_bool_t 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 FALSE;
-
-    return TRUE;
-}
-
 snd_pcm_t *pa_alsa_open_by_device_id(
         const char *dev_id,
         char **dev,
@@ -629,7 +610,7 @@ snd_pcm_t *pa_alsa_open_by_device_id(
     i = 0;
     for (;;) {
 
-        if ((direction > 0) == channel_map_superset(&device_table[i].map, map)) {
+        if ((direction > 0) == pa_channel_map_superset(&device_table[i].map, map)) {
             pa_sample_spec try_ss;
 
             pa_log_debug("Checking for %s (%s)", device_table[i].name, device_table[i].alsa_name);
index fd313bd3447fcf234e6ac7327d9cf608b4009196..26eae599f9e516c638d59d5caa5fec445823b1bb 100644 (file)
@@ -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;
+}
index d7d19d79e432d2583845edc0f10e37797e15038f..a6c044f1a519c60c6dc78dda674117dc1fee8127 100644 (file)
@@ -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