sink, source: Rework reconfiguration logic to apply to more than rate

This rejigs the update_rate() logic to encompass changes to the sample
spec as a whole, as well as passthrough status. As a result,
sinks/sources provide a reconfigure() method which allows
reconfiguration as required.

The behaviour itself is currently unchanged -- alsa-sink/-source do not
actually implement anything other than rate updates for now (nor are
they ever requested to). This can be modified in the future, to allow,
for example 24-bit output when incoming media supports it, as well as
channel count changes for passthrough sinks.

Another related change is that passthrough status is now part of
sink/source reconfiguration, and we can stop doing a suspend/unsuspend
when entering/leaving passthrough state. So that part is now divided
in two -- pa_sink_reconfigure() sets the sink in passthrough mode if
required, and pa_sink_enter_passthrough() sets up everything else
(this currently means only volumes, but could disable other processing)
for passthrough mode.
This commit is contained in:
Arun Raghavan 2017-09-03 16:53:17 +05:30
parent 4f1041c271
commit 7a7072557a
8 changed files with 90 additions and 94 deletions

View file

@ -202,9 +202,9 @@ struct pa_source {
* in descending order of preference. */
pa_idxset* (*get_formats)(pa_source *s); /* ditto */
/* Called whenever the sampling frequency shall be changed. Called from
/* Called whenever device parameters need to be changed. Called from
* main thread. */
int (*update_rate)(pa_source *s, uint32_t rate);
int (*reconfigure)(pa_source *s, pa_sample_spec *spec, bool passthrough);
/* Contains copies of the above data so that the real-time worker
* thread can work without access locking */
@ -396,7 +396,7 @@ bool pa_source_update_proplist(pa_source *s, pa_update_mode_t mode, pa_proplist
int pa_source_set_port(pa_source *s, const char *name, bool save);
void pa_source_set_mixer_dirty(pa_source *s, bool is_dirty);
int pa_source_update_rate(pa_source *s, uint32_t rate, bool passthrough);
int pa_source_reconfigure(pa_source *s, pa_sample_spec *spec, bool passthrough);
unsigned pa_source_linked_by(pa_source *s); /* Number of connected streams */
unsigned pa_source_used_by(pa_source *s); /* Number of connected streams that are not corked */