summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/sink.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2007-11-21 01:30:40 +0000
committerLennart Poettering <lennart@poettering.net>2007-11-21 01:30:40 +0000
commit14a9b80afbb0bddc216462b72156f14e032e1b5e (patch)
tree4b76ca3fe8eb313a3d6e1eb866fdc1589383cfc6 /src/pulsecore/sink.c
parent4ac6b53478be63ae5d0163a330e67e4134f17f89 (diff)
- Check process name when dealing with PID files
- Add new PA_STREAM_FIX_CHANNELS, FIX_RATE, FIX_FORMAT, DONT_MOVE, VARIABLE_RATES to pa_sream_flags_t adn implement it - Expose those flags in pacat - Add notifications about device suspend/resume to the protocol and expose them in libpulse - Allow changing of buffer_attr during playback - allow disabling for remixing globally - hookup polkit support git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@2067 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/pulsecore/sink.c')
-rw-r--r--src/pulsecore/sink.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index dccb34cc..fcc91cb1 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -149,23 +149,16 @@ pa_sink* pa_sink_new(
static int sink_set_state(pa_sink *s, pa_sink_state_t state) {
int ret;
+ pa_bool_t suspend_change;
pa_assert(s);
if (s->state == state)
return 0;
- if ((s->state == PA_SINK_SUSPENDED && PA_SINK_OPENED(state)) ||
- (PA_SINK_OPENED(s->state) && state == PA_SINK_SUSPENDED)) {
- pa_sink_input *i;
- uint32_t idx;
-
- /* We're suspending or resuming, tell everyone about it */
-
- for (i = PA_SINK_INPUT(pa_idxset_first(s->inputs, &idx)); i; i = PA_SINK_INPUT(pa_idxset_next(s->inputs, &idx)))
- if (i->suspend)
- i->suspend(i, state == PA_SINK_SUSPENDED);
- }
+ suspend_change =
+ (s->state == PA_SINK_SUSPENDED && PA_SINK_OPENED(state)) ||
+ (PA_SINK_OPENED(s->state) && state == PA_SINK_SUSPENDED);
if (s->set_state)
if ((ret = s->set_state(s, state)) < 0)
@@ -176,8 +169,20 @@ static int sink_set_state(pa_sink *s, pa_sink_state_t state) {
s->state = state;
+ if (suspend_change) {
+ pa_sink_input *i;
+ uint32_t idx;
+
+ /* We're suspending or resuming, tell everyone about it */
+
+ for (i = PA_SINK_INPUT(pa_idxset_first(s->inputs, &idx)); i; i = PA_SINK_INPUT(pa_idxset_next(s->inputs, &idx)))
+ if (i->suspend)
+ i->suspend(i, state == PA_SINK_SUSPENDED);
+ }
+
if (state != PA_SINK_UNLINKED) /* if we enter UNLINKED state pa_sink_unlink() will fire the apropriate events */
pa_hook_fire(&s->core->hooks[PA_CORE_HOOK_SINK_STATE_CHANGED], s);
+
return 0;
}