[pulseaudio-discuss] [PATCH 14/15] sink, source: Add hooks for mute changes

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Tue Apr 15 03:56:15 PDT 2014


---
 src/pulsecore/core.h   | 2 ++
 src/pulsecore/sink.c   | 1 +
 src/pulsecore/source.c | 1 +
 3 files changed, 4 insertions(+)

diff --git a/src/pulsecore/core.h b/src/pulsecore/core.h
index 2276fb9..762157e 100644
--- a/src/pulsecore/core.h
+++ b/src/pulsecore/core.h
@@ -77,6 +77,7 @@ typedef enum pa_core_hook {
     PA_CORE_HOOK_SINK_PORT_CHANGED,
     PA_CORE_HOOK_SINK_FLAGS_CHANGED,
     PA_CORE_HOOK_SINK_VOLUME_CHANGED,
+    PA_CORE_HOOK_SINK_MUTE_CHANGED,
     PA_CORE_HOOK_SOURCE_NEW,
     PA_CORE_HOOK_SOURCE_FIXATE,
     PA_CORE_HOOK_SOURCE_PUT,
@@ -87,6 +88,7 @@ typedef enum pa_core_hook {
     PA_CORE_HOOK_SOURCE_PORT_CHANGED,
     PA_CORE_HOOK_SOURCE_FLAGS_CHANGED,
     PA_CORE_HOOK_SOURCE_VOLUME_CHANGED,
+    PA_CORE_HOOK_SOURCE_MUTE_CHANGED,
     PA_CORE_HOOK_SINK_INPUT_NEW,
     PA_CORE_HOOK_SINK_INPUT_FIXATE,
     PA_CORE_HOOK_SINK_INPUT_PUT,
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 6855295..df469e2 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -2219,6 +2219,7 @@ void pa_sink_set_mute(pa_sink *s, bool mute, bool save) {
     pa_log_debug("The mute of sink %s changed from %s to %s.", s->name, pa_yes_no(old_muted), pa_yes_no(mute));
     pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SINK_MESSAGE_SET_MUTE, NULL, 0, NULL) == 0);
     pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK|PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
+    pa_hook_fire(&s->core->hooks[PA_CORE_HOOK_SINK_MUTE_CHANGED], s);
 }
 
 /* Called from main thread */
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index e99db79..28c5e72 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -1812,6 +1812,7 @@ void pa_source_set_mute(pa_source *s, bool mute, bool save) {
     pa_log_debug("The mute of source %s changed from %s to %s.", s->name, pa_yes_no(old_muted), pa_yes_no(mute));
     pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SOURCE_MESSAGE_SET_MUTE, NULL, 0, NULL) == 0);
     pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE|PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
+    pa_hook_fire(&s->core->hooks[PA_CORE_HOOK_SOURCE_MUTE_CHANGED], s);
 }
 
 /* Called from main thread */
-- 
1.8.3.1



More information about the pulseaudio-discuss mailing list