From 22ff0d80ce3409ba158a15d63b03e98ae11d0573 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 10 Jun 2016 22:59:45 +0200 Subject: [PATCH] decoder/pcm: add MIME type "audio/x-mpd-float" --- NEWS | 2 +- doc/user.xml | 4 +++- src/decoder/plugins/PcmDecoderPlugin.cxx | 10 +++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 132005978..aba3c5609 100644 --- a/NEWS +++ b/NEWS @@ -23,7 +23,7 @@ ver 0.20 (not yet released) - gme: add option "accuracy" - mad: reduce memory usage while scanning tags - mpcdec: read the bit rate - - pcm: support audio/L16 (RFC 2586) + - pcm: support audio/L16 (RFC 2586) and audio/x-mpd-float * playlist - cue: don't skip pregap - embcue: fix last track diff --git a/doc/user.xml b/doc/user.xml index c941be86b..e126f76c8 100644 --- a/doc/user.xml +++ b/doc/user.xml @@ -1944,7 +1944,9 @@ buffer_size: 16384 Read raw PCM samples. It understands the "audio/L16" MIME type with parameters "rate" and "channels" according to RFC - 2586. + 2586. It also understands the + MPD-specific MIME type + "audio/x-mpd-float". diff --git a/src/decoder/plugins/PcmDecoderPlugin.cxx b/src/decoder/plugins/PcmDecoderPlugin.cxx index 3fbfc30d0..62abfa8d0 100644 --- a/src/decoder/plugins/PcmDecoderPlugin.cxx +++ b/src/decoder/plugins/PcmDecoderPlugin.cxx @@ -45,11 +45,16 @@ pcm_stream_decode(Decoder &decoder, InputStream &is) const bool l16 = mime != nullptr && GetMimeTypeBase(mime) == "audio/L16"; - if (l16) { + const bool is_float = mime != nullptr && + GetMimeTypeBase(mime) == "audio/x-mpd-float"; + if (l16 || is_float) { audio_format.sample_rate = 0; audio_format.channels = 1; } + if (is_float) + audio_format.format = SampleFormat::FLOAT; + { const auto mime_parameters = ParseMimeTypeParameters(mime); Error error; @@ -154,6 +159,9 @@ static const char *const pcm_mime_types[] = { /* RFC 2586 */ "audio/L16", + /* MPD-specific: float32 native-endian */ + "audio/x-mpd-float", + /* for streams obtained by the cdio_paranoia input plugin */ "audio/x-mpd-cdda-pcm",