]> code.delx.au - pulseaudio/blobdiff - polyp/autoload.c
add support for subscribing to autoload table changes
[pulseaudio] / polyp / autoload.c
index 344d26e2946f70760a28d0d08e8274bb5298415f..12cd1f91e1bd218792f5d85e562662d8e05b03b5 100644 (file)
 #include "sound-file.h"
 #include "log.h"
 #include "scache.h"
+#include "subscribe.h"
 
 static void entry_free(struct pa_autoload_entry *e) {
     assert(e);
+    pa_subscription_post(e->core, PA_SUBSCRIPTION_EVENT_AUTOLOAD|PA_SUBSCRIPTION_EVENT_REMOVE, PA_INVALID_INDEX);
     pa_xfree(e->name);
     pa_xfree(e->module);
     pa_xfree(e->argument);
@@ -51,6 +53,7 @@ static struct pa_autoload_entry* entry_new(struct pa_core *c, const char *name)
         return NULL;
     
     e = pa_xmalloc(sizeof(struct pa_autoload_entry));
+    e->core = c;
     e->name = pa_xstrdup(name);
     e->module = e->argument = NULL;
     e->in_action = 0;
@@ -61,6 +64,8 @@ static struct pa_autoload_entry* entry_new(struct pa_core *c, const char *name)
     
     pa_hashmap_put(c->autoload_hashmap, e->name, e);
 
+    pa_subscription_post(c, PA_SUBSCRIPTION_EVENT_AUTOLOAD|PA_SUBSCRIPTION_EVENT_NEW, PA_INVALID_INDEX);
+    
     return e;
 }