c->is_system_instance = 0;
- pa_hook_init(&c->hook_sink_input_new, c);
+ pa_hook_init(&c->hook_sink_new, c);
+ pa_hook_init(&c->hook_sink_new_post, c);
pa_hook_init(&c->hook_sink_disconnect, c);
- pa_hook_init(&c->hook_source_output_new, c);
+ pa_hook_init(&c->hook_sink_disconnect_post, c);
+ pa_hook_init(&c->hook_source_new, c);
+ pa_hook_init(&c->hook_source_new_post, c);
pa_hook_init(&c->hook_source_disconnect, c);
+ pa_hook_init(&c->hook_source_disconnect_post, c);
+ pa_hook_init(&c->hook_sink_input_new, c);
+ pa_hook_init(&c->hook_sink_input_new_post, c);
+ pa_hook_init(&c->hook_sink_input_disconnect, c);
+ pa_hook_init(&c->hook_sink_input_disconnect_post, c);
+ pa_hook_init(&c->hook_source_output_new, c);
+ pa_hook_init(&c->hook_source_output_new_post, c);
+ pa_hook_init(&c->hook_source_output_disconnect, c);
+ pa_hook_init(&c->hook_source_output_disconnect_post, c);
pa_property_init(c);
c->mainloop->io_free(c->asyncmsgq_event);
- pa_hook_free(&c->hook_sink_input_new);
+ pa_hook_free(&c->hook_sink_new);
+ pa_hook_free(&c->hook_sink_new_post);
pa_hook_free(&c->hook_sink_disconnect);
- pa_hook_free(&c->hook_source_output_new);
+ pa_hook_free(&c->hook_sink_disconnect_post);
+ pa_hook_free(&c->hook_source_new);
+ pa_hook_free(&c->hook_source_new_post);
pa_hook_free(&c->hook_source_disconnect);
+ pa_hook_free(&c->hook_source_disconnect_post);
+ pa_hook_free(&c->hook_sink_input_new);
+ pa_hook_free(&c->hook_sink_input_new_post);
+ pa_hook_free(&c->hook_sink_input_disconnect);
+ pa_hook_free(&c->hook_sink_input_disconnect_post);
+ pa_hook_free(&c->hook_source_output_new);
+ pa_hook_free(&c->hook_source_output_new_post);
+ pa_hook_free(&c->hook_source_output_disconnect);
+ pa_hook_free(&c->hook_source_output_disconnect_post);
pa_xfree(c);
}
/* hooks */
pa_hook
- hook_sink_input_new,
+ hook_sink_new,
+ hook_sink_new_post,
hook_sink_disconnect,
+ hook_sink_disconnect_post,
+ hook_source_new,
+ hook_source_new_post,
+ hook_source_disconnect,
+ hook_source_disconnect_post,
+ hook_sink_input_new,
+ hook_sink_input_new_post,
+ hook_sink_input_disconnect,
+ hook_sink_input_disconnect_post,
hook_source_output_new,
- hook_source_disconnect;
+ hook_source_output_new_post,
+ hook_source_output_disconnect,
+ hook_source_output_disconnect_post;
pa_asyncmsgq *asyncmsgq;
pa_io_event *asyncmsgq_event;
pa_assert(i);
pa_return_if_fail(i->state != PA_SINK_INPUT_DISCONNECTED);
+ pa_hook_fire(&i->sink->core->hook_sink_input_disconnect, i);
+
if (i->sync_prev)
i->sync_prev->sync_next = i->sync_next;
if (i->sync_next)
sink_input_set_state(i, PA_SINK_INPUT_DISCONNECTED);
pa_sink_update_status(i->sink);
- i->sink = NULL;
i->peek = NULL;
i->drop = NULL;
i->kill = NULL;
i->get_latency = NULL;
i->underrun = NULL;
+
+ pa_hook_fire(&i->sink->core->hook_sink_input_disconnect_post, i);
+ i->sink = NULL;
pa_sink_input_unref(i);
}
pa_sink_update_status(i->sink);
pa_subscription_post(i->sink->core, PA_SUBSCRIPTION_EVENT_SINK_INPUT|PA_SUBSCRIPTION_EVENT_NEW, i->index);
+ pa_hook_fire(&i->sink->core->hook_sink_input_new_post, i);
}
void pa_sink_input_kill(pa_sink_input*i) {
pa_return_null_if_fail(!driver || pa_utf8_valid(driver));
pa_return_null_if_fail(name && pa_utf8_valid(name) && *name);
+ if (pa_hook_fire(&core->hook_sink_new, NULL) < 0) /* FIXME */
+ return NULL;
+
s = pa_msgobject_new(pa_sink);
if (!(name = pa_namereg_register(core, name, PA_NAMEREG_SINK, s, fail))) {
pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_SINK | PA_SUBSCRIPTION_EVENT_NEW, s->index);
+ pa_hook_fire(&core->hook_sink_new_post, s);
+
return s;
}
pa_assert(s);
pa_return_if_fail(s->state != PA_SINK_DISCONNECTED);
+ pa_hook_fire(&s->core->hook_sink_disconnect, s);
+
pa_namereg_unregister(s->core, s->name);
pa_idxset_remove_by_data(s->core->sinks, s, NULL);
- pa_hook_fire(&s->core->hook_sink_disconnect, s);
-
while ((i = pa_idxset_first(s->inputs, NULL))) {
pa_assert(i != j);
pa_sink_input_kill(i);
s->set_state = NULL;
pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK | PA_SUBSCRIPTION_EVENT_REMOVE, s->index);
+
+ pa_hook_fire(&s->core->hook_sink_disconnect_post, s);
}
static void sink_free(pa_object *o) {
pa_assert(o);
pa_return_if_fail(o->state != PA_SOURCE_OUTPUT_DISCONNECTED);
+ pa_hook_fire(&o->source->core->hook_source_output_disconnect, o);
+
pa_asyncmsgq_send(o->source->asyncmsgq, PA_MSGOBJECT(o->source), PA_SOURCE_MESSAGE_REMOVE_OUTPUT, o, 0, NULL);
pa_idxset_remove_by_data(o->source->core->source_outputs, o, NULL);
pa_idxset_remove_by_data(o->source->outputs, o, NULL);
- pa_source_output_unref(o);
pa_subscription_post(o->source->core, PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT|PA_SUBSCRIPTION_EVENT_REMOVE, o->index);
source_output_set_state(o, PA_SOURCE_OUTPUT_DISCONNECTED);
pa_source_update_status(o->source);
- o->source = NULL;
o->push = NULL;
o->kill = NULL;
o->get_latency = NULL;
+
+ pa_hook_fire(&o->source->core->hook_source_output_disconnect_post, o);
+
+ o->source = NULL;
+ pa_source_output_unref(o);
}
static void source_output_free(pa_object* mo) {
pa_source_update_status(o->source);
pa_subscription_post(o->source->core, PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT|PA_SUBSCRIPTION_EVENT_NEW, o->index);
+
+ pa_hook_fire(&o->source->core->hook_source_output_new_post, o);
}
void pa_source_output_kill(pa_source_output*o) {
pa_return_null_if_fail(!driver || pa_utf8_valid(driver));
pa_return_null_if_fail(pa_utf8_valid(name) && *name);
+ if (pa_hook_fire(&core->hook_sink_new, NULL) < 0) /* FIXME */
+ return NULL;
+
s = pa_msgobject_new(pa_source);
if (!(name = pa_namereg_register(core, name, PA_NAMEREG_SOURCE, s, fail))) {
pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_SOURCE | PA_SUBSCRIPTION_EVENT_NEW, s->index);
+ pa_hook_fire(&core->hook_source_new_post, s);
+
return s;
}
pa_assert(s);
pa_return_if_fail(s->state != PA_SOURCE_DISCONNECTED);
+ pa_hook_fire(&s->core->hook_source_disconnect, s);
+
pa_namereg_unregister(s->core, s->name);
pa_idxset_remove_by_data(s->core->sources, s, NULL);
- pa_hook_fire(&s->core->hook_source_disconnect, s);
-
while ((o = pa_idxset_first(s->outputs, NULL))) {
pa_assert(o != j);
pa_source_output_kill(o);
s->set_state = NULL;
pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE | PA_SUBSCRIPTION_EVENT_REMOVE, s->index);
+
+ pa_hook_fire(&s->core->hook_source_disconnect_post, s);
}
static void source_free(pa_object *o) {