audio_format: hack for DSD to USB conversion

Halve the sample rate for *:dsdusb:*.
This commit is contained in:
Max Kellermann 2012-03-21 10:01:38 +01:00
parent 777e1cabc5
commit a29c64b6c7

View File

@ -35,6 +35,15 @@ audio_format_mask_apply(struct audio_format *af,
assert(audio_format_valid(af));
assert(audio_format_mask_valid(mask));
if (af->format == SAMPLE_FORMAT_DSD &&
mask->format == SAMPLE_FORMAT_DSD_OVER_USB &&
mask->sample_rate == 0)
/* each DSD-over-USB sample contains 2 DSD bytes (16
DSD bits), which means the sample rate must be
halved; this is not the real 1 bit sample rate, but
MPD's point of view */
af->sample_rate /= 2;
if (mask->sample_rate != 0)
af->sample_rate = mask->sample_rate;