diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2012-08-13 11:31:50 +0300 |
---|---|---|
committer | Jaska Uimonen <jaska.uimonen@intel.com> | 2013-01-24 09:29:36 +0200 |
commit | 3843309ea5657f284d8cecfa29df8da829d42b67 (patch) | |
tree | 93b5c6272d2029face597d41d192613af3816a21 | |
parent | 4069d8c0f2ad5d1190cdbb5d22b982de9065e148 (diff) | |
download | pulseaudio-panda-3843309ea5657f284d8cecfa29df8da829d42b67.tar.gz pulseaudio-panda-3843309ea5657f284d8cecfa29df8da829d42b67.tar.bz2 pulseaudio-panda-3843309ea5657f284d8cecfa29df8da829d42b67.zip |
bluetooth: Set initial profile priority based on profile state
This means only profiles on PA_BT_AUDIO_STATE_PLAYING state will have
bigger priority than 'Off'.
-rw-r--r-- | src/modules/bluetooth/module-bluetooth-device.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c index 99a943b1..1810bfaf 100644 --- a/src/modules/bluetooth/module-bluetooth-device.c +++ b/src/modules/bluetooth/module-bluetooth-device.c @@ -2298,7 +2298,7 @@ static int add_card(struct userdata *u, const pa_bluetooth_device *device) { we are loaded with profile="hsp", for instance */ if (pa_bluetooth_uuid_has(device->uuids, A2DP_SINK_UUID)) { p = pa_card_profile_new("a2dp", _("High Fidelity Playback (A2DP)"), sizeof(enum profile)); - p->priority = 10; + p->priority = device->audio_sink_state * 10; p->n_sinks = 1; p->n_sources = 0; p->max_sink_channels = 2; @@ -2313,6 +2313,7 @@ static int add_card(struct userdata *u, const pa_bluetooth_device *device) { if (pa_bluetooth_uuid_has(device->uuids, A2DP_SOURCE_UUID)) { p = pa_card_profile_new("a2dp_source", _("High Fidelity Capture (A2DP)"), sizeof(enum profile)); + p->priority = device->audio_source_state * 10; p->priority = 10; p->n_sinks = 0; p->n_sources = 1; @@ -2329,7 +2330,7 @@ static int add_card(struct userdata *u, const pa_bluetooth_device *device) { if (pa_bluetooth_uuid_has(device->uuids, HSP_HS_UUID) || pa_bluetooth_uuid_has(device->uuids, HFP_HS_UUID)) { p = pa_card_profile_new("hsp", _("Telephony Duplex (HSP/HFP)"), sizeof(enum profile)); - p->priority = 20; + p->priority = device->headset_state * 10; p->n_sinks = 1; p->n_sources = 1; p->max_sink_channels = 1; @@ -2344,7 +2345,7 @@ static int add_card(struct userdata *u, const pa_bluetooth_device *device) { if (pa_bluetooth_uuid_has(device->uuids, HFP_AG_UUID)) { p = pa_card_profile_new("hfgw", _("Handsfree Gateway"), sizeof(enum profile)); - p->priority = 20; + p->priority = device->hfgw_state * 10; p->n_sinks = 1; p->n_sources = 1; p->max_sink_channels = 1; @@ -2360,6 +2361,7 @@ static int add_card(struct userdata *u, const pa_bluetooth_device *device) { pa_assert(!pa_hashmap_isempty(data.profiles)); p = pa_card_profile_new("off", _("Off"), sizeof(enum profile)); + p->priority = PA_BT_AUDIO_STATE_CONNECTED * 10 + 1; d = PA_CARD_PROFILE_DATA(p); *d = PROFILE_OFF; pa_hashmap_put(data.profiles, p->name, p); |