diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/pulsecore/core.c | 32 | ||||
| -rw-r--r-- | src/pulsecore/core.h | 16 | ||||
| -rw-r--r-- | src/pulsecore/sink-input.c | 7 | ||||
| -rw-r--r-- | src/pulsecore/sink.c | 11 | ||||
| -rw-r--r-- | src/pulsecore/source-output.c | 11 | ||||
| -rw-r--r-- | src/pulsecore/source.c | 11 | 
6 files changed, 75 insertions, 13 deletions
diff --git a/src/pulsecore/core.c b/src/pulsecore/core.c index 1a0e50bb..2cdd4a8e 100644 --- a/src/pulsecore/core.c +++ b/src/pulsecore/core.c @@ -164,10 +164,22 @@ pa_core* pa_core_new(pa_mainloop_api *m, int shared) {      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); @@ -226,10 +238,22 @@ static void core_free(pa_object *o) {      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);  } diff --git a/src/pulsecore/core.h b/src/pulsecore/core.h index a64f2179..394785f2 100644 --- a/src/pulsecore/core.h +++ b/src/pulsecore/core.h @@ -88,10 +88,22 @@ struct pa_core {      /* 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; diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c index 0a7033d0..d1bf0acc 100644 --- a/src/pulsecore/sink-input.c +++ b/src/pulsecore/sink-input.c @@ -249,6 +249,8 @@ void pa_sink_input_disconnect(pa_sink_input *i) {      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) @@ -265,12 +267,14 @@ void pa_sink_input_disconnect(pa_sink_input *i) {      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);  } @@ -309,6 +313,7 @@ void pa_sink_input_put(pa_sink_input *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) { diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c index 150e4cb9..905fe3ff 100644 --- a/src/pulsecore/sink.c +++ b/src/pulsecore/sink.c @@ -80,6 +80,9 @@ pa_sink* pa_sink_new(      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))) { @@ -146,6 +149,8 @@ pa_sink* pa_sink_new(      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;  } @@ -174,11 +179,11 @@ void pa_sink_disconnect(pa_sink* 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); @@ -198,6 +203,8 @@ void pa_sink_disconnect(pa_sink* s) {      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) { diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c index 9b828e1a..95755f3b 100644 --- a/src/pulsecore/source-output.c +++ b/src/pulsecore/source-output.c @@ -187,21 +187,26 @@ void pa_source_output_disconnect(pa_source_output*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) { @@ -229,6 +234,8 @@ void pa_source_output_put(pa_source_output *o) {      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) { diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c index 241e1fb5..f7825931 100644 --- a/src/pulsecore/source.c +++ b/src/pulsecore/source.c @@ -73,6 +73,9 @@ pa_source* pa_source_new(      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))) { @@ -125,6 +128,8 @@ pa_source* pa_source_new(      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;  } @@ -153,11 +158,11 @@ void pa_source_disconnect(pa_source *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); @@ -174,6 +179,8 @@ void pa_source_disconnect(pa_source *s) {      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) {  | 
