comparison libao2/ao_macosx.c @ 12788:a6ff4398e4e6

enables resampling of audio in ao_macosx by Dan Christiansen
author nplourde
date Sat, 10 Jul 2004 00:23:19 +0000
parents 99798c3cdb93
children 997adf3656e2
comparison
equal deleted inserted replaced
12787:7aa852ffba45 12788:a6ff4398e4e6
62 /* Prefix for all mp_msg() calls */ 62 /* Prefix for all mp_msg() calls */
63 #define ao_msg(a, b, c...) mp_msg(a, b, "AO: [macosx] " c) 63 #define ao_msg(a, b, c...) mp_msg(a, b, "AO: [macosx] " c)
64 64
65 /* This is large, but best (maybe it should be even larger). 65 /* This is large, but best (maybe it should be even larger).
66 * CoreAudio supposedly has an internal latency in the order of 2ms */ 66 * CoreAudio supposedly has an internal latency in the order of 2ms */
67 #define NUM_BUFS 128 67 #define NUM_BUFS 16
68 68
69 typedef struct ao_macosx_s 69 typedef struct ao_macosx_s
70 { 70 {
71 /* CoreAudio */ 71 /* CoreAudio */
72 AudioDeviceID outputDeviceID; 72 AudioDeviceID outputDeviceID;
241 ao_msg(MSGT_AO,MSGL_WARN, "AudioDeviceGetProperty returned %d when getting kAudioDevicePropertyBufferSize\n", (int)status); 241 ao_msg(MSGT_AO,MSGL_WARN, "AudioDeviceGetProperty returned %d when getting kAudioDevicePropertyBufferSize\n", (int)status);
242 return CONTROL_FALSE; 242 return CONTROL_FALSE;
243 } 243 }
244 ao_msg(MSGT_AO,MSGL_V, "%5d ao->buffer_len\n", (int)ao->buffer_len); 244 ao_msg(MSGT_AO,MSGL_V, "%5d ao->buffer_len\n", (int)ao->buffer_len);
245 245
246 /* FIXME: 246 ao_data.samplerate = ao->outputStreamBasicDescription.mSampleRate;
247 *
248 * Resampling of 32-bit float audio is broken in MPlayer. Refuse to
249 * handle anything other than the native format until this is fixed
250 * or this module is rewritten, whichever comes first.
251 */
252 if (ao_data.samplerate == ao->outputStreamBasicDescription.mSampleRate) {
253 ao_data.samplerate = (int)ao->outputStreamBasicDescription.mSampleRate;
254 } else {
255 ao_msg(MSGT_AO,MSGL_WARN, "Resampling not supported yet.\n");
256 return 0;
257 }
258
259 ao_data.channels = ao->outputStreamBasicDescription.mChannelsPerFrame; 247 ao_data.channels = ao->outputStreamBasicDescription.mChannelsPerFrame;
260 ao_data.outburst = ao_data.buffersize = ao->buffer_len; 248 ao_data.outburst = ao_data.buffersize = ao->buffer_len;
261 ao_data.bps = 249 ao_data.bps =
262 ao_data.samplerate * ao->outputStreamBasicDescription.mBytesPerFrame; 250 ao_data.samplerate * ao->outputStreamBasicDescription.mBytesPerFrame;
263 251