[PATCH 3/3] sink, source: Send notifications when flags change

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The hooks aren't currently used, but for example, the D-Bus protocol
could use them if it implemented flag change signals.
---
 src/pulsecore/core.h   |    2 ++
 src/pulsecore/sink.c   |    3 +++
 src/pulsecore/source.c |    3 +++
 3 files changed, 8 insertions(+)

diff --git a/src/pulsecore/core.h b/src/pulsecore/core.h
index 533ba9e..a8cff5c 100644
--- a/src/pulsecore/core.h
+++ b/src/pulsecore/core.h
@@ -74,6 +74,7 @@ typedef enum pa_core_hook {
     PA_CORE_HOOK_SINK_STATE_CHANGED,
     PA_CORE_HOOK_SINK_PROPLIST_CHANGED,
     PA_CORE_HOOK_SINK_PORT_CHANGED,
+    PA_CORE_HOOK_SINK_FLAGS_CHANGED,
     PA_CORE_HOOK_SOURCE_NEW,
     PA_CORE_HOOK_SOURCE_FIXATE,
     PA_CORE_HOOK_SOURCE_PUT,
@@ -82,6 +83,7 @@ typedef enum pa_core_hook {
     PA_CORE_HOOK_SOURCE_STATE_CHANGED,
     PA_CORE_HOOK_SOURCE_PROPLIST_CHANGED,
     PA_CORE_HOOK_SOURCE_PORT_CHANGED,
+    PA_CORE_HOOK_SOURCE_FLAGS_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 f5d4dbc..9b4b066 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -784,6 +784,9 @@ void pa_sink_update_flags(pa_sink *s, pa_sink_flags_t mask, pa_sink_flags_t valu
         pa_log_debug("Sink %s: DYNAMIC_LATENCY flag %s.",
                      s->name, (s->flags & PA_SINK_DYNAMIC_LATENCY) ? "enabled" : "disabled");
 
+    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_FLAGS_CHANGED], s);
+
     if (s->monitor_source)
         pa_source_update_flags(s->monitor_source,
                                ((mask & PA_SINK_LATENCY) ? PA_SOURCE_LATENCY : 0) |
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index 6724c4b..c6aa5e3 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -710,6 +710,9 @@ void pa_source_update_flags(pa_source *s, pa_source_flags_t mask, pa_source_flag
         pa_log_debug("Source %s: DYNAMIC_LATENCY flag %s.",
                      s->name, (s->flags & PA_SOURCE_DYNAMIC_LATENCY) ? "enabled" : "disabled");
 
+    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_FLAGS_CHANGED], s);
+
     PA_IDXSET_FOREACH(output, s->outputs, idx) {
         if (output->destination_source)
             pa_source_update_flags(output->destination_source, mask, value);
-- 
1.7.10.4



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux