[pulseaudio-discuss] [PATCH 3/3] message-handler: Send signal on handler events
Georg Chini
georg at chini.tk
Mon Oct 30 15:00:23 UTC 2017
Signals are used to notify clients when a messge handler was added/removed
or when the description changes.
---
src/pulsecore/message-handler.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/pulsecore/message-handler.c b/src/pulsecore/message-handler.c
index 8f8830d6..b6505dc9 100644
--- a/src/pulsecore/message-handler.c
+++ b/src/pulsecore/message-handler.c
@@ -71,6 +71,9 @@ void pa_message_handler_register(pa_core *c, const char *recipient_name, const c
handler->description = pa_xstrdup(description);
pa_assert_se(pa_hashmap_put(c->message_handlers, handler->recipient, (void *) handler) == 0);
+
+ /* Notify clients that a new handler was added. */
+ pa_signal_post(c, "message-api", 1, "handler-added", recipient_name);
}
/* Unregister a message handler */
@@ -85,6 +88,9 @@ void pa_message_handler_unregister(pa_core *c, const char *recipient_name) {
pa_xfree(handler->recipient);
pa_xfree(handler->description);
pa_xfree(handler);
+
+ /* Notify clients that a handler was removed. */
+ pa_signal_post(c, "message-api", 1, "handler-removed", recipient_name);
}
/* Send a message to a recipient or recipient group */
@@ -124,6 +130,9 @@ int pa_message_handler_set_description(pa_core *c, const char *recipient_name, c
pa_xfree(handler->description);
handler->description = pa_xstrdup(description);
+ /* Notify clients that a handler description changed. */
+ pa_signal_post(c, "message-api", 1, "handler-changed", recipient_name);
+
return PA_OK;
}
--
2.14.1
More information about the pulseaudio-discuss
mailing list