[PATCH 3/4] card: Add hook before profile changes

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

 



This is useful to modules that want to do things just before a
profile becomes inactive.

Note that the object sent with the hook is the *new* profile, not
the old profile or the card. (This is a difference from the
PA_CORE_HOOK_CARD_PROFILE_CHANGED hook.)
---
 src/pulsecore/card.c |    2 ++
 src/pulsecore/core.h |    1 +
 2 files changed, 3 insertions(+)

diff --git a/src/pulsecore/card.c b/src/pulsecore/card.c
index e6e0836..4614d8a 100644
--- a/src/pulsecore/card.c
+++ b/src/pulsecore/card.c
@@ -272,6 +272,8 @@ int pa_card_set_profile(pa_card *c, const char *name, bool save) {
         return 0;
     }
 
+    pa_hook_fire(&c->core->hooks[PA_CORE_HOOK_CARD_PROFILE_CHANGING], profile);
+
     if ((r = c->set_profile(c, profile)) < 0)
         return r;
 
diff --git a/src/pulsecore/core.h b/src/pulsecore/core.h
index f268e42..179cbb9 100644
--- a/src/pulsecore/core.h
+++ b/src/pulsecore/core.h
@@ -116,6 +116,7 @@ typedef enum pa_core_hook {
     PA_CORE_HOOK_CARD_PUT,
     PA_CORE_HOOK_CARD_UNLINK,
     PA_CORE_HOOK_CARD_PROFILE_CHANGED,
+    PA_CORE_HOOK_CARD_PROFILE_CHANGING,
     PA_CORE_HOOK_CARD_PROFILE_ADDED,
     PA_CORE_HOOK_CARD_PROFILE_AVAILABLE_CHANGED,
     PA_CORE_HOOK_PORT_AVAILABLE_CHANGED,
-- 
1.7.9.5



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

  Powered by Linux