diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/modules/module-rescue-streams.c | 4 | ||||
| -rw-r--r-- | src/modules/module-suspend-on-idle.c | 64 | ||||
| -rw-r--r-- | src/modules/module-volume-restore.c | 4 | ||||
| -rw-r--r-- | src/pulsecore/core.c | 40 | ||||
| -rw-r--r-- | src/pulsecore/core.h | 38 | ||||
| -rw-r--r-- | src/pulsecore/sink-input.c | 11 | ||||
| -rw-r--r-- | src/pulsecore/sink-input.h | 1 | ||||
| -rw-r--r-- | src/pulsecore/sink.c | 11 | ||||
| -rw-r--r-- | src/pulsecore/source-output.c | 11 | ||||
| -rw-r--r-- | src/pulsecore/source-output.h | 3 | ||||
| -rw-r--r-- | src/pulsecore/source.c | 10 | 
11 files changed, 104 insertions, 93 deletions
| diff --git a/src/modules/module-rescue-streams.c b/src/modules/module-rescue-streams.c index fa22d60a..e0eed036 100644 --- a/src/modules/module-rescue-streams.c +++ b/src/modules/module-rescue-streams.c @@ -138,8 +138,8 @@ int pa__init(pa_module*m) {      }      m->userdata = u = pa_xnew(struct userdata, 1); -    u->sink_slot = pa_hook_connect(&m->core->hook_sink_disconnect, (pa_hook_cb_t) sink_hook_callback, NULL); -    u->source_slot = pa_hook_connect(&m->core->hook_source_disconnect, (pa_hook_cb_t) source_hook_callback, NULL); +    u->sink_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_DISCONNECT], (pa_hook_cb_t) sink_hook_callback, NULL); +    u->source_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_DISCONNECT], (pa_hook_cb_t) source_hook_callback, NULL);      pa_modargs_free(ma);      return 0; diff --git a/src/modules/module-suspend-on-idle.c b/src/modules/module-suspend-on-idle.c index ad148644..0d21cfbe 100644 --- a/src/modules/module-suspend-on-idle.c +++ b/src/modules/module-suspend-on-idle.c @@ -50,7 +50,7 @@ struct userdata {      pa_core *core;      pa_usec_t timeout;      pa_hashmap *device_infos; -    pa_hook_slot *sink_new_slot, *source_new_slot, *sink_disconnect_slot, *source_disconnect_slot; +    pa_hook_slot *sink_new_slot, *source_new_slot, *sink_disconnect_slot, *source_disconnect_slot, *sink_state_changed_slot, *source_state_changed_slot;      pa_hook_slot *sink_input_new_slot, *source_output_new_slot, *sink_input_disconnect_slot, *source_output_disconnect_slot;  }; @@ -69,13 +69,13 @@ static void timeout_cb(pa_mainloop_api*a, pa_time_event* e, const struct timeval      d->userdata->core->mainloop->time_restart(d->time_event, NULL); -    if (d->sink && pa_sink_used_by(d->sink) <= 0) { +    if (d->sink && pa_sink_used_by(d->sink) <= 0 && pa_sink_get_state(d->sink) != PA_SINK_SUSPENDED) {          pa_log_info("Sink %s idle for too long, suspending ...", d->sink->name);          pa_sink_suspend(d->sink, 1);          pa_source_suspend(d->sink->monitor_source, 1);      } -    if (d->source && pa_source_used_by(d->source) <= 0) { +    if (d->source && pa_source_used_by(d->source) <= 0 && pa_source_get_state(d->source) != PA_SOURCE_SUSPENDED) {          pa_log_info("Source %s idle for too long, suspending ...", d->source->name);          pa_source_suspend(d->source, 1);      } @@ -209,6 +209,40 @@ static pa_hook_result_t device_disconnect_hook_cb(pa_core *c, pa_object *o, stru      return PA_HOOK_OK;  } +static pa_hook_result_t device_state_changed_hook_cb(pa_core *c, pa_object *o, struct userdata *u) { +    struct device_info *d; + +    pa_assert(c); +    pa_object_assert_ref(o); +    pa_assert(u); + +    if (!(d = pa_hashmap_get(u->device_infos, o))) +        return PA_HOOK_OK; + +    if (pa_sink_isinstance(o)) { +        pa_sink *s = PA_SINK(o); +         +        if (pa_sink_used_by(s) <= 0) { +            pa_sink_state_t state = pa_sink_get_state(s); + +            if (state == PA_SINK_RUNNING || state == PA_SINK_IDLE) +                restart(d); +        } +         +    } else if (pa_source_isinstance(o)) { +        pa_source *s = PA_SOURCE(o); + +        if (pa_source_used_by(s) <= 0) { +            pa_sink_state_t state = pa_source_get_state(s); + +            if (state == PA_SINK_RUNNING || state == PA_SINK_IDLE) +                restart(d); +        } +    } +             +    return PA_HOOK_OK; +} +  int pa__init(pa_module*m) {      pa_modargs *ma = NULL;      struct userdata *u; @@ -240,15 +274,17 @@ int pa__init(pa_module*m) {      for (source = pa_idxset_first(m->core->sources, &idx); source; source = pa_idxset_next(m->core->sources, &idx))          device_new_hook_cb(m->core, PA_OBJECT(source), u); -    u->sink_new_slot = pa_hook_connect(&m->core->hook_sink_new_post, (pa_hook_cb_t) device_new_hook_cb, u); -    u->source_new_slot = pa_hook_connect(&m->core->hook_source_new_post, (pa_hook_cb_t) device_new_hook_cb, u); -    u->sink_disconnect_slot = pa_hook_connect(&m->core->hook_sink_disconnect_post, (pa_hook_cb_t) device_disconnect_hook_cb, u); -    u->source_disconnect_slot = pa_hook_connect(&m->core->hook_source_disconnect_post, (pa_hook_cb_t) device_disconnect_hook_cb, u); - -    u->sink_input_new_slot = pa_hook_connect(&m->core->hook_sink_input_new_post, (pa_hook_cb_t) sink_input_new_hook_cb, u); -    u->source_output_new_slot = pa_hook_connect(&m->core->hook_source_output_new_post, (pa_hook_cb_t) source_output_new_hook_cb, u); -    u->sink_input_disconnect_slot = pa_hook_connect(&m->core->hook_sink_input_disconnect_post, (pa_hook_cb_t) sink_input_disconnect_hook_cb, u); -    u->source_output_disconnect_slot = pa_hook_connect(&m->core->hook_source_output_disconnect_post, (pa_hook_cb_t) source_output_disconnect_hook_cb, u); +    u->sink_new_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_NEW_POST], (pa_hook_cb_t) device_new_hook_cb, u); +    u->source_new_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_NEW_POST], (pa_hook_cb_t) device_new_hook_cb, u); +    u->sink_disconnect_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_DISCONNECT], (pa_hook_cb_t) device_disconnect_hook_cb, u); +    u->source_disconnect_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_DISCONNECT], (pa_hook_cb_t) device_disconnect_hook_cb, u); +    u->sink_state_changed_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_STATE_CHANGED], (pa_hook_cb_t) device_state_changed_hook_cb, u); +    u->source_state_changed_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_STATE_CHANGED], (pa_hook_cb_t) device_state_changed_hook_cb, u); + +    u->sink_input_new_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_PUT], (pa_hook_cb_t) sink_input_new_hook_cb, u); +    u->source_output_new_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_PUT], (pa_hook_cb_t) source_output_new_hook_cb, u); +    u->sink_input_disconnect_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_DISCONNECT_POST], (pa_hook_cb_t) sink_input_disconnect_hook_cb, u); +    u->source_output_disconnect_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_DISCONNECT_POST], (pa_hook_cb_t) source_output_disconnect_hook_cb, u);      pa_modargs_free(ma);      return 0; @@ -276,11 +312,15 @@ void pa__done(pa_module*m) {          pa_hook_slot_free(u->sink_new_slot);      if (u->sink_disconnect_slot)          pa_hook_slot_free(u->sink_disconnect_slot); +    if (u->sink_state_changed_slot) +        pa_hook_slot_free(u->sink_state_changed_slot);      if (u->source_new_slot)          pa_hook_slot_free(u->source_new_slot);      if (u->source_disconnect_slot)          pa_hook_slot_free(u->source_disconnect_slot); +    if (u->source_state_changed_slot) +        pa_hook_slot_free(u->source_state_changed_slot);      if (u->sink_input_new_slot)          pa_hook_slot_free(u->sink_input_new_slot); diff --git a/src/modules/module-volume-restore.c b/src/modules/module-volume-restore.c index addd937b..0041760b 100644 --- a/src/modules/module-volume-restore.c +++ b/src/modules/module-volume-restore.c @@ -444,8 +444,8 @@ int pa__init(pa_module*m) {          goto fail;      u->subscription = pa_subscription_new(m->core, PA_SUBSCRIPTION_MASK_SINK_INPUT|PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT, subscribe_callback, u); -    u->sink_input_hook_slot = pa_hook_connect(&m->core->hook_sink_input_new, (pa_hook_cb_t) sink_input_hook_callback, u); -    u->source_output_hook_slot = pa_hook_connect(&m->core->hook_source_output_new, (pa_hook_cb_t) source_output_hook_callback, u); +    u->sink_input_hook_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_NEW], (pa_hook_cb_t) sink_input_hook_callback, u); +    u->source_output_hook_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_NEW], (pa_hook_cb_t) source_output_hook_callback, u);      pa_modargs_free(ma);      return 0; diff --git a/src/pulsecore/core.c b/src/pulsecore/core.c index 8b10d398..2e9d96b1 100644 --- a/src/pulsecore/core.c +++ b/src/pulsecore/core.c @@ -72,7 +72,8 @@ static void core_free(pa_object *o);  pa_core* pa_core_new(pa_mainloop_api *m, int shared) {      pa_core* c;      pa_mempool *pool; - +    int j; +          pa_assert(m);      if (shared) { @@ -138,22 +139,8 @@ pa_core* pa_core_new(pa_mainloop_api *m, int shared) {      c->is_system_instance = 0; -    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_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); +    for (j = 0; j < PA_CORE_HOOK_MAX; j++) +        pa_hook_init(&c->hooks[j], c);      pa_property_init(c); @@ -168,6 +155,7 @@ pa_core* pa_core_new(pa_mainloop_api *m, int shared) {  static void core_free(pa_object *o) {      pa_core *c = PA_CORE(o); +    int j;      pa_assert(c);      pa_module_unload_all(c); @@ -203,22 +191,8 @@ static void core_free(pa_object *o) {      pa_property_cleanup(c); -    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_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); +    for (j = 0; j < PA_CORE_HOOK_MAX; j++) +        pa_hook_free(&c->hooks[j]);      pa_xfree(c);  } diff --git a/src/pulsecore/core.h b/src/pulsecore/core.h index 003b24b1..c49a77d5 100644 --- a/src/pulsecore/core.h +++ b/src/pulsecore/core.h @@ -42,6 +42,26 @@ typedef struct pa_core pa_core;  #include <pulsecore/sink-input.h>  #include <pulsecore/msgobject.h> +typedef enum pa_core_hook { +    PA_CORE_HOOK_SINK_NEW_POST, +    PA_CORE_HOOK_SINK_DISCONNECT, +    PA_CORE_HOOK_SINK_DISCONNECT_POST, +    PA_CORE_HOOK_SINK_STATE_CHANGED, +    PA_CORE_HOOK_SOURCE_NEW_POST, +    PA_CORE_HOOK_SOURCE_DISCONNECT, +    PA_CORE_HOOK_SOURCE_DISCONNECT_POST, +    PA_CORE_HOOK_SOURCE_STATE_CHANGED, +    PA_CORE_HOOK_SINK_INPUT_NEW, +    PA_CORE_HOOK_SINK_INPUT_PUT, +    PA_CORE_HOOK_SINK_INPUT_DISCONNECT, +    PA_CORE_HOOK_SINK_INPUT_DISCONNECT_POST, +    PA_CORE_HOOK_SOURCE_OUTPUT_NEW, +    PA_CORE_HOOK_SOURCE_OUTPUT_PUT, +    PA_CORE_HOOK_SOURCE_OUTPUT_DISCONNECT, +    PA_CORE_HOOK_SOURCE_OUTPUT_DISCONNECT_POST, +    PA_CORE_HOOK_MAX +} pa_core_hook_t; +  /* The core structure of PulseAudio. Every PulseAudio daemon contains   * exactly one of these. It is used for storing kind of global   * variables for the daemon. */ @@ -89,23 +109,7 @@ struct pa_core {      int is_system_instance;      /* hooks */ -    pa_hook -        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_output_new_post, -        hook_source_output_disconnect, -        hook_source_output_disconnect_post; +    pa_hook hooks[PA_CORE_HOOK_MAX];  };  PA_DECLARE_CLASS(pa_core); diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c index d1bf0acc..77b95feb 100644 --- a/src/pulsecore/sink-input.c +++ b/src/pulsecore/sink-input.c @@ -98,9 +98,8 @@ pa_sink_input* pa_sink_input_new(      pa_assert(core);      pa_assert(data); -    if (!(flags & PA_SINK_INPUT_NO_HOOKS)) -        if (pa_hook_fire(&core->hook_sink_input_new, data) < 0) -            return NULL; +    if (pa_hook_fire(&core->hooks[PA_CORE_HOOK_SINK_INPUT_NEW], data) < 0) +        return NULL;      pa_return_null_if_fail(!data->driver || pa_utf8_valid(data->driver));      pa_return_null_if_fail(!data->name || pa_utf8_valid(data->name)); @@ -249,7 +248,7 @@ 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); +    pa_hook_fire(&i->sink->core->hooks[PA_CORE_HOOK_SINK_INPUT_DISCONNECT], i);      if (i->sync_prev)          i->sync_prev->sync_next = i->sync_next; @@ -273,7 +272,7 @@ void pa_sink_input_disconnect(pa_sink_input *i) {      i->get_latency = NULL;      i->underrun = NULL; -    pa_hook_fire(&i->sink->core->hook_sink_input_disconnect_post, i); +    pa_hook_fire(&i->sink->core->hooks[PA_CORE_HOOK_SINK_INPUT_DISCONNECT_POST], i);      i->sink = NULL;      pa_sink_input_unref(i);  } @@ -313,7 +312,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); +    pa_hook_fire(&i->sink->core->hooks[PA_CORE_HOOK_SINK_INPUT_PUT], i);  }  void pa_sink_input_kill(pa_sink_input*i) { diff --git a/src/pulsecore/sink-input.h b/src/pulsecore/sink-input.h index 0168805a..5a48418c 100644 --- a/src/pulsecore/sink-input.h +++ b/src/pulsecore/sink-input.h @@ -47,7 +47,6 @@ typedef enum pa_sink_input_state {  typedef enum pa_sink_input_flags {      PA_SINK_INPUT_VARIABLE_RATE = 1, -    PA_SINK_INPUT_NO_HOOKS = 2  } pa_sink_input_flags_t;  struct pa_sink_input { diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c index 905fe3ff..929542cc 100644 --- a/src/pulsecore/sink.c +++ b/src/pulsecore/sink.c @@ -80,9 +80,6 @@ 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))) { @@ -149,7 +146,7 @@ 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); +    pa_hook_fire(&core->hooks[PA_CORE_HOOK_SINK_NEW_POST], s);      return s;  } @@ -170,6 +167,8 @@ static int sink_set_state(pa_sink *s, pa_sink_state_t state) {          return -1;      s->state = state; +     +    pa_hook_fire(&s->core->hooks[PA_CORE_HOOK_SINK_STATE_CHANGED], s);      return 0;  } @@ -179,7 +178,7 @@ 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_hook_fire(&s->core->hooks[PA_CORE_HOOK_SINK_DISCONNECT], s);      pa_namereg_unregister(s->core, s->name);      pa_idxset_remove_by_data(s->core->sinks, s, NULL); @@ -204,7 +203,7 @@ void pa_sink_disconnect(pa_sink* s) {      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); +    pa_hook_fire(&s->core->hooks[PA_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 95755f3b..2dc66bfa 100644 --- a/src/pulsecore/source-output.c +++ b/src/pulsecore/source-output.c @@ -76,9 +76,8 @@ pa_source_output* pa_source_output_new(      pa_assert(core);      pa_assert(data); -    if (!(flags & PA_SOURCE_OUTPUT_NO_HOOKS)) -        if (pa_hook_fire(&core->hook_source_output_new, data) < 0) -            return NULL; +    if (pa_hook_fire(&core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_NEW], data) < 0) +        return NULL;      pa_return_null_if_fail(!data->driver || pa_utf8_valid(data->driver));      pa_return_null_if_fail(!data->name || pa_utf8_valid(data->name)); @@ -187,7 +186,7 @@ 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_hook_fire(&o->source->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_DISCONNECT], o);      pa_asyncmsgq_send(o->source->asyncmsgq, PA_MSGOBJECT(o->source), PA_SOURCE_MESSAGE_REMOVE_OUTPUT, o, 0, NULL); @@ -203,7 +202,7 @@ void pa_source_output_disconnect(pa_source_output*o) {      o->kill = NULL;      o->get_latency = NULL; -    pa_hook_fire(&o->source->core->hook_source_output_disconnect_post, o); +    pa_hook_fire(&o->source->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_DISCONNECT_POST], o);      o->source = NULL;      pa_source_output_unref(o); @@ -235,7 +234,7 @@ void pa_source_output_put(pa_source_output *o) {      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); +    pa_hook_fire(&o->source->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_PUT], o);  }  void pa_source_output_kill(pa_source_output*o) { diff --git a/src/pulsecore/source-output.h b/src/pulsecore/source-output.h index 47cc8c40..b17adcb5 100644 --- a/src/pulsecore/source-output.h +++ b/src/pulsecore/source-output.h @@ -42,8 +42,7 @@ typedef enum pa_source_output_state {  } pa_source_output_state_t;  typedef enum pa_source_output_flags { -    PA_SOURCE_OUTPUT_NO_HOOKS = 1, -    PA_SOURCE_OUTPUT_VARIABLE_RATE = 2 +    PA_SOURCE_OUTPUT_VARIABLE_RATE = 1  } pa_source_output_flags_t;  struct pa_source_output { diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c index f7825931..0e448f60 100644 --- a/src/pulsecore/source.c +++ b/src/pulsecore/source.c @@ -73,9 +73,6 @@ 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))) { @@ -128,7 +125,7 @@ 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); +    pa_hook_fire(&core->hooks[PA_CORE_HOOK_SOURCE_NEW_POST], s);      return s;  } @@ -149,6 +146,7 @@ static int source_set_state(pa_source *s, pa_source_state_t state) {          return -1;      s->state = state; +    pa_hook_fire(&s->core->hooks[PA_CORE_HOOK_SOURCE_STATE_CHANGED], s);      return 0;  } @@ -158,7 +156,7 @@ 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_hook_fire(&s->core->hooks[PA_CORE_HOOK_SOURCE_DISCONNECT], s);          pa_namereg_unregister(s->core, s->name);      pa_idxset_remove_by_data(s->core->sources, s, NULL); @@ -180,7 +178,7 @@ void pa_source_disconnect(pa_source *s) {      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); +    pa_hook_fire(&s->core->hooks[PA_CORE_HOOK_SOURCE_DISCONNECT_POST], s);      }  static void source_free(pa_object *o) { | 
