allow sending meta/policy events to clients

This commit is contained in:
Lennart Poettering 2009-02-12 03:18:05 +01:00
parent 4bd9737725
commit 823431e447
17 changed files with 369 additions and 2 deletions

View file

@ -122,6 +122,7 @@ static void reset_callbacks(pa_sink_input *i) {
i->get_latency = NULL;
i->state_change = NULL;
i->may_move_to = NULL;
i->send_event = NULL;
}
/* Called from main context */
@ -1446,3 +1447,31 @@ pa_memchunk* pa_sink_input_get_silence(pa_sink_input *i, pa_memchunk *ret) {
return ret;
}
/* Called from main context */
void pa_sink_input_send_event(pa_sink_input *i, const char *event, pa_proplist *data) {
pa_proplist *pl = NULL;
pa_sink_input_send_event_hook_data hook_data;
pa_sink_input_assert_ref(i);
pa_assert(event);
if (!i->send_event)
return;
if (!data)
data = pl = pa_proplist_new();
hook_data.sink_input = i;
hook_data.data = data;
hook_data.event = event;
if (pa_hook_fire(&i->core->hooks[PA_CORE_HOOK_SINK_INPUT_SEND_EVENT], &hook_data) < 0)
goto finish;
i->send_event(i, event, data);
finish:
if (pl)
pa_proplist_free(pl);
}