decoder/pcm: assume that audio/L16 is big-endian

See https://bugs.musicpd.org/view.php?id=4547
This commit is contained in:
Max Kellermann 2016-07-01 21:34:56 +02:00
parent 3a21241248
commit 34e91850d9

View File

@ -22,6 +22,7 @@
#include "../DecoderAPI.hxx"
#include "CheckAudioFormat.hxx"
#include "input/InputStream.hxx"
#include "system/ByteOrder.hxx"
#include "util/Error.hxx"
#include "util/ByteReverse.hxx"
#include "util/NumberParser.hxx"
@ -40,8 +41,6 @@ pcm_stream_decode(Decoder &decoder, InputStream &is)
};
const char *const mime = is.GetMimeType();
const bool reverse_endian = mime != nullptr &&
strcmp(mime, "audio/x-mpd-cdda-pcm-reverse") == 0;
const bool l16 = mime != nullptr &&
GetMimeTypeBase(mime) == "audio/L16";
@ -52,6 +51,10 @@ pcm_stream_decode(Decoder &decoder, InputStream &is)
audio_format.channels = 1;
}
const bool reverse_endian = (l16 && IsLittleEndian()) ||
(mime != nullptr &&
strcmp(mime, "audio/x-mpd-cdda-pcm-reverse") == 0);
if (is_float)
audio_format.format = SampleFormat::FLOAT;