refactor stream attaching/detaching

Move repetitive code into convenience functions. No changes in
behaviour.
This commit is contained in:
Tanu Kaskinen 2016-12-08 01:59:05 +02:00
parent d404d8d1ab
commit f825239887
6 changed files with 112 additions and 63 deletions

View file

@ -2298,6 +2298,30 @@ int pa_sink_input_update_rate(pa_sink_input *i) {
return 0;
}
/* Called from the IO thread. */
void pa_sink_input_attach(pa_sink_input *i) {
pa_assert(i);
pa_assert(!i->thread_info.attached);
i->thread_info.attached = true;
if (i->attach)
i->attach(i);
}
/* Called from the IO thread. */
void pa_sink_input_detach(pa_sink_input *i) {
pa_assert(i);
if (!i->thread_info.attached)
return;
i->thread_info.attached = false;
if (i->detach)
i->detach(i);
}
/* Called from the main thread. */
void pa_sink_input_set_volume_direct(pa_sink_input *i, const pa_cvolume *volume) {
pa_cvolume old_volume;