diff options
author | Max Kellermann <max@duempel.org> | 2011-01-07 17:15:37 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2011-01-07 17:31:36 +0100 |
commit | b5645ab29f4be93ef43d9995f03b48b942cdaa14 (patch) | |
tree | 553a0d0840e9293f2e613a2d6a13068775598aa5 | |
parent | 3149d1abf98a54e78a805f6c4b025b4d99bfd6f0 (diff) | |
download | mpd-b5645ab29f4be93ef43d9995f03b48b942cdaa14.tar.gz mpd-b5645ab29f4be93ef43d9995f03b48b942cdaa14.tar.xz mpd-b5645ab29f4be93ef43d9995f03b48b942cdaa14.zip |
output/osx: fix up audio format first, then apply it to device
This is a MPD 0.16 regression: when playing a 24 bit file, the switch
to 16 bit was made only partially, after mBytesPerPacket and
mBytesPerFrame had already been applied.
That means mBytesPerFrame referred to 24 bit, and mBitsPerChannel
referred to 16 bits. Of course, that cannot work.
Diffstat (limited to '')
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | src/output/osx_plugin.c | 19 |
2 files changed, 11 insertions, 9 deletions
@@ -7,6 +7,7 @@ ver 0.16.1 (2010/??/??) - mad: work around build failure on Solaris * output: - solaris: add missing parameter to open_cloexec() cal + - osx: fix up audio format first, then apply it to device ver 0.16 (2010/12/11) diff --git a/src/output/osx_plugin.c b/src/output/osx_plugin.c index 17d138d35..ce82656bd 100644 --- a/src/output/osx_plugin.c +++ b/src/output/osx_plugin.c @@ -214,15 +214,6 @@ osx_output_open(void *data, struct audio_format *audio_format, GError **error) stream_description.mSampleRate = audio_format->sample_rate; stream_description.mFormatID = kAudioFormatLinearPCM; stream_description.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger; -#if G_BYTE_ORDER == G_BIG_ENDIAN - stream_description.mFormatFlags |= kLinearPCMFormatFlagIsBigEndian; -#endif - - stream_description.mBytesPerPacket = - audio_format_frame_size(audio_format); - stream_description.mFramesPerPacket = 1; - stream_description.mBytesPerFrame = stream_description.mBytesPerPacket; - stream_description.mChannelsPerFrame = audio_format->channels; switch (audio_format->format) { case SAMPLE_FORMAT_S8: @@ -239,6 +230,16 @@ osx_output_open(void *data, struct audio_format *audio_format, GError **error) break; } +#if G_BYTE_ORDER == G_BIG_ENDIAN + stream_description.mFormatFlags |= kLinearPCMFormatFlagIsBigEndian; +#endif + + stream_description.mBytesPerPacket = + audio_format_frame_size(audio_format); + stream_description.mFramesPerPacket = 1; + stream_description.mBytesPerFrame = stream_description.mBytesPerPacket; + stream_description.mChannelsPerFrame = audio_format->channels; + result = AudioUnitSetProperty(od->au, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &stream_description, |