summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/sink.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-04-07 00:46:20 +0200
committerLennart Poettering <lennart@poettering.net>2009-04-07 00:46:20 +0200
commit61b07768c2f7fcc38a32ba31db837a57335ed664 (patch)
treed69006dc5baeba9987930b49adee6cd06667a4b8 /src/pulsecore/sink.c
parent35a4a0baa8c83e1056d4fa6498aa789f76956ba7 (diff)
add suspend_within_thread() callbacks to pa_sink_input/pa_source_output
Diffstat (limited to 'src/pulsecore/sink.c')
-rw-r--r--src/pulsecore/sink.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index a0f0ea7e..a5226320 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -1585,7 +1585,11 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse
case PA_SINK_MESSAGE_GET_MUTE:
return 0;
- case PA_SINK_MESSAGE_SET_STATE:
+ case PA_SINK_MESSAGE_SET_STATE: {
+
+ pa_bool_t suspend_change =
+ (s->thread_info.state == PA_SINK_SUSPENDED && PA_SINK_IS_OPENED(PA_PTR_TO_UINT(userdata))) ||
+ (PA_SINK_IS_OPENED(s->thread_info.state) && PA_PTR_TO_UINT(userdata) == PA_SINK_SUSPENDED);
s->thread_info.state = PA_PTR_TO_UINT(userdata);
@@ -1594,7 +1598,17 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse
s->thread_info.rewind_requested = FALSE;
}
+ if (suspend_change) {
+ pa_sink_input *i;
+ void *state = NULL;
+
+ while ((i = pa_hashmap_iterate(s->thread_info.inputs, &state, NULL)))
+ if (i->suspend_within_thread)
+ i->suspend_within_thread(i, s->thread_info.state == PA_SINK_SUSPENDED);
+ }
+
return 0;
+ }
case PA_SINK_MESSAGE_DETACH: