mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-01 22:58:47 -04:00
module-suspend-on-idle: use pa_module_hook_connect
Refactoring, no functional change. Signed-off-by: David Henningsson <david.henningsson@canonical.com>
This commit is contained in:
parent
619def0c73
commit
a5ea142487
1 changed files with 16 additions and 71 deletions
|
|
@ -49,25 +49,6 @@ struct userdata {
|
|||
pa_core *core;
|
||||
pa_usec_t timeout;
|
||||
pa_hashmap *device_infos;
|
||||
pa_hook_slot
|
||||
*sink_new_slot,
|
||||
*source_new_slot,
|
||||
*sink_unlink_slot,
|
||||
*source_unlink_slot,
|
||||
*sink_state_changed_slot,
|
||||
*source_state_changed_slot;
|
||||
|
||||
pa_hook_slot
|
||||
*sink_input_new_slot,
|
||||
*source_output_new_slot,
|
||||
*sink_input_unlink_slot,
|
||||
*source_output_unlink_slot,
|
||||
*sink_input_move_start_slot,
|
||||
*source_output_move_start_slot,
|
||||
*sink_input_move_finish_slot,
|
||||
*source_output_move_finish_slot,
|
||||
*sink_input_state_changed_slot,
|
||||
*source_output_state_changed_slot;
|
||||
};
|
||||
|
||||
struct device_info {
|
||||
|
|
@ -464,23 +445,23 @@ int pa__init(pa_module*m) {
|
|||
PA_IDXSET_FOREACH(source, m->core->sources, idx)
|
||||
device_new_hook_cb(m->core, PA_OBJECT(source), u);
|
||||
|
||||
u->sink_new_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_PUT], PA_HOOK_NORMAL, (pa_hook_cb_t) device_new_hook_cb, u);
|
||||
u->source_new_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_PUT], PA_HOOK_NORMAL, (pa_hook_cb_t) device_new_hook_cb, u);
|
||||
u->sink_unlink_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_UNLINK_POST], PA_HOOK_NORMAL, (pa_hook_cb_t) device_unlink_hook_cb, u);
|
||||
u->source_unlink_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_UNLINK_POST], PA_HOOK_NORMAL, (pa_hook_cb_t) device_unlink_hook_cb, u);
|
||||
u->sink_state_changed_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_STATE_CHANGED], PA_HOOK_NORMAL, (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_NORMAL, (pa_hook_cb_t) device_state_changed_hook_cb, u);
|
||||
pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_SINK_PUT], PA_HOOK_NORMAL, (pa_hook_cb_t) device_new_hook_cb, u);
|
||||
pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_SOURCE_PUT], PA_HOOK_NORMAL, (pa_hook_cb_t) device_new_hook_cb, u);
|
||||
pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_SINK_UNLINK_POST], PA_HOOK_NORMAL, (pa_hook_cb_t) device_unlink_hook_cb, u);
|
||||
pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_SOURCE_UNLINK_POST], PA_HOOK_NORMAL, (pa_hook_cb_t) device_unlink_hook_cb, u);
|
||||
pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_SINK_STATE_CHANGED], PA_HOOK_NORMAL, (pa_hook_cb_t) device_state_changed_hook_cb, u);
|
||||
pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_SOURCE_STATE_CHANGED], PA_HOOK_NORMAL, (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_FIXATE], PA_HOOK_NORMAL, (pa_hook_cb_t) sink_input_fixate_hook_cb, u);
|
||||
u->source_output_new_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_FIXATE], PA_HOOK_NORMAL, (pa_hook_cb_t) source_output_fixate_hook_cb, u);
|
||||
u->sink_input_unlink_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_UNLINK_POST], PA_HOOK_NORMAL, (pa_hook_cb_t) sink_input_unlink_hook_cb, u);
|
||||
u->source_output_unlink_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_UNLINK_POST], PA_HOOK_NORMAL, (pa_hook_cb_t) source_output_unlink_hook_cb, u);
|
||||
u->sink_input_move_start_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_MOVE_START], PA_HOOK_NORMAL, (pa_hook_cb_t) sink_input_move_start_hook_cb, u);
|
||||
u->source_output_move_start_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_MOVE_START], PA_HOOK_NORMAL, (pa_hook_cb_t) source_output_move_start_hook_cb, u);
|
||||
u->sink_input_move_finish_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_MOVE_FINISH], PA_HOOK_NORMAL, (pa_hook_cb_t) sink_input_move_finish_hook_cb, u);
|
||||
u->source_output_move_finish_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_MOVE_FINISH], PA_HOOK_NORMAL, (pa_hook_cb_t) source_output_move_finish_hook_cb, u);
|
||||
u->sink_input_state_changed_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_STATE_CHANGED], PA_HOOK_NORMAL, (pa_hook_cb_t) sink_input_state_changed_hook_cb, u);
|
||||
u->source_output_state_changed_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_STATE_CHANGED], PA_HOOK_NORMAL, (pa_hook_cb_t) source_output_state_changed_hook_cb, u);
|
||||
pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_SINK_INPUT_FIXATE], PA_HOOK_NORMAL, (pa_hook_cb_t) sink_input_fixate_hook_cb, u);
|
||||
pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_FIXATE], PA_HOOK_NORMAL, (pa_hook_cb_t) source_output_fixate_hook_cb, u);
|
||||
pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_SINK_INPUT_UNLINK_POST], PA_HOOK_NORMAL, (pa_hook_cb_t) sink_input_unlink_hook_cb, u);
|
||||
pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_UNLINK_POST], PA_HOOK_NORMAL, (pa_hook_cb_t) source_output_unlink_hook_cb, u);
|
||||
pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_SINK_INPUT_MOVE_START], PA_HOOK_NORMAL, (pa_hook_cb_t) sink_input_move_start_hook_cb, u);
|
||||
pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_MOVE_START], PA_HOOK_NORMAL, (pa_hook_cb_t) source_output_move_start_hook_cb, u);
|
||||
pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_SINK_INPUT_MOVE_FINISH], PA_HOOK_NORMAL, (pa_hook_cb_t) sink_input_move_finish_hook_cb, u);
|
||||
pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_MOVE_FINISH], PA_HOOK_NORMAL, (pa_hook_cb_t) source_output_move_finish_hook_cb, u);
|
||||
pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_SINK_INPUT_STATE_CHANGED], PA_HOOK_NORMAL, (pa_hook_cb_t) sink_input_state_changed_hook_cb, u);
|
||||
pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_STATE_CHANGED], PA_HOOK_NORMAL, (pa_hook_cb_t) source_output_state_changed_hook_cb, u);
|
||||
|
||||
pa_modargs_free(ma);
|
||||
return 0;
|
||||
|
|
@ -503,42 +484,6 @@ void pa__done(pa_module*m) {
|
|||
|
||||
u = m->userdata;
|
||||
|
||||
if (u->sink_new_slot)
|
||||
pa_hook_slot_free(u->sink_new_slot);
|
||||
if (u->sink_unlink_slot)
|
||||
pa_hook_slot_free(u->sink_unlink_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_unlink_slot)
|
||||
pa_hook_slot_free(u->source_unlink_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);
|
||||
if (u->sink_input_unlink_slot)
|
||||
pa_hook_slot_free(u->sink_input_unlink_slot);
|
||||
if (u->sink_input_move_start_slot)
|
||||
pa_hook_slot_free(u->sink_input_move_start_slot);
|
||||
if (u->sink_input_move_finish_slot)
|
||||
pa_hook_slot_free(u->sink_input_move_finish_slot);
|
||||
if (u->sink_input_state_changed_slot)
|
||||
pa_hook_slot_free(u->sink_input_state_changed_slot);
|
||||
|
||||
if (u->source_output_new_slot)
|
||||
pa_hook_slot_free(u->source_output_new_slot);
|
||||
if (u->source_output_unlink_slot)
|
||||
pa_hook_slot_free(u->source_output_unlink_slot);
|
||||
if (u->source_output_move_start_slot)
|
||||
pa_hook_slot_free(u->source_output_move_start_slot);
|
||||
if (u->source_output_move_finish_slot)
|
||||
pa_hook_slot_free(u->source_output_move_finish_slot);
|
||||
if (u->source_output_state_changed_slot)
|
||||
pa_hook_slot_free(u->source_output_state_changed_slot);
|
||||
|
||||
pa_hashmap_free(u->device_infos);
|
||||
|
||||
pa_xfree(u);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue