mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
bluetooth: Move profile_to_string() to bluetooth-util
Move the function to the utility library where the enum is defined. At same time avoid using the default clause in order to make sure the compiler will complain if the enum type gets extended.
This commit is contained in:
parent
d6d6770a04
commit
f5a4626ffb
3 changed files with 22 additions and 19 deletions
|
|
@ -1654,21 +1654,6 @@ static void connect_ports(struct userdata *u, void *sink_or_source_new_data, pa_
|
|||
}
|
||||
}
|
||||
|
||||
static const char *profile_to_string(enum profile profile) {
|
||||
switch(profile) {
|
||||
case PROFILE_A2DP:
|
||||
return "a2dp";
|
||||
case PROFILE_A2DP_SOURCE:
|
||||
return "a2dp_source";
|
||||
case PROFILE_HSP:
|
||||
return "hsp";
|
||||
case PROFILE_HFGW:
|
||||
return "hfgw";
|
||||
default:
|
||||
pa_assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
static int sink_set_port_cb(pa_sink *s, pa_device_port *p) {
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1688,7 +1673,7 @@ static int add_sink(struct userdata *u) {
|
|||
|
||||
u->sink = u->hsp.sco_sink;
|
||||
p = pa_proplist_new();
|
||||
pa_proplist_sets(p, "bluetooth.protocol", profile_to_string(u->profile));
|
||||
pa_proplist_sets(p, "bluetooth.protocol", pa_bt_profile_to_string(u->profile));
|
||||
pa_proplist_update(u->sink->proplist, PA_UPDATE_MERGE, p);
|
||||
pa_proplist_free(p);
|
||||
} else {
|
||||
|
|
@ -1699,7 +1684,7 @@ static int add_sink(struct userdata *u) {
|
|||
data.driver = __FILE__;
|
||||
data.module = u->module;
|
||||
pa_sink_new_data_set_sample_spec(&data, &u->sample_spec);
|
||||
pa_proplist_sets(data.proplist, "bluetooth.protocol", profile_to_string(u->profile));
|
||||
pa_proplist_sets(data.proplist, "bluetooth.protocol", pa_bt_profile_to_string(u->profile));
|
||||
if (u->profile == PROFILE_HSP)
|
||||
pa_proplist_sets(data.proplist, PA_PROP_DEVICE_INTENDED_ROLES, "phone");
|
||||
data.card = u->card;
|
||||
|
|
@ -1760,7 +1745,7 @@ static int add_source(struct userdata *u) {
|
|||
|
||||
if (USE_SCO_OVER_PCM(u)) {
|
||||
u->source = u->hsp.sco_source;
|
||||
pa_proplist_sets(u->source->proplist, "bluetooth.protocol", profile_to_string(u->profile));
|
||||
pa_proplist_sets(u->source->proplist, "bluetooth.protocol", pa_bt_profile_to_string(u->profile));
|
||||
} else {
|
||||
pa_source_new_data data;
|
||||
pa_bool_t b;
|
||||
|
|
@ -1769,7 +1754,7 @@ static int add_source(struct userdata *u) {
|
|||
data.driver = __FILE__;
|
||||
data.module = u->module;
|
||||
pa_source_new_data_set_sample_spec(&data, &u->sample_spec);
|
||||
pa_proplist_sets(data.proplist, "bluetooth.protocol", profile_to_string(u->profile));
|
||||
pa_proplist_sets(data.proplist, "bluetooth.protocol", pa_bt_profile_to_string(u->profile));
|
||||
if (u->profile == PROFILE_HSP)
|
||||
pa_proplist_sets(data.proplist, PA_PROP_DEVICE_INTENDED_ROLES, "phone");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue