summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/source.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/source.c
parent35a4a0baa8c83e1056d4fa6498aa789f76956ba7 (diff)
add suspend_within_thread() callbacks to pa_sink_input/pa_source_output
Diffstat (limited to 'src/pulsecore/source.c')
-rw-r--r--src/pulsecore/source.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index 252e23ab..b85d6e12 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -933,9 +933,26 @@ int pa_source_process_msg(pa_msgobject *object, int code, void *userdata, int64_
case PA_SOURCE_MESSAGE_GET_MUTE:
return 0;
- case PA_SOURCE_MESSAGE_SET_STATE:
+ case PA_SOURCE_MESSAGE_SET_STATE: {
+
+ pa_bool_t suspend_change =
+ (s->thread_info.state == PA_SOURCE_SUSPENDED && PA_SOURCE_IS_OPENED(PA_PTR_TO_UINT(userdata))) ||
+ (PA_SOURCE_IS_OPENED(s->thread_info.state) && PA_PTR_TO_UINT(userdata) == PA_SOURCE_SUSPENDED);
+
s->thread_info.state = PA_PTR_TO_UINT(userdata);
+
+ if (suspend_change) {
+ pa_source_output *o;
+ void *state = NULL;
+
+ while ((o = pa_hashmap_iterate(s->thread_info.outputs, &state, NULL)))
+ if (o->suspend_within_thread)
+ o->suspend_within_thread(o, s->thread_info.state == PA_SOURCE_SUSPENDED);
+ }
+
+
return 0;
+ }
case PA_SOURCE_MESSAGE_DETACH:
@@ -1217,7 +1234,7 @@ void pa_source_get_latency_range(pa_source *s, pa_usec_t *min_latency, pa_usec_t
}
}
-/* Called from IO thread, and from main thread before pa_sink_put() is called */
+/* Called from IO thread, and from main thread before pa_source_put() is called */
void pa_source_set_latency_range_within_thread(pa_source *s, pa_usec_t min_latency, pa_usec_t max_latency) {
void *state = NULL;