aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-03-27 00:22:47 +0200
committerMax Kellermann <max@duempel.org>2012-03-27 01:22:50 +0200
commitd271dd2cce79d1473f43f7ad7e6815b74617dfe3 (patch)
tree9ae91e3a33ba41640ad25b1974278d766ef2ef1f /src
parentebfdd37451cea0151de74005d83db5ac31fcaf77 (diff)
downloadmpd-d271dd2cce79d1473f43f7ad7e6815b74617dfe3.tar.gz
mpd-d271dd2cce79d1473f43f7ad7e6815b74617dfe3.tar.xz
mpd-d271dd2cce79d1473f43f7ad7e6815b74617dfe3.zip
output/alsa: use pcm_export for the DSD-over-USB conversion
Diffstat (limited to 'src')
-rw-r--r--src/output/alsa_output_plugin.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/output/alsa_output_plugin.c b/src/output/alsa_output_plugin.c
index d131003e3..00ddbfb5c 100644
--- a/src/output/alsa_output_plugin.c
+++ b/src/output/alsa_output_plugin.c
@@ -595,15 +595,16 @@ alsa_setup_dsd(struct alsa_data *ad, struct audio_format *audio_format,
/* pass 24 bit to alsa_setup() */
- audio_format->format = SAMPLE_FORMAT_S24_P32;
- audio_format->sample_rate /= 2;
+ struct audio_format usb_format = *audio_format;
+ usb_format.format = SAMPLE_FORMAT_S24_P32;
+ usb_format.sample_rate /= 2;
- const struct audio_format check = *audio_format;
+ const struct audio_format check = usb_format;
- if (!alsa_setup(ad, audio_format, packed_r, reverse_endian_r, error_r))
+ if (!alsa_setup(ad, &usb_format, packed_r, reverse_endian_r, error_r))
return false;
- if (!audio_format_equals(audio_format, &check)) {
+ if (!audio_format_equals(&usb_format, &check)) {
/* no bit-perfect playback, which is required
for DSD over USB */
g_set_error(error_r, alsa_output_quark(), 0,
@@ -612,10 +613,6 @@ alsa_setup_dsd(struct alsa_data *ad, struct audio_format *audio_format,
return false;
}
- /* the ALSA device has accepted 24 bit playback,
- return DSD_OVER_USB to the caller */
-
- audio_format->format = SAMPLE_FORMAT_DSD_OVER_USB;
return true;
}
@@ -625,7 +622,9 @@ alsa_setup_or_dsd(struct alsa_data *ad, struct audio_format *audio_format,
{
bool packed, reverse_endian;
- const bool success = ad->dsd_usb && audio_format->format == SAMPLE_FORMAT_DSD
+ const bool dsd_usb = ad->dsd_usb &&
+ audio_format->format == SAMPLE_FORMAT_DSD;
+ const bool success = dsd_usb
? alsa_setup_dsd(ad, audio_format, &packed, &reverse_endian,
error_r)
: alsa_setup(ad, audio_format, &packed, &reverse_endian,
@@ -635,7 +634,7 @@ alsa_setup_or_dsd(struct alsa_data *ad, struct audio_format *audio_format,
pcm_export_open(&ad->export,
audio_format->format, audio_format->channels,
- false, packed, reverse_endian);
+ dsd_usb, packed, reverse_endian);
return true;
}