diff options
author | Max Kellermann <max@duempel.org> | 2016-02-27 07:35:35 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2016-02-27 07:35:35 +0100 |
commit | c9761bf6afd5cad2f2d1e3379016cb61be8ee69b (patch) | |
tree | 840dacc97473e22c0b3aa024eb146a63940ca654 /src/output | |
parent | 4a47265224cf1182445363ddcf4c1e2491503da6 (diff) |
output/alsa: pass PcmExport::Params to alsa_setup()
Diffstat (limited to 'src/output')
-rw-r--r-- | src/output/plugins/AlsaOutputPlugin.cxx | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/src/output/plugins/AlsaOutputPlugin.cxx b/src/output/plugins/AlsaOutputPlugin.cxx index 0761ae361..50ea1d6fd 100644 --- a/src/output/plugins/AlsaOutputPlugin.cxx +++ b/src/output/plugins/AlsaOutputPlugin.cxx @@ -363,11 +363,11 @@ alsa_to_packed_format(snd_pcm_format_t fmt) */ static int alsa_try_format_or_packed(snd_pcm_t *pcm, snd_pcm_hw_params_t *hwparams, - snd_pcm_format_t fmt, bool *packed_r) + snd_pcm_format_t fmt, PcmExport::Params ¶ms) { int err = snd_pcm_hw_params_set_format(pcm, hwparams, fmt); if (err == 0) - *packed_r = false; + params.pack24 = false; if (err != -EINVAL) return err; @@ -378,7 +378,7 @@ alsa_try_format_or_packed(snd_pcm_t *pcm, snd_pcm_hw_params_t *hwparams, err = snd_pcm_hw_params_set_format(pcm, hwparams, fmt); if (err == 0) - *packed_r = true; + params.pack24 = true; return err; } @@ -390,16 +390,16 @@ alsa_try_format_or_packed(snd_pcm_t *pcm, snd_pcm_hw_params_t *hwparams, static int alsa_output_try_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *hwparams, SampleFormat sample_format, - bool *packed_r, bool *reverse_endian_r) + PcmExport::Params ¶ms) { snd_pcm_format_t alsa_format = get_bitformat(sample_format); if (alsa_format == SND_PCM_FORMAT_UNKNOWN) return -EINVAL; int err = alsa_try_format_or_packed(pcm, hwparams, alsa_format, - packed_r); + params); if (err == 0) - *reverse_endian_r = false; + params.reverse_endian = false; if (err != -EINVAL) return err; @@ -408,9 +408,9 @@ alsa_output_try_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *hwparams, if (alsa_format == SND_PCM_FORMAT_UNKNOWN) return -EINVAL; - err = alsa_try_format_or_packed(pcm, hwparams, alsa_format, packed_r); + err = alsa_try_format_or_packed(pcm, hwparams, alsa_format, params); if (err == 0) - *reverse_endian_r = true; + params.reverse_endian = true; return err; } @@ -421,13 +421,13 @@ alsa_output_try_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *hwparams, static int alsa_output_setup_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *hwparams, AudioFormat &audio_format, - bool *packed_r, bool *reverse_endian_r) + PcmExport::Params ¶ms) { /* try the input format first */ int err = alsa_output_try_format(pcm, hwparams, audio_format.format, - packed_r, reverse_endian_r); + params); /* if unsupported by the hardware, try other formats */ @@ -447,7 +447,7 @@ alsa_output_setup_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *hwparams, continue; err = alsa_output_try_format(pcm, hwparams, mpd_format, - packed_r, reverse_endian_r); + params); if (err == 0) audio_format.format = mpd_format; } @@ -461,7 +461,7 @@ alsa_output_setup_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *hwparams, */ static bool alsa_setup(AlsaOutput *ad, AudioFormat &audio_format, - bool *packed_r, bool *reverse_endian_r, Error &error) + PcmExport::Params ¶ms, Error &error) { unsigned int sample_rate = audio_format.sample_rate; unsigned int channels = audio_format.channels; @@ -505,7 +505,7 @@ configure_hw: } err = alsa_output_setup_format(ad->pcm, hwparams, audio_format, - packed_r, reverse_endian_r); + params); if (err < 0) { error.Format(alsa_output_domain, err, "ALSA device \"%s\" does not support format %s: %s", @@ -688,8 +688,7 @@ AlsaOutput::SetupDop(const AudioFormat audio_format, const AudioFormat check = dop_format; - if (!alsa_setup(this, dop_format, ¶ms.pack24, - ¶ms.reverse_endian, error)) + if (!alsa_setup(this, dop_format, params, error)) return false; /* if the device allows only 32 bit, shift all DoP @@ -723,9 +722,7 @@ AlsaOutput::SetupOrDop(AudioFormat &audio_format, Error &error) params.dop = dop && audio_format.format == SampleFormat::DSD; const bool success = params.dop ? SetupDop(audio_format, params, error) - : alsa_setup(this, audio_format, - ¶ms.pack24, ¶ms.reverse_endian, - error); + : alsa_setup(this, audio_format, params, error); if (!success) return false; |