summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/card.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-01-17 02:03:35 +0100
committerLennart Poettering <lennart@poettering.net>2009-01-17 02:03:35 +0100
commitc06e43d7ff5eff33af416a35ef4ca962a0cc0a2e (patch)
tree2d8d2efe4313c1c94252fbe65ab3ce54ba554cf2 /src/pulsecore/card.c
parentc560aea4c9668c751a96460a52f7a981eef60572 (diff)
actually create pa_card object in module-alsa-card
Diffstat (limited to 'src/pulsecore/card.c')
-rw-r--r--src/pulsecore/card.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/pulsecore/card.c b/src/pulsecore/card.c
index 99c0cc55..ec4a50c5 100644
--- a/src/pulsecore/card.c
+++ b/src/pulsecore/card.c
@@ -36,13 +36,14 @@
#include "card.h"
-pa_card_profile *pa_card_profile_new(const char *name) {
+pa_card_profile *pa_card_profile_new(const char *name, const char *description, size_t extra) {
pa_card_profile *c;
pa_assert(name);
- c = pa_xnew0(pa_card_profile, 1);
+ c = pa_xmalloc(PA_ALIGN(sizeof(pa_card_profile)) + extra);
c->name = pa_xstrdup(name);
+ c->description = pa_xstrdup(description);
return c;
}
@@ -51,6 +52,7 @@ void pa_card_profile_free(pa_card_profile *c) {
pa_assert(c);
pa_xfree(c->name);
+ pa_xfree(c->description);
pa_xfree(c);
}
@@ -122,7 +124,9 @@ pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) {
c->profiles = data->profiles;
data->profiles = NULL;
- c->active_profile = data->active_profile;
+ if (!(c->active_profile = data->active_profile))
+ if (c->profiles)
+ c->active_profile = pa_hashmap_first(c->profiles);
data->active_profile = NULL;
c->userdata = NULL;
@@ -189,6 +193,9 @@ int pa_card_set_profile(pa_card *c, const char *name) {
if (!(profile = pa_hashmap_get(c->profiles, name)))
return -1;
+ if (c->active_profile == profile)
+ return 0;
+
if (c->set_profile(c, profile) < 0)
return -1;