mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
alsa-util/sink/source: Add infrastructure for supported sample formats
There has been a function to get supported sample rates from alsa and an array for it in userdata of each module-alsa-sink/source. Similarly, this patch adds a function to get supported sample formats(bit depth) from alsa and an array for it to each userdata of the modules. Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
This commit is contained in:
parent
7c066fd886
commit
9d7055004e
4 changed files with 99 additions and 0 deletions
|
|
@ -99,6 +99,7 @@ struct userdata {
|
|||
|
||||
pa_cvolume hardware_volume;
|
||||
|
||||
pa_sample_format_t *supported_formats;
|
||||
unsigned int *rates;
|
||||
|
||||
size_t
|
||||
|
|
@ -2025,6 +2026,12 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
|
|||
pa_log_info("Disabling latency range changes on overrun");
|
||||
}
|
||||
|
||||
u->supported_formats = pa_alsa_get_supported_formats(u->pcm_handle, ss.format);
|
||||
if (!u->supported_formats) {
|
||||
pa_log_error("Failed to find any supported sample formats.");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
u->rates = pa_alsa_get_supported_rates(u->pcm_handle, ss.rate);
|
||||
if (!u->rates) {
|
||||
pa_log_error("Failed to find any supported sample rates.");
|
||||
|
|
@ -2259,6 +2266,9 @@ static void userdata_free(struct userdata *u) {
|
|||
if (u->smoother)
|
||||
pa_smoother_free(u->smoother);
|
||||
|
||||
if (u->supported_formats)
|
||||
pa_xfree(u->supported_formats);
|
||||
|
||||
if (u->rates)
|
||||
pa_xfree(u->rates);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue