[pulseaudio-discuss] [PATCH 08/13] core: Add hooks for default device changes

Tanu Kaskinen tanuk at iki.fi
Tue Feb 12 11:36:58 PST 2013


---
 src/pulsecore/core.h    |    2 ++
 src/pulsecore/namereg.c |    2 ++
 2 files changed, 4 insertions(+)

diff --git a/src/pulsecore/core.h b/src/pulsecore/core.h
index 2099bb0..7779105 100644
--- a/src/pulsecore/core.h
+++ b/src/pulsecore/core.h
@@ -117,6 +117,8 @@ typedef enum pa_core_hook {
     PA_CORE_HOOK_PORT_AVAILABLE_CHANGED,
     PA_CORE_HOOK_PORT_ADDED,
     PA_CORE_HOOK_PORT_LATENCY_OFFSET_CHANGED,
+    PA_CORE_HOOK_DEFAULT_SINK_CHANGED,
+    PA_CORE_HOOK_DEFAULT_SOURCE_CHANGED,
     PA_CORE_HOOK_MAX
 } pa_core_hook_t;
 
diff --git a/src/pulsecore/namereg.c b/src/pulsecore/namereg.c
index 334e00d..625bd01 100644
--- a/src/pulsecore/namereg.c
+++ b/src/pulsecore/namereg.c
@@ -259,6 +259,7 @@ pa_sink* pa_namereg_set_default_sink(pa_core*c, pa_sink *s) {
 
     if (c->default_sink != s) {
         c->default_sink = s;
+        pa_hook_fire(&c->hooks[PA_CORE_HOOK_DEFAULT_SINK_CHANGED], s);
         pa_subscription_post(c, PA_SUBSCRIPTION_EVENT_SERVER|PA_SUBSCRIPTION_EVENT_CHANGE, PA_INVALID_INDEX);
     }
 
@@ -273,6 +274,7 @@ pa_source* pa_namereg_set_default_source(pa_core*c, pa_source *s) {
 
     if (c->default_source != s) {
         c->default_source = s;
+        pa_hook_fire(&c->hooks[PA_CORE_HOOK_DEFAULT_SOURCE_CHANGED], s);
         pa_subscription_post(c, PA_SUBSCRIPTION_EVENT_SERVER|PA_SUBSCRIPTION_EVENT_CHANGE, PA_INVALID_INDEX);
     }
 
-- 
1.7.10.4



More information about the pulseaudio-discuss mailing list