summaryrefslogtreecommitdiffstats
path: root/audio/pcm_bluetooth.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2007-08-29 21:35:39 +0000
committerLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2007-08-29 21:35:39 +0000
commit41b71b230e0aa4b495c091e7d17c6b939ddbce79 (patch)
tree171620f6b798d846824be31bbfcfedaba8efb87b /audio/pcm_bluetooth.c
parent87bb7258bdf221195d010b0e03cda7cd7c0195b9 (diff)
Fix the need to have all parameters.
Diffstat (limited to 'audio/pcm_bluetooth.c')
-rw-r--r--audio/pcm_bluetooth.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/audio/pcm_bluetooth.c b/audio/pcm_bluetooth.c
index c6dc0931..8ba18464 100644
--- a/audio/pcm_bluetooth.c
+++ b/audio/pcm_bluetooth.c
@@ -898,8 +898,10 @@ static int bluetooth_cfg_init(struct ipc_packet *pkt, snd_config_t *conf)
struct ipc_data_cfg *cfg = (void *) pkt->data;
struct ipc_codec_sbc *sbc = (void *) cfg->data;
snd_config_iterator_t i, next;
- const char *addr, *pref, *mode, *allocation, *rate, *channels,
- *subbands, *blocks, *bitpool;
+ const char *addr, *pref, *mode, *allocation, *rate, *subbands,
+ *blocks, *bitpool;
+
+ cfg->channels = 2;
snd_config_for_each(i, next, conf) {
snd_config_t *n = snd_config_iterator_entry(i);
@@ -930,8 +932,10 @@ static int bluetooth_cfg_init(struct ipc_packet *pkt, snd_config_t *conf)
if (strcmp(pref, "auto") == 0)
pkt->role = PKT_ROLE_AUTO;
else if (strcmp(pref, "voice") == 0 ||
- strcmp(pref, "hfp") == 0)
+ strcmp(pref, "hfp") == 0) {
pkt->role = PKT_ROLE_VOICE;
+ cfg->channels = 1;
+ }
else if (strcmp(pref, "hifi") == 0 ||
strcmp(pref, "a2dp") == 0)
pkt->role = PKT_ROLE_HIFI;
@@ -948,30 +952,23 @@ static int bluetooth_cfg_init(struct ipc_packet *pkt, snd_config_t *conf)
continue;
}
- if (strcmp(id, "channels") == 0) {
- if (snd_config_get_string(n, &channels) < 0) {
- SNDERR("Invalid type for %s", id);
- return -EINVAL;
- }
-
- cfg->channels = strtod(channels, NULL);
- continue;
- }
-
- if (strcmp(id, "channel_mode") == 0) {
+ if (strcmp(id, "mode") == 0) {
if (snd_config_get_string(n, &mode) < 0) {
SNDERR("Invalid type for %s", id);
return -EINVAL;
}
- if (strcmp(pref, "mono") == 0)
+ if (strcmp(pref, "mono") == 0) {
+ cfg->channels = 1;
cfg->channel_mode = CFG_CHANNEL_MODE_MONO;
+ }
else if (strcmp(pref, "dual") == 0)
cfg->channel_mode = CFG_CHANNEL_MODE_DUAL_CHANNEL;
else if (strcmp(pref, "stereo") == 0)
cfg->channel_mode = CFG_CHANNEL_MODE_STEREO;
else if (strcmp(pref, "joint") == 0)
cfg->channel_mode = CFG_CHANNEL_MODE_JOINT_STEREO;
+
continue;
}