[pulseaudio-discuss] [[PATCH v0] 4/5] device-port: Fire a hook when creating a new port.
poljar (Damir Jelić)
poljarinho at gmail.com
Wed Apr 17 17:24:07 PDT 2013
This adds a new hook: PA_HOOK_PORT_NEW
---
src/pulsecore/core.h | 1 +
src/pulsecore/device-port.c | 5 +++++
2 files changed, 6 insertions(+)
diff --git a/src/pulsecore/core.h b/src/pulsecore/core.h
index a8cff5c..2f75b56 100644
--- a/src/pulsecore/core.h
+++ b/src/pulsecore/core.h
@@ -119,6 +119,7 @@ typedef enum pa_core_hook {
PA_CORE_HOOK_CARD_PROFILE_AVAILABLE_CHANGED,
PA_CORE_HOOK_PORT_AVAILABLE_CHANGED,
PA_CORE_HOOK_PORT_LATENCY_OFFSET_CHANGED,
+ PA_CORE_HOOK_PORT_NEW,
PA_CORE_HOOK_MAX
} pa_core_hook_t;
diff --git a/src/pulsecore/device-port.c b/src/pulsecore/device-port.c
index b771d23..6b8a62b 100644
--- a/src/pulsecore/device-port.c
+++ b/src/pulsecore/device-port.c
@@ -132,6 +132,11 @@ pa_device_port *pa_device_port_new(pa_core *c, pa_device_port_new_data *data, si
p = PA_DEVICE_PORT(pa_object_new_internal(PA_ALIGN(sizeof(pa_device_port)) + extra, pa_device_port_type_id, pa_device_port_check_type));
p->parent.free = device_port_free;
+ if (pa_hook_fire(&c->hooks[PA_CORE_HOOK_PORT_NEW], data) < 0) {
+ pa_xfree(p);
+ return NULL;
+ }
+
p->name = data->name;
data->name = NULL;
p->description = data->description;
--
1.8.2.1
More information about the pulseaudio-discuss
mailing list