a2dp: set channel map

This commit is contained in:
Wim Taymans 2020-12-09 18:08:24 +01:00
parent 29fe356fdf
commit 34a9b1dc1a
2 changed files with 18 additions and 1 deletions

View file

@ -104,6 +104,7 @@ static int codec_enum_config(const struct a2dp_codec *codec,
a2dp_aptx_t conf;
struct spa_pod_frame f[2];
struct spa_pod_choice *choice;
uint32_t position[SPA_AUDIO_MAX_CHANNELS];
uint32_t i = 0;
if (caps_size < sizeof(conf))
@ -156,12 +157,19 @@ static int codec_enum_config(const struct a2dp_codec *codec,
SPA_FORMAT_AUDIO_channels, SPA_POD_CHOICE_RANGE_Int(2, 1, 2),
0);
} else if (conf.channel_mode & APTX_CHANNEL_MODE_MONO) {
position[0] = SPA_AUDIO_CHANNEL_MONO;
spa_pod_builder_add(b,
SPA_FORMAT_AUDIO_channels, SPA_POD_Int(1),
SPA_FORMAT_AUDIO_position, SPA_POD_Array(sizeof(uint32_t),
SPA_TYPE_Id, 1, position),
0);
} else if (conf.channel_mode & APTX_CHANNEL_MODE_STEREO) {
position[0] = SPA_AUDIO_CHANNEL_FL;
position[1] = SPA_AUDIO_CHANNEL_FR;
spa_pod_builder_add(b,
SPA_FORMAT_AUDIO_channels, SPA_POD_Int(2),
SPA_FORMAT_AUDIO_position, SPA_POD_Array(sizeof(uint32_t),
SPA_TYPE_Id, 2, position),
0);
} else
return -EINVAL;