mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04:00
card: some modernizations
This commit is contained in:
parent
dda0f5a71a
commit
325c01bdbc
2 changed files with 8 additions and 10 deletions
|
|
@ -148,15 +148,12 @@ pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) {
|
||||||
c->save_profile = data->save_profile;
|
c->save_profile = data->save_profile;
|
||||||
|
|
||||||
if (!c->active_profile && c->profiles) {
|
if (!c->active_profile && c->profiles) {
|
||||||
void *state = NULL;
|
void *state;
|
||||||
pa_card_profile *p;
|
pa_card_profile *p;
|
||||||
|
|
||||||
while ((p = pa_hashmap_iterate(c->profiles, &state, NULL))) {
|
PA_HASHMAP_FOREACH(p, c->profiles, state)
|
||||||
if (!c->active_profile ||
|
if (!c->active_profile || p->priority > c->active_profile->priority)
|
||||||
p->priority > c->active_profile->priority)
|
|
||||||
|
|
||||||
c->active_profile = p;
|
c->active_profile = p;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
c->userdata = NULL;
|
c->userdata = NULL;
|
||||||
|
|
@ -177,7 +174,6 @@ pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) {
|
||||||
|
|
||||||
void pa_card_free(pa_card *c) {
|
void pa_card_free(pa_card *c) {
|
||||||
pa_core *core;
|
pa_core *core;
|
||||||
pa_card_profile *profile;
|
|
||||||
|
|
||||||
pa_assert(c);
|
pa_assert(c);
|
||||||
pa_assert(c->core);
|
pa_assert(c->core);
|
||||||
|
|
@ -200,8 +196,10 @@ void pa_card_free(pa_card *c) {
|
||||||
pa_idxset_free(c->sources, NULL, NULL);
|
pa_idxset_free(c->sources, NULL, NULL);
|
||||||
|
|
||||||
if (c->profiles) {
|
if (c->profiles) {
|
||||||
while ((profile = pa_hashmap_steal_first(c->profiles)))
|
pa_card_profile *p;
|
||||||
pa_card_profile_free(profile);
|
|
||||||
|
while ((p = pa_hashmap_steal_first(c->profiles)))
|
||||||
|
pa_card_profile_free(p);
|
||||||
|
|
||||||
pa_hashmap_free(c->profiles, NULL, NULL);
|
pa_hashmap_free(c->profiles, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ struct pa_card {
|
||||||
pa_hashmap *profiles;
|
pa_hashmap *profiles;
|
||||||
pa_card_profile *active_profile;
|
pa_card_profile *active_profile;
|
||||||
|
|
||||||
pa_bool_t save_profile;
|
pa_bool_t save_profile:1;
|
||||||
|
|
||||||
void *userdata;
|
void *userdata;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue