alsa-sink/source, sink, source: Consider sample format for avoid-resampling/passthrough

Sample format(e.g. 16 bit, 24 bit) was not considered even if the
avoid-resampling option is set or the passthrough mode is used.
This patch checks both sample format and rate of a stream to
determine whether to avoid resampling in case of the option is set.
In other word, it is possble to use the stream's original sample
format and rate without resampling as long as these are supported
by the device.

pa_sink_input_update_rate() and pa_source_output_update_rate() are
renamed to pa_sink_input_update_resampler() and pa_source_output
_update_resampler() respectively.

functions are added as below.
 pa_sink_set_sample_format(), pa_sink_set_sample_rate(),
 pa_source_set_sample_format(), pa_source_set_sample_rate()

Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
This commit is contained in:
Sangchul Lee 2018-11-16 01:12:05 +09:00 committed by Tanu Kaskinen
parent 73156649e7
commit 547998db44
11 changed files with 335 additions and 165 deletions

View file

@ -139,11 +139,9 @@ static void sink_update_requested_latency_cb(pa_sink *s) {
pa_sink_set_max_request_within_thread(s, nbytes);
}
static int sink_reconfigure_cb(pa_sink *s, pa_sample_spec *spec, bool passthrough) {
static void sink_reconfigure_cb(pa_sink *s, pa_sample_spec *spec, bool passthrough) {
/* We don't need to do anything */
s->sample_spec = *spec;
return 0;
}
static bool sink_set_formats_cb(pa_sink *s, pa_idxset *formats) {