From 9b6c84ad6e572854f199379177226e24c317d0d8 Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bossart Date: Fri, 16 Jul 2010 16:46:28 -0500 Subject: AC3 passthrough support Second version after Tanu's feedback TODO: - notify client that volume control is disabled - change sink rate in passthrough mode if needed - automatic detection of passthrough mode instead of hard coded profile names Signed-off-by: Pierre-Louis Bossart --- src/pulsecore/sink.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/pulsecore/sink.c') diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c index d69f0388..b68ad3aa 100644 --- a/src/pulsecore/sink.c +++ b/src/pulsecore/sink.c @@ -1393,6 +1393,24 @@ void pa_sink_set_volume( pa_assert(volume || (s->flags & PA_SINK_FLAT_VOLUME)); pa_assert(!volume || volume->channels == 1 || pa_cvolume_compatible(volume, &s->sample_spec)); + /* make sure we don't change the volume when a PASSTHROUGH input is connected */ + if (s->flags & PA_SINK_PASSTHROUGH) { + pa_sink_input *alt_i; + uint32_t idx; + + /* one and only one PASSTHROUGH input can possibly be connected */ + if (pa_idxset_size(s->inputs) == 1) { + + alt_i = pa_idxset_first(s->inputs, &idx); + + if (alt_i->flags & PA_SINK_INPUT_PASSTHROUGH) { + /* FIXME: Need to notify client that volume control is disabled */ + pa_log_warn("Cannot change volume, Sink is connected to PASSTHROUGH input"); + return; + } + } + } + /* As a special exception we accept mono volumes on all sinks -- * even on those with more complex channel maps */ -- cgit