summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Henningsson <david.henningsson@canonical.com>2011-11-25 15:17:13 +0100
committerTanu Kaskinen <tanuk@iki.fi>2011-11-26 16:46:42 +0200
commit0dced7f2758970b672b8f0d0409c57cddaaaca43 (patch)
treee8227c43fec22573520d87df0174db653ae1345d /src
parentd9685ec85db3722bf3988a64dda4d8ee21c7777b (diff)
downloadpulseaudio-panda-0dced7f2758970b672b8f0d0409c57cddaaaca43.tar.gz
pulseaudio-panda-0dced7f2758970b672b8f0d0409c57cddaaaca43.tar.bz2
pulseaudio-panda-0dced7f2758970b672b8f0d0409c57cddaaaca43.zip
Cards now has ports directly, and device port has list of profiles
This forms the base for being able to expose all ports of all profiles (even inactive ones) to clients. Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Diffstat (limited to 'src')
-rw-r--r--src/pulsecore/card.c10
-rw-r--r--src/pulsecore/card.h4
-rw-r--r--src/pulsecore/device-port.c5
-rw-r--r--src/pulsecore/device-port.h4
4 files changed, 22 insertions, 1 deletions
diff --git a/src/pulsecore/card.c b/src/pulsecore/card.c
index feaa4440..1f12aefe 100644
--- a/src/pulsecore/card.c
+++ b/src/pulsecore/card.c
@@ -34,6 +34,7 @@
#include <pulsecore/macro.h>
#include <pulsecore/core-util.h>
#include <pulsecore/namereg.h>
+#include <pulsecore/device-port.h>
#include "card.h"
@@ -66,7 +67,7 @@ pa_card_new_data* pa_card_new_data_init(pa_card_new_data *data) {
memset(data, 0, sizeof(*data));
data->proplist = pa_proplist_new();
-
+ data->ports = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
return data;
}
@@ -99,6 +100,9 @@ void pa_card_new_data_done(pa_card_new_data *data) {
pa_hashmap_free(data->profiles, NULL, NULL);
}
+ if (data->ports)
+ pa_device_port_hashmap_free(data->ports);
+
pa_xfree(data->name);
pa_xfree(data->active_profile);
}
@@ -139,6 +143,8 @@ pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) {
* copying it here */
c->profiles = data->profiles;
data->profiles = NULL;
+ c->ports = data->ports;
+ data->ports = NULL;
c->active_profile = NULL;
c->save_profile = FALSE;
@@ -195,6 +201,8 @@ void pa_card_free(pa_card *c) {
pa_assert(pa_idxset_isempty(c->sources));
pa_idxset_free(c->sources, NULL, NULL);
+ pa_device_port_hashmap_free(c->ports);
+
if (c->profiles) {
pa_card_profile *p;
diff --git a/src/pulsecore/card.h b/src/pulsecore/card.h
index 2d691b67..6f942e80 100644
--- a/src/pulsecore/card.h
+++ b/src/pulsecore/card.h
@@ -63,6 +63,8 @@ struct pa_card {
pa_hashmap *profiles;
pa_card_profile *active_profile;
+ pa_hashmap *ports;
+
pa_bool_t save_profile:1;
void *userdata;
@@ -80,6 +82,8 @@ typedef struct pa_card_new_data {
pa_hashmap *profiles;
char *active_profile;
+ pa_hashmap *ports;
+
pa_bool_t namereg_fail:1;
pa_bool_t save_profile:1;
diff --git a/src/pulsecore/device-port.c b/src/pulsecore/device-port.c
index 09646ee8..8aeb173c 100644
--- a/src/pulsecore/device-port.c
+++ b/src/pulsecore/device-port.c
@@ -32,6 +32,8 @@ static void device_port_free(pa_object *o) {
pa_assert(p);
pa_assert(pa_device_port_refcnt(p) == 0);
+ if (p->profiles)
+ pa_hashmap_free(p->profiles, NULL, NULL);
pa_xfree(p->name);
pa_xfree(p->description);
pa_xfree(p);
@@ -50,6 +52,9 @@ pa_device_port *pa_device_port_new(const char *name, const char *description, si
p->description = pa_xstrdup(description);
p->priority = 0;
p->available = PA_PORT_AVAILABLE_UNKNOWN;
+ p->profiles = NULL;
+ p->is_input = FALSE;
+ p->is_output = FALSE;
return p;
}
diff --git a/src/pulsecore/device-port.h b/src/pulsecore/device-port.h
index dfe3fc11..f997c771 100644
--- a/src/pulsecore/device-port.h
+++ b/src/pulsecore/device-port.h
@@ -46,6 +46,10 @@ struct pa_device_port {
unsigned priority;
pa_port_available_t available; /* PA_PORT_AVAILABLE_UNKNOWN, PA_PORT_AVAILABLE_NO or PA_PORT_AVAILABLE_YES */
+ pa_hashmap *profiles; /* Can be NULL. Does not own the profiles */
+ pa_bool_t is_input:1;
+ pa_bool_t is_output:1;
+
/* .. followed by some implementation specific data */
};