diff options
author | Mikel Astiz <mikel.astiz@bmw-carit.de> | 2012-10-22 10:46:42 +0200 |
---|---|---|
committer | Tanu Kaskinen <tanuk@iki.fi> | 2012-10-23 11:56:13 +0300 |
commit | bb038f76af401ee341b801bff38c30ac2073bbdb (patch) | |
tree | 06c2a20cd811722d217122b992274c54d2a08a26 | |
parent | e3d3a232e36103e22911b98dd649f6b18e739089 (diff) |
bluetooth: Refactor code to create profile ports
Put the created ports in a hashmap, but not necessarily inside a struct
pa_card_new_data.
-rw-r--r-- | src/modules/bluetooth/module-bluetooth-device.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c index 980b9210..8c2efa49 100644 --- a/src/modules/bluetooth/module-bluetooth-device.c +++ b/src/modules/bluetooth/module-bluetooth-device.c @@ -2237,7 +2237,7 @@ off: return -PA_ERR_IO; } -static void create_ports_for_profile(struct userdata *u, pa_card_new_data *card_new_data, pa_card_profile *profile) { +static void create_ports_for_profile(struct userdata *u, pa_hashmap *ports, pa_card_profile *profile) { pa_bluetooth_device *device = u->device; pa_device_port *port; enum profile *d; @@ -2247,7 +2247,7 @@ static void create_ports_for_profile(struct userdata *u, pa_card_new_data *card_ switch (*d) { case PROFILE_A2DP: pa_assert_se(port = pa_device_port_new(u->core, "a2dp-output", _("Bluetooth High Quality (A2DP)"), 0)); - pa_assert_se(pa_hashmap_put(card_new_data->ports, port->name, port) >= 0); + pa_assert_se(pa_hashmap_put(ports, port->name, port) >= 0); port->is_output = 1; port->is_input = 0; port->priority = profile->priority * 100; @@ -2257,7 +2257,7 @@ static void create_ports_for_profile(struct userdata *u, pa_card_new_data *card_ case PROFILE_A2DP_SOURCE: pa_assert_se(port = pa_device_port_new(u->core, "a2dp-input", _("Bluetooth High Quality (A2DP)"), 0)); - pa_assert_se(pa_hashmap_put(card_new_data->ports, port->name, port) >= 0); + pa_assert_se(pa_hashmap_put(ports, port->name, port) >= 0); port->is_output = 0; port->is_input = 1; port->priority = profile->priority * 100; @@ -2267,7 +2267,7 @@ static void create_ports_for_profile(struct userdata *u, pa_card_new_data *card_ case PROFILE_HSP: pa_assert_se(port = pa_device_port_new(u->core, "hsp-output", _("Bluetooth Telephony (HSP/HFP)"), 0)); - pa_assert_se(pa_hashmap_put(card_new_data->ports, port->name, port) >= 0); + pa_assert_se(pa_hashmap_put(ports, port->name, port) >= 0); port->is_output = 1; port->is_input = 0; port->priority = profile->priority * 100; @@ -2275,7 +2275,7 @@ static void create_ports_for_profile(struct userdata *u, pa_card_new_data *card_ pa_hashmap_put(port->profiles, profile->name, profile); pa_assert_se(port = pa_device_port_new(u->core, "hsp-input", _("Bluetooth Telephony (HSP/HFP)"), 0)); - pa_assert_se(pa_hashmap_put(card_new_data->ports, port->name, port) >= 0); + pa_assert_se(pa_hashmap_put(ports, port->name, port) >= 0); port->is_output = 0; port->is_input = 1; port->priority = profile->priority * 100; @@ -2285,7 +2285,7 @@ static void create_ports_for_profile(struct userdata *u, pa_card_new_data *card_ case PROFILE_HFGW: pa_assert_se(port = pa_device_port_new(u->core, "hfgw-output", _("Bluetooth Handsfree Gateway"), 0)); - pa_assert_se(pa_hashmap_put(card_new_data->ports, port->name, port) >= 0); + pa_assert_se(pa_hashmap_put(ports, port->name, port) >= 0); port->is_output = 1; port->is_input = 0; port->priority = profile->priority * 100; @@ -2293,7 +2293,7 @@ static void create_ports_for_profile(struct userdata *u, pa_card_new_data *card_ pa_hashmap_put(port->profiles, profile->name, profile); pa_assert_se(port = pa_device_port_new(u->core, "hfgw-input", _("Bluetooth Handsfree Gateway"), 0)); - pa_assert_se(pa_hashmap_put(card_new_data->ports, port->name, port) >= 0); + pa_assert_se(pa_hashmap_put(ports, port->name, port) >= 0); port->is_output = 0; port->is_input = 1; port->priority = profile->priority * 100; @@ -2409,7 +2409,7 @@ static int add_card(struct userdata *u) { } pa_hashmap_put(data.profiles, p->name, p); - create_ports_for_profile(u, &data, p); + create_ports_for_profile(u, data.ports, p); } pa_assert(!pa_hashmap_isempty(data.profiles)); |