summaryrefslogtreecommitdiffstats
path: root/src/pulse/channelmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pulse/channelmap.c')
-rw-r--r--src/pulse/channelmap.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/src/pulse/channelmap.c b/src/pulse/channelmap.c
index 2b8ef2b0..7348b32e 100644
--- a/src/pulse/channelmap.c
+++ b/src/pulse/channelmap.c
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of PulseAudio.
@@ -36,7 +34,7 @@
#include "channelmap.h"
-const char *const table[] = {
+const char *const table[PA_CHANNEL_POSITION_MAX] = {
[PA_CHANNEL_POSITION_MONO] = "mono",
[PA_CHANNEL_POSITION_FRONT_CENTER] = "front-center",
@@ -99,7 +97,7 @@ const char *const table[] = {
[PA_CHANNEL_POSITION_TOP_REAR_RIGHT] = "top-rear-right"
};
-const char *const pretty_table[] = {
+const char *const pretty_table[PA_CHANNEL_POSITION_MAX] = {
[PA_CHANNEL_POSITION_MONO] = "Mono",
[PA_CHANNEL_POSITION_FRONT_CENTER] = "Front Center",
@@ -396,6 +394,34 @@ pa_channel_map* pa_channel_map_init_auto(pa_channel_map *m, unsigned channels, p
}
}
+pa_channel_map* pa_channel_map_init_extend(pa_channel_map *m, unsigned channels, pa_channel_map_def_t def) {
+ unsigned c;
+
+ pa_assert(m);
+ pa_assert(channels > 0);
+ pa_assert(channels <= PA_CHANNELS_MAX);
+
+ pa_channel_map_init(m);
+
+ for (c = channels; c > 0; c--) {
+
+ if (pa_channel_map_init_auto(m, c, def)) {
+ unsigned i = 0;
+
+ for (; c < channels; c++) {
+
+ m->map[c] = PA_CHANNEL_POSITION_AUX0 + i;
+ i++;
+ }
+
+ m->channels = channels;
+
+ return m;
+ }
+ }
+
+ return NULL;
+}
const char* pa_channel_position_to_string(pa_channel_position_t pos) {
@@ -531,4 +557,3 @@ int pa_channel_map_valid(const pa_channel_map *map) {
return 1;
}
-