[pulseaudio-discuss] [PATCH 2/2] pactl: Add signal receiver to pactl

Georg Chini georg at chini.tk
Mon Jul 24 12:19:12 UTC 2017


---
 src/utils/pactl.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/utils/pactl.c b/src/utils/pactl.c
index e9bf005b..8ec76d53 100644
--- a/src/utils/pactl.c
+++ b/src/utils/pactl.c
@@ -1184,6 +1184,17 @@ static void context_subscribe_callback(pa_context *c, pa_subscription_event_type
     fflush(stdout);
 }
 
+static void context_signal_callback(pa_context *c, const char *sender, const char *signal, const char *signal_info, void *userdata) {
+    pa_assert(c);
+
+    printf(_("Signal '%s' from %s\n"),
+           signal,
+           sender);
+    if (signal_info)
+        printf(_("Signal Info: '%s'\n"), signal_info);
+    fflush(stdout);
+}
+
 static void context_state_callback(pa_context *c, void *userdata) {
     pa_operation *o = NULL;
 
@@ -1406,6 +1417,7 @@ static void context_state_callback(pa_context *c, void *userdata) {
 
                 case SUBSCRIBE:
                     pa_context_set_subscribe_callback(c, context_subscribe_callback, NULL);
+                    pa_context_set_signal_callback(c, context_signal_callback, NULL);
 
                     o = pa_context_subscribe(c,
                                              PA_SUBSCRIPTION_MASK_SINK|
@@ -1416,7 +1428,8 @@ static void context_state_callback(pa_context *c, void *userdata) {
                                              PA_SUBSCRIPTION_MASK_CLIENT|
                                              PA_SUBSCRIPTION_MASK_SAMPLE_CACHE|
                                              PA_SUBSCRIPTION_MASK_SERVER|
-                                             PA_SUBSCRIPTION_MASK_CARD,
+                                             PA_SUBSCRIPTION_MASK_CARD|
+                                             PA_SUBSCRIPTION_MASK_SIGNAL,
                                              NULL,
                                              NULL);
                     break;
-- 
2.11.0



More information about the pulseaudio-discuss mailing list