summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/sink.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-08-15 03:41:13 +0200
committerLennart Poettering <lennart@poettering.net>2009-08-15 03:41:13 +0200
commit0c08dbd9b926ec94084dd47069627ed6eda1c1d1 (patch)
tree9b6228ebe096caffb4cc52a0118479e068c9825a /src/pulsecore/sink.c
parentd8a90a390041b5603a7caacaaea8296fa76363bc (diff)
core: introduce pa_{sink|source}_update_flags()
Diffstat (limited to 'src/pulsecore/sink.c')
-rw-r--r--src/pulsecore/sink.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index c1589f2d..c79aa79d 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -551,7 +551,7 @@ static void sink_free(pa_object *o) {
pa_xfree(s);
}
-/* Called from main context */
+/* Called from main context, and not while the IO thread is active, please */
void pa_sink_set_asyncmsgq(pa_sink *s, pa_asyncmsgq *q) {
pa_sink_assert_ref(s);
pa_assert_ctl_context();
@@ -562,6 +562,26 @@ void pa_sink_set_asyncmsgq(pa_sink *s, pa_asyncmsgq *q) {
pa_source_set_asyncmsgq(s->monitor_source, q);
}
+/* Called from main context, and not while the IO thread is active, please */
+void pa_sink_update_flags(pa_sink *s, pa_sink_flags_t mask, pa_sink_flags_t value) {
+ pa_sink_assert_ref(s);
+ pa_assert_ctl_context();
+
+ if (mask == 0)
+ return;
+
+ /* For now, allow only a minimal set of flags to be changed. */
+ pa_assert((mask & ~(PA_SINK_DYNAMIC_LATENCY|PA_SINK_LATENCY)) == 0);
+
+ s->flags = (s->flags & ~mask) | (value & mask);
+
+ pa_source_update_flags(s->monitor_source,
+ ((mask & PA_SINK_LATENCY) ? PA_SOURCE_LATENCY : 0) |
+ ((mask & PA_SINK_DYNAMIC_LATENCY) ? PA_SOURCE_DYNAMIC_LATENCY : 0),
+ ((value & PA_SINK_LATENCY) ? PA_SOURCE_LATENCY : 0) |
+ ((value & PA_SINK_DYNAMIC_LATENCY) ? PA_SINK_DYNAMIC_LATENCY : 0));
+}
+
/* Called from IO context, or before _put() from main context */
void pa_sink_set_rtpoll(pa_sink *s, pa_rtpoll *p) {
pa_sink_assert_ref(s);