diff options
author | Lennart Poettering <lennart@poettering.net> | 2008-06-18 23:42:14 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2008-06-18 23:42:14 +0200 |
commit | 132e73b2efbda60919db355d6baa3d9687103e0f (patch) | |
tree | 5df6888cf5eac237f2250feb3960fe35dd1af41e /src/pulse/channelmap.c | |
parent | b95cf5203050d9af1aa44aff2edad9650ee0ff9a (diff) |
add new API pa_channel_map_init_extend() to synthesize a channel map if noone is known
Diffstat (limited to 'src/pulse/channelmap.c')
-rw-r--r-- | src/pulse/channelmap.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/pulse/channelmap.c b/src/pulse/channelmap.c index 55fc5ee6..7348b32e 100644 --- a/src/pulse/channelmap.c +++ b/src/pulse/channelmap.c @@ -394,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) { |