bluetooth: Add support for getting current active codec

For example, using the following on the command line will return the
current codec for a bluetooth device

pacmd send-message /card/bluez_card.4C_BC_98_80_01_9B/bluez get-codec

where 4C_BC_98_80_01_9B is the bluetooth device.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/440>
This commit is contained in:
Sanchayan Maity 2021-01-01 11:48:11 +05:30
parent 4ce996b74a
commit 6044169763

View file

@ -2418,6 +2418,18 @@ static int bluez5_device_message_handler(const char *object_path, const char *me
return PA_OK;
} else if (pa_streq(message, "list-codecs")) {
*response = list_codecs(u);
return PA_OK;
} else if (pa_streq(message, "get-codec")) {
pa_message_params *param;
param = pa_message_params_new();
if (u->a2dp_codec)
pa_message_params_write_string(param, u->a2dp_codec->name);
else
pa_message_params_write_string(param, "none");
*response = pa_message_params_to_string_free(param);
return PA_OK;
}