mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-25 06:59:52 -05:00
Move attaching/detaching from a pa_rtpoll into pa_sink proper, remove it from module-combine
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1823 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
3396b65f15
commit
5ae4eed52e
6 changed files with 150 additions and 30 deletions
|
|
@ -901,6 +901,20 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse
|
|||
s->thread_info.state = PA_PTR_TO_UINT(userdata);
|
||||
return 0;
|
||||
|
||||
case PA_SINK_MESSAGE_DETACH:
|
||||
|
||||
/* We're detaching all our input streams so that the
|
||||
* asyncmsgq and rtpoll fields can be changed without
|
||||
* problems */
|
||||
pa_sink_detach_within_thread(s);
|
||||
break;
|
||||
|
||||
case PA_SINK_MESSAGE_ATTACH:
|
||||
|
||||
/* Reattach all streams */
|
||||
pa_sink_attach_within_thread(s);
|
||||
break;
|
||||
|
||||
case PA_SINK_MESSAGE_GET_LATENCY:
|
||||
case PA_SINK_MESSAGE_MAX:
|
||||
;
|
||||
|
|
@ -922,3 +936,47 @@ int pa_sink_suspend_all(pa_core *c, int suspend) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
void pa_sink_detach(pa_sink *s) {
|
||||
pa_sink_assert_ref(s);
|
||||
pa_assert(PA_SINK_LINKED(s->state));
|
||||
|
||||
pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SINK_MESSAGE_DETACH, NULL, 0, NULL);
|
||||
}
|
||||
|
||||
void pa_sink_attach(pa_sink *s) {
|
||||
pa_sink_assert_ref(s);
|
||||
pa_assert(PA_SINK_LINKED(s->state));
|
||||
|
||||
pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SINK_MESSAGE_ATTACH, NULL, 0, NULL);
|
||||
}
|
||||
|
||||
void pa_sink_detach_within_thread(pa_sink *s) {
|
||||
pa_sink_input *i;
|
||||
void *state = NULL;
|
||||
|
||||
pa_sink_assert_ref(s);
|
||||
pa_assert(PA_SINK_LINKED(s->thread_info.state));
|
||||
|
||||
while ((i = pa_hashmap_iterate(s->thread_info.inputs, &state, NULL)))
|
||||
if (i->detach)
|
||||
i->detach(i);
|
||||
|
||||
if (s->monitor_source)
|
||||
pa_source_detach_within_thread(s->monitor_source);
|
||||
}
|
||||
|
||||
void pa_sink_attach_within_thread(pa_sink *s) {
|
||||
pa_sink_input *i;
|
||||
void *state = NULL;
|
||||
|
||||
pa_sink_assert_ref(s);
|
||||
pa_assert(PA_SINK_LINKED(s->thread_info.state));
|
||||
|
||||
while ((i = pa_hashmap_iterate(s->thread_info.inputs, &state, NULL)))
|
||||
if (i->attach)
|
||||
i->attach(i);
|
||||
|
||||
if (s->monitor_source)
|
||||
pa_source_attach_within_thread(s->monitor_source);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue