# HG changeset patch # User reimar # Date 1263237993 0 # Node ID 53c43f683cd737106d278f51b971598edba7a906 # Parent 9d09ff127c25b24343a2a75d272d7dddf8cad3ac Use af_fmt2bits instead of reimplementing it. diff -r 9d09ff127c25 -r 53c43f683cd7 libao2/ao_coreaudio.c --- a/libao2/ao_coreaudio.c Mon Jan 11 19:23:18 2010 +0000 +++ b/libao2/ao_coreaudio.c Mon Jan 11 19:26:33 2010 +0000 @@ -314,23 +314,7 @@ inDesc.mSampleRate=rate; inDesc.mFormatID=ao->b_supports_digital ? kAudioFormat60958AC3 : kAudioFormatLinearPCM; inDesc.mChannelsPerFrame=channels; - switch(format&AF_FORMAT_BITS_MASK){ - case AF_FORMAT_8BIT: - inDesc.mBitsPerChannel=8; - break; - case AF_FORMAT_16BIT: - inDesc.mBitsPerChannel=16; - break; - case AF_FORMAT_24BIT: - inDesc.mBitsPerChannel=24; - break; - case AF_FORMAT_32BIT: - inDesc.mBitsPerChannel=32; - break; - default: - ao_msg(MSGT_AO, MSGL_WARN, "Unsupported format (0x%08x)\n", format); - goto err_out; - } + inDesc.mBitsPerChannel=af_fmt2bits(format); if((format&AF_FORMAT_POINT_MASK)==AF_FORMAT_F) { // float