diff options
author | David Henningsson <david.henningsson@canonical.com> | 2015-03-27 11:20:15 +0100 |
---|---|---|
committer | David Henningsson <david.henningsson@canonical.com> | 2015-04-10 09:26:47 +0200 |
commit | 10d9d8af5f0e24f6fbdfcf088ec04eb3f6e5c589 (patch) | |
tree | 9d0797c916676b53d4d7a84f4fc01c1a8bad6486 /src | |
parent | 6eae0d4bf47258f3095fde13ebe179dbdc4cbcda (diff) |
module-filter-*: use pa_module_hook_connect
Refactoring, no functional change.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/module-filter-apply.c | 52 | ||||
-rw-r--r-- | src/modules/module-filter-heuristics.c | 22 |
2 files changed, 14 insertions, 60 deletions
diff --git a/src/modules/module-filter-apply.c b/src/modules/module-filter-apply.c index c7c7367fc..5a927a3e2 100644 --- a/src/modules/module-filter-apply.c +++ b/src/modules/module-filter-apply.c @@ -65,17 +65,6 @@ struct filter { struct userdata { pa_core *core; pa_hashmap *filters; - pa_hook_slot - *sink_input_put_slot, - *sink_input_move_finish_slot, - *sink_input_proplist_slot, - *sink_input_unlink_slot, - *sink_unlink_slot, - *source_output_put_slot, - *source_output_move_finish_slot, - *source_output_proplist_slot, - *source_output_unlink_slot, - *source_unlink_slot; bool autoclean; pa_time_event *housekeeping_time_event; }; @@ -681,16 +670,16 @@ int pa__init(pa_module *m) { u->filters = pa_hashmap_new(filter_hash, filter_compare); - u->sink_input_put_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_PUT], PA_HOOK_LATE, (pa_hook_cb_t) sink_input_put_cb, u); - u->sink_input_move_finish_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_MOVE_FINISH], PA_HOOK_LATE, (pa_hook_cb_t) sink_input_move_finish_cb, u); - u->sink_input_proplist_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_PROPLIST_CHANGED], PA_HOOK_LATE, (pa_hook_cb_t) sink_input_proplist_cb, u); - u->sink_input_unlink_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_UNLINK], PA_HOOK_LATE, (pa_hook_cb_t) sink_input_unlink_cb, u); - u->sink_unlink_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_UNLINK], PA_HOOK_LATE-1, (pa_hook_cb_t) sink_unlink_cb, u); - u->source_output_put_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_PUT], PA_HOOK_LATE, (pa_hook_cb_t) source_output_put_cb, u); - u->source_output_move_finish_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_MOVE_FINISH], PA_HOOK_LATE, (pa_hook_cb_t) source_output_move_finish_cb, u); - u->source_output_proplist_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_PROPLIST_CHANGED], PA_HOOK_LATE, (pa_hook_cb_t) source_output_proplist_cb, u); - u->source_output_unlink_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_UNLINK], PA_HOOK_LATE, (pa_hook_cb_t) source_output_unlink_cb, u); - u->source_unlink_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_UNLINK], PA_HOOK_LATE-1, (pa_hook_cb_t) source_unlink_cb, u); + pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_SINK_INPUT_PUT], PA_HOOK_LATE, (pa_hook_cb_t) sink_input_put_cb, u); + pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_SINK_INPUT_MOVE_FINISH], PA_HOOK_LATE, (pa_hook_cb_t) sink_input_move_finish_cb, u); + pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_SINK_INPUT_PROPLIST_CHANGED], PA_HOOK_LATE, (pa_hook_cb_t) sink_input_proplist_cb, u); + pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_SINK_INPUT_UNLINK], PA_HOOK_LATE, (pa_hook_cb_t) sink_input_unlink_cb, u); + pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_SINK_UNLINK], PA_HOOK_LATE-1, (pa_hook_cb_t) sink_unlink_cb, u); + pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_PUT], PA_HOOK_LATE, (pa_hook_cb_t) source_output_put_cb, u); + pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_MOVE_FINISH], PA_HOOK_LATE, (pa_hook_cb_t) source_output_move_finish_cb, u); + pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_PROPLIST_CHANGED], PA_HOOK_LATE, (pa_hook_cb_t) source_output_proplist_cb, u); + pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_UNLINK], PA_HOOK_LATE, (pa_hook_cb_t) source_output_unlink_cb, u); + pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_SOURCE_UNLINK], PA_HOOK_LATE-1, (pa_hook_cb_t) source_unlink_cb, u); pa_modargs_free(ma); @@ -713,27 +702,6 @@ void pa__done(pa_module *m) { if (!(u = m->userdata)) return; - if (u->sink_input_put_slot) - pa_hook_slot_free(u->sink_input_put_slot); - if (u->sink_input_move_finish_slot) - pa_hook_slot_free(u->sink_input_move_finish_slot); - if (u->sink_input_proplist_slot) - pa_hook_slot_free(u->sink_input_proplist_slot); - if (u->sink_input_unlink_slot) - pa_hook_slot_free(u->sink_input_unlink_slot); - if (u->sink_unlink_slot) - pa_hook_slot_free(u->sink_unlink_slot); - if (u->source_output_put_slot) - pa_hook_slot_free(u->source_output_put_slot); - if (u->source_output_move_finish_slot) - pa_hook_slot_free(u->source_output_move_finish_slot); - if (u->source_output_proplist_slot) - pa_hook_slot_free(u->source_output_proplist_slot); - if (u->source_output_unlink_slot) - pa_hook_slot_free(u->source_output_unlink_slot); - if (u->source_unlink_slot) - pa_hook_slot_free(u->source_unlink_slot); - if (u->housekeeping_time_event) u->core->mainloop->time_free(u->housekeeping_time_event); diff --git a/src/modules/module-filter-heuristics.c b/src/modules/module-filter-heuristics.c index 1b1aae110..423e87387 100644 --- a/src/modules/module-filter-heuristics.c +++ b/src/modules/module-filter-heuristics.c @@ -46,11 +46,6 @@ static const char* const valid_modargs[] = { struct userdata { pa_core *core; - pa_hook_slot - *sink_input_put_slot, - *sink_input_move_finish_slot, - *source_output_put_slot, - *source_output_move_finish_slot; }; static pa_hook_result_t process(struct userdata *u, pa_object *o, bool is_sink_input) { @@ -147,10 +142,10 @@ int pa__init(pa_module *m) { u->core = m->core; - u->sink_input_put_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_PUT], PA_HOOK_LATE-1, (pa_hook_cb_t) sink_input_put_cb, u); - u->sink_input_move_finish_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_MOVE_FINISH], PA_HOOK_LATE-1, (pa_hook_cb_t) sink_input_move_finish_cb, u); - u->source_output_put_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_PUT], PA_HOOK_LATE-1, (pa_hook_cb_t) source_output_put_cb, u); - u->source_output_move_finish_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_MOVE_FINISH], PA_HOOK_LATE-1, (pa_hook_cb_t) source_output_move_finish_cb, u); + pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_SINK_INPUT_PUT], PA_HOOK_LATE-1, (pa_hook_cb_t) sink_input_put_cb, u); + pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_SINK_INPUT_MOVE_FINISH], PA_HOOK_LATE-1, (pa_hook_cb_t) sink_input_move_finish_cb, u); + pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_PUT], PA_HOOK_LATE-1, (pa_hook_cb_t) source_output_put_cb, u); + pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_MOVE_FINISH], PA_HOOK_LATE-1, (pa_hook_cb_t) source_output_move_finish_cb, u); pa_modargs_free(ma); @@ -174,15 +169,6 @@ void pa__done(pa_module *m) { if (!(u = m->userdata)) return; - if (u->sink_input_put_slot) - pa_hook_slot_free(u->sink_input_put_slot); - if (u->sink_input_move_finish_slot) - pa_hook_slot_free(u->sink_input_move_finish_slot); - if (u->source_output_put_slot) - pa_hook_slot_free(u->source_output_put_slot); - if (u->source_output_move_finish_slot) - pa_hook_slot_free(u->source_output_move_finish_slot); - pa_xfree(u); } |