]> code.delx.au - pulseaudio/commitdiff
properly implement a pa_sink_disconnect() hook
authorLennart Poettering <lennart@poettering.net>
Sun, 13 Aug 2006 17:33:32 +0000 (17:33 +0000)
committerLennart Poettering <lennart@poettering.net>
Sun, 13 Aug 2006 17:33:32 +0000 (17:33 +0000)
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1243 fefdeb5f-60dc-0310-8127-8f9354f1896f

src/pulsecore/core.c
src/pulsecore/core.h
src/pulsecore/sink.c

index 24f835f79c57c39d174c4470fa8ade0e4e68fbe0..50d79fbfb1459784ba7ffedbc0bc4b38304883cd 100644 (file)
@@ -93,7 +93,7 @@ pa_core* pa_core_new(pa_mainloop_api *m) {
     c->is_system_instance = 0;
 
     pa_hook_init(&c->hook_sink_input_new, c);
-    pa_hook_init(&c->hook_sink_input_disconnect, c);
+    pa_hook_init(&c->hook_sink_disconnect, c);
 
     pa_property_init(c);
 
@@ -142,7 +142,7 @@ void pa_core_free(pa_core *c) {
     pa_property_cleanup(c);
 
     pa_hook_free(&c->hook_sink_input_new);
-    pa_hook_free(&c->hook_sink_input_disconnect);
+    pa_hook_free(&c->hook_sink_disconnect);
     
     pa_xfree(c);    
 }
index fd92de61faded14a2fd30adf8e95b2cda898a752..22dec50c463805c06f635be12e6b9585208608ca 100644 (file)
@@ -81,7 +81,8 @@ struct pa_core {
     int is_system_instance;
 
     /* hooks */
-    pa_hook hook_sink_input_new, hook_sink_input_disconnect;
+    pa_hook hook_sink_input_new,
+        hook_sink_disconnect;
 };
 
 pa_core* pa_core_new(pa_mainloop_api *m);
index e770950cf5964d4014b1c88c072bdbbe17921ebf..557d5efcb395d8bf8523cfd372a15b3a0a1cd96e 100644 (file)
@@ -143,7 +143,10 @@ void pa_sink_disconnect(pa_sink* s) {
     assert(s);
     assert(s->state == PA_SINK_RUNNING);
 
+    s->state = PA_SINK_DISCONNECTED;
     pa_namereg_unregister(s->core, s->name);
+
+    pa_hook_fire(&s->core->hook_sink_disconnect, s);
     
     while ((i = pa_idxset_first(s->inputs, NULL))) {
         assert(i != j);
@@ -163,7 +166,6 @@ void pa_sink_disconnect(pa_sink* s) {
     s->set_hw_mute = NULL;
     s->get_hw_mute = NULL;
     
-    s->state = PA_SINK_DISCONNECTED;
     pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK | PA_SUBSCRIPTION_EVENT_REMOVE, s->index);
 }