[pulseaudio-commits] 4 commits - src/pulsecore
Tanu Kaskinen
tanuk at kemper.freedesktop.org
Sun Jan 20 01:51:39 PST 2013
src/pulsecore/card.c | 10 +++++++++-
src/pulsecore/core.h | 1 +
src/pulsecore/device-port.c | 26 ++++----------------------
src/pulsecore/device-port.h | 2 ++
4 files changed, 16 insertions(+), 23 deletions(-)
New commits:
commit 477d6b71b68bc00224e880e2cd99f0498917171e
Author: poljar (Damir JeliÄ) <poljarinho at gmail.com>
Date: Thu Jan 17 20:55:17 2013 +0100
device-port: Fire a hook when the latency offset changes.
This change adds a new hook type: PA_CORE_HOOK_PORT_LATENCY_OFFSET_CHANGED
And it is fired when the port latency offset changes.
diff --git a/src/pulsecore/core.h b/src/pulsecore/core.h
index cf7cc11..2099bb0 100644
--- a/src/pulsecore/core.h
+++ b/src/pulsecore/core.h
@@ -116,6 +116,7 @@ typedef enum pa_core_hook {
PA_CORE_HOOK_CARD_PROFILE_ADDED,
PA_CORE_HOOK_PORT_AVAILABLE_CHANGED,
PA_CORE_HOOK_PORT_ADDED,
+ PA_CORE_HOOK_PORT_LATENCY_OFFSET_CHANGED,
PA_CORE_HOOK_MAX
} pa_core_hook_t;
diff --git a/src/pulsecore/device-port.c b/src/pulsecore/device-port.c
index 4ca26d9..fa78e08 100644
--- a/src/pulsecore/device-port.c
+++ b/src/pulsecore/device-port.c
@@ -127,4 +127,5 @@ void pa_device_port_set_latency_offset(pa_device_port *p, int64_t offset) {
pa_assert_se(core = p->core);
pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_CHANGE, p->card->index);
+ pa_hook_fire(&core->hooks[PA_CORE_HOOK_PORT_LATENCY_OFFSET_CHANGED], p);
}
commit 56a356180355c8c7fc5f0b410a460bc0387e866c
Author: poljar (Damir JeliÄ) <poljarinho at gmail.com>
Date: Thu Jan 17 20:55:16 2013 +0100
device-port: Cleanup of the sink/source subscription events.
Since it's now decided that we deprecated port info for sinks and
sources this isn't needed anymore.
diff --git a/src/pulsecore/device-port.c b/src/pulsecore/device-port.c
index 93e539a..4ca26d9 100644
--- a/src/pulsecore/device-port.c
+++ b/src/pulsecore/device-port.c
@@ -28,9 +28,6 @@ PA_DEFINE_PUBLIC_CLASS(pa_device_port, pa_object);
void pa_device_port_set_available(pa_device_port *p, pa_port_available_t status)
{
-/* uint32_t state;
- pa_source *source;
- pa_sink *sink; */
pa_core *core;
pa_assert(p);
@@ -47,17 +44,6 @@ void pa_device_port_set_available(pa_device_port *p, pa_port_available_t status)
/* Post subscriptions to the card which owns us */
pa_assert_se(core = p->core);
pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_CHANGE, p->card->index);
-#if 0
-/* This stuff is temporarily commented out while figuring out whether to actually do this */
- if (p->is_output)
- PA_IDXSET_FOREACH(sink, core->sinks, state)
- if (p == pa_hashmap_get(sink->ports, p->name))
- pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_SINK|PA_SUBSCRIPTION_EVENT_CHANGE, sink->index);
- if (p->is_input)
- PA_IDXSET_FOREACH(source, core->sources, state)
- if (p == pa_hashmap_get(source->ports, p->name))
- pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_SOURCE|PA_SUBSCRIPTION_EVENT_CHANGE, source->index);
-#endif
pa_hook_fire(&core->hooks[PA_CORE_HOOK_PORT_AVAILABLE_CHANGED], p);
}
commit f8f3690ae9ab68e64647229b98c1cf82e039a110
Author: poljar (Damir JeliÄ) <poljarinho at gmail.com>
Date: Thu Jan 17 20:55:15 2013 +0100
device-port: Access the cards directly.
Since the ports now know which card owns them we don't need to iterate
through all of them anymore.
diff --git a/src/pulsecore/device-port.c b/src/pulsecore/device-port.c
index cb6fa98..93e539a 100644
--- a/src/pulsecore/device-port.c
+++ b/src/pulsecore/device-port.c
@@ -28,9 +28,8 @@ PA_DEFINE_PUBLIC_CLASS(pa_device_port, pa_object);
void pa_device_port_set_available(pa_device_port *p, pa_port_available_t status)
{
- uint32_t state;
- pa_card *card;
-/* pa_source *source;
+/* uint32_t state;
+ pa_source *source;
pa_sink *sink; */
pa_core *core;
@@ -47,9 +46,7 @@ void pa_device_port_set_available(pa_device_port *p, pa_port_available_t status)
/* Post subscriptions to the card which owns us */
pa_assert_se(core = p->core);
- PA_IDXSET_FOREACH(card, core->cards, state)
- if (p == pa_hashmap_get(card->ports, p->name))
- pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_CHANGE, card->index);
+ pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_CHANGE, p->card->index);
#if 0
/* This stuff is temporarily commented out while figuring out whether to actually do this */
if (p->is_output)
@@ -118,7 +115,6 @@ void pa_device_port_hashmap_free(pa_hashmap *h) {
void pa_device_port_set_latency_offset(pa_device_port *p, int64_t offset) {
uint32_t state;
pa_core *core;
- pa_card *card;
pa_assert(p);
@@ -144,7 +140,5 @@ void pa_device_port_set_latency_offset(pa_device_port *p, int64_t offset) {
}
pa_assert_se(core = p->core);
- PA_IDXSET_FOREACH(card, core->cards, state)
- if (p == pa_hashmap_get(card->ports, p->name))
- pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_CHANGE, card->index);
+ pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_CHANGE, p->card->index);
}
commit 9d6eb21c7edf2bdeb737fab4d00069efb6cbd1e1
Author: poljar (Damir JeliÄ) <poljarinho at gmail.com>
Date: Thu Jan 17 20:55:14 2013 +0100
device-port: Add a card pointer to the ports.
This way we can directly access the card that owns the port instead of
iterating over all cards.
diff --git a/src/pulsecore/card.c b/src/pulsecore/card.c
index 1cde297..3077193 100644
--- a/src/pulsecore/card.c
+++ b/src/pulsecore/card.c
@@ -102,8 +102,10 @@ void pa_card_add_ports(pa_card *c, pa_hashmap *ports) {
pa_assert(ports);
/* take ownership of the ports */
- PA_HASHMAP_FOREACH(p, ports, state)
+ PA_HASHMAP_FOREACH(p, ports, state) {
+ p->card = c;
pa_assert_se(pa_hashmap_put(c->ports, p->name, p) >= 0);
+ }
pa_subscription_post(c->core, PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_CHANGE, c->index);
@@ -145,6 +147,7 @@ pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) {
const char *name;
void *state;
pa_card_profile *profile;
+ pa_device_port *port;
pa_core_assert_ref(core);
pa_assert(data);
@@ -188,6 +191,11 @@ pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) {
profile->card = c;
}
+ if (c->ports) {
+ PA_HASHMAP_FOREACH(port, c->ports, state)
+ port->card = c;
+ }
+
c->active_profile = NULL;
c->save_profile = FALSE;
diff --git a/src/pulsecore/device-port.c b/src/pulsecore/device-port.c
index 9ea54e3..cb6fa98 100644
--- a/src/pulsecore/device-port.c
+++ b/src/pulsecore/device-port.c
@@ -92,6 +92,7 @@ pa_device_port *pa_device_port_new(pa_core *c, const char *name, const char *des
p->name = pa_xstrdup(name);
p->description = pa_xstrdup(description);
p->core = c;
+ p->card = NULL;
p->priority = 0;
p->available = PA_PORT_AVAILABLE_UNKNOWN;
p->profiles = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
diff --git a/src/pulsecore/device-port.h b/src/pulsecore/device-port.h
index a5c6420..cea00e6 100644
--- a/src/pulsecore/device-port.h
+++ b/src/pulsecore/device-port.h
@@ -36,10 +36,12 @@ typedef struct pa_device_port pa_device_port;
#include <pulsecore/object.h>
#include <pulsecore/hashmap.h>
#include <pulsecore/core.h>
+#include <pulsecore/card.h>
struct pa_device_port {
pa_object parent; /* Needed for reference counting */
pa_core *core;
+ pa_card *card;
char *name;
char *description;
More information about the pulseaudio-commits
mailing list