From 3000db038165ce2ba10e9fce18421750196c9737 Mon Sep 17 00:00:00 2001 From: Rinat Ibragimov Date: Sat, 19 Dec 2015 21:52:16 +0300 Subject: [PATCH] impl pa_channel_position_from_string --- src/apulse-channel-map.c | 19 +++++++++++++++++++ src/notimplemented.c | 7 ------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/apulse-channel-map.c b/src/apulse-channel-map.c index b9120e0..73db658 100644 --- a/src/apulse-channel-map.c +++ b/src/apulse-channel-map.c @@ -174,6 +174,25 @@ pa_channel_map_valid(const pa_channel_map *map) return 1; } +APULSE_EXPORT +pa_channel_position_t +pa_channel_position_from_string(const char *s) +{ + trace_info("F %s s=%s\n", __func__, s); + + if (!s) + return PA_CHANNEL_POSITION_INVALID; + + for (unsigned int k = 0; k < PA_CHANNEL_POSITION_MAX; k ++) { + if (!channel_name[k]) + continue; + if (strcmp(channel_name[k], s) == 0) + return k; + } + + return PA_CHANNEL_POSITION_INVALID; +} + APULSE_EXPORT const char * pa_channel_position_to_string(pa_channel_position_t pos) diff --git a/src/notimplemented.c b/src/notimplemented.c index 197d6c3..31580a6 100644 --- a/src/notimplemented.c +++ b/src/notimplemented.c @@ -187,13 +187,6 @@ pa_channel_map* pa_channel_map_init(pa_channel_map *m) return NULL; } -APULSE_EXPORT -pa_channel_position_t pa_channel_position_from_string(const char *s) -{ - trace_info("Z %s\n", __func__); - return 0; -} - APULSE_EXPORT const char* pa_channel_position_to_pretty_string(pa_channel_position_t pos) {