mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-06 13:29:56 -05:00
bluetooth: Add avrcp_absolute_volume module flag for disablement
Not all peers might work fine with Absolute Volume, provide the user with an option to disable it without impairing other AVRCP-related commands like media status and playback controls. Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/239>
This commit is contained in:
parent
25426bc029
commit
d9db47bdb5
4 changed files with 51 additions and 6 deletions
|
|
@ -41,6 +41,7 @@ PA_MODULE_USAGE(
|
|||
"output_rate_refresh_interval_ms=<interval between attempts to improve output rate in milliseconds>"
|
||||
"enable_native_hsp_hs=<boolean, enable HSP support in native backend>"
|
||||
"enable_native_hfp_hf=<boolean, enable HFP support in native backend>"
|
||||
"avrcp_absolute_volume=<synchronize volume with peer, true by default>"
|
||||
);
|
||||
|
||||
static const char* const valid_modargs[] = {
|
||||
|
|
@ -50,6 +51,7 @@ static const char* const valid_modargs[] = {
|
|||
"output_rate_refresh_interval_ms",
|
||||
"enable_native_hsp_hs",
|
||||
"enable_native_hfp_hf",
|
||||
"avrcp_absolute_volume",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
@ -60,6 +62,7 @@ struct userdata {
|
|||
pa_hook_slot *device_connection_changed_slot;
|
||||
pa_bluetooth_discovery *discovery;
|
||||
bool autodetect_mtu;
|
||||
bool avrcp_absolute_volume;
|
||||
uint32_t output_rate_refresh_interval_ms;
|
||||
};
|
||||
|
||||
|
|
@ -83,8 +86,12 @@ static pa_hook_result_t device_connection_changed_cb(pa_bluetooth_discovery *y,
|
|||
if (!module_loaded && pa_bluetooth_device_any_transport_connected(d)) {
|
||||
/* a new device has been connected */
|
||||
pa_module *m;
|
||||
char *args = pa_sprintf_malloc("path=%s autodetect_mtu=%i output_rate_refresh_interval_ms=%u",
|
||||
d->path, (int)u->autodetect_mtu, u->output_rate_refresh_interval_ms);
|
||||
char *args = pa_sprintf_malloc("path=%s autodetect_mtu=%i output_rate_refresh_interval_ms=%u"
|
||||
" avrcp_absolute_volume=%i",
|
||||
d->path,
|
||||
(int)u->autodetect_mtu,
|
||||
u->output_rate_refresh_interval_ms,
|
||||
(int)u->avrcp_absolute_volume);
|
||||
|
||||
pa_log_debug("Loading module-bluez5-device %s", args);
|
||||
pa_module_load(&m, u->module->core, "module-bluez5-device", args);
|
||||
|
|
@ -116,6 +123,7 @@ int pa__init(pa_module *m) {
|
|||
int headset_backend;
|
||||
bool autodetect_mtu;
|
||||
bool enable_msbc;
|
||||
bool avrcp_absolute_volume;
|
||||
uint32_t output_rate_refresh_interval_ms;
|
||||
bool enable_native_hsp_hs;
|
||||
bool enable_native_hfp_hf;
|
||||
|
|
@ -161,6 +169,12 @@ int pa__init(pa_module *m) {
|
|||
goto fail;
|
||||
}
|
||||
|
||||
avrcp_absolute_volume = true;
|
||||
if (pa_modargs_get_value_boolean(ma, "avrcp_absolute_volume", &avrcp_absolute_volume) < 0) {
|
||||
pa_log("avrcp_absolute_volume must be true or false");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
output_rate_refresh_interval_ms = DEFAULT_OUTPUT_RATE_REFRESH_INTERVAL_MS;
|
||||
if (pa_modargs_get_value_u32(ma, "output_rate_refresh_interval_ms", &output_rate_refresh_interval_ms) < 0) {
|
||||
pa_log("Invalid value for output_rate_refresh_interval parameter.");
|
||||
|
|
@ -171,6 +185,7 @@ int pa__init(pa_module *m) {
|
|||
u->module = m;
|
||||
u->core = m->core;
|
||||
u->autodetect_mtu = autodetect_mtu;
|
||||
u->avrcp_absolute_volume = avrcp_absolute_volume;
|
||||
u->output_rate_refresh_interval_ms = output_rate_refresh_interval_ms;
|
||||
u->loaded_device_paths = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue