decoder/pcm: add MIME type "audio/x-mpd-float"

This commit is contained in:
Max Kellermann 2016-06-10 22:59:45 +02:00
parent 5a22a0c27d
commit 22ff0d80ce
3 changed files with 13 additions and 3 deletions

2
NEWS
View File

@ -23,7 +23,7 @@ ver 0.20 (not yet released)
- gme: add option "accuracy" - gme: add option "accuracy"
- mad: reduce memory usage while scanning tags - mad: reduce memory usage while scanning tags
- mpcdec: read the bit rate - mpcdec: read the bit rate
- pcm: support audio/L16 (RFC 2586) - pcm: support audio/L16 (RFC 2586) and audio/x-mpd-float
* playlist * playlist
- cue: don't skip pregap - cue: don't skip pregap
- embcue: fix last track - embcue: fix last track

View File

@ -1944,7 +1944,9 @@ buffer_size: 16384</programlisting>
<para> <para>
Read raw PCM samples. It understands the "audio/L16" MIME Read raw PCM samples. It understands the "audio/L16" MIME
type with parameters "rate" and "channels" according to RFC type with parameters "rate" and "channels" according to RFC
2586. 2586. It also understands the
<application>MPD</application>-specific MIME type
"audio/x-mpd-float".
</para> </para>
</section> </section>

View File

@ -45,11 +45,16 @@ pcm_stream_decode(Decoder &decoder, InputStream &is)
const bool l16 = mime != nullptr && const bool l16 = mime != nullptr &&
GetMimeTypeBase(mime) == "audio/L16"; 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.sample_rate = 0;
audio_format.channels = 1; audio_format.channels = 1;
} }
if (is_float)
audio_format.format = SampleFormat::FLOAT;
{ {
const auto mime_parameters = ParseMimeTypeParameters(mime); const auto mime_parameters = ParseMimeTypeParameters(mime);
Error error; Error error;
@ -154,6 +159,9 @@ static const char *const pcm_mime_types[] = {
/* RFC 2586 */ /* RFC 2586 */
"audio/L16", "audio/L16",
/* MPD-specific: float32 native-endian */
"audio/x-mpd-float",
/* for streams obtained by the cdio_paranoia input plugin */ /* for streams obtained by the cdio_paranoia input plugin */
"audio/x-mpd-cdda-pcm", "audio/x-mpd-cdda-pcm",