[MPlayer-users] audio not available on mac

thyme pancakes newsbought at hotmail.com
Fri Jan 19 16:20:10 CET 2007


Well I have finally upgraded to Tiger which means I could check what value 
AudioUnitGetProperty was supposed to be returning on Panther and I've fixed 
the code so that it works properly and in a way that makes sense.
(see thread here:
http://lists.mplayerhq.hu/pipermail/mplayer-users/2007-January/064778.html
in case this post is lost without a parent)

Problem is, I no longer have panther to test the good code on. Could 
somebody try this out?

This was libao2/ao_macosx.c, from line 304:
-------------------------------------------------------------
	size = sizeof(UInt32);
	err = AudioUnitGetProperty(ao->theOutputUnit, 
kAudioDevicePropertyBufferSize, kAudioUnitScope_Input, 0, &maxFrames, 
&size);

	if (err)
	{
		ao_msg(MSGT_AO,MSGL_WARN, "AudioUnitGetProperty returned %d when getting 
kAudioDevicePropertyBufferSize\n", (int)err);
		return CONTROL_FALSE;
	}
	ao->chunk_size = maxFrames;//*inDesc.mBytesPerFrame;
-------------------------------------------------------------

This is the make sense version without the "verge of deprecated" 
kAudioDevicePropertyBufferSize.

-------------------------------------------------------------
/*Initialized the device, set the charecteristics for the input stream,
  now examine the output stream to get bytes per frame
*/
	size =  sizeof(AudioStreamBasicDescription);
	err = AudioUnitGetProperty(ao->theOutputUnit, 
kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 0, &outDesc, 
&size);
	if (err) {
		ao_msg(MSGT_AO, MSGL_WARN, "Unable to get the output format (err=%d)\n", 
err);
		return CONTROL_FALSE;
	}
/*
Now lets query the number of frames the output device has got on hold
*/
	size = sizeof(UInt32);
	maxFrames = 0;
	err = AudioUnitGetProperty(ao->theOutputUnit, 
kAudioDevicePropertyBufferFrameSize, kAudioUnitScope_Input, 0, &maxFrames, 
&size);
	if (err)
	{
		ao_msg(MSGT_AO,MSGL_WARN, "AudioUnitGetProperty returned %d when getting 
kAudioDevicePropertyBufferFrameSize\n", (int)err);
		return CONTROL_FALSE;
	}
/*
Now combine the two to produce the chunk size
*/
	ao->chunk_size = maxFrames * outDesc.mBytesPerFrame;
//debug. Comment or erase this out later
	ao_msg(MSGT_AO,MSGL_WARN, "AudioUnitGetProperty succeeded. Returned %d %d 
%d", (int)ao->chunk_size, (int)maxFrames, (int)outDesc.mBytesPerFrame);
//debug
-------------------------------------------------------------
Can someone test this on an older kitty?

_________________________________________________________________
Your Space. Your Friends. Your Stories. Share your world with Windows Live 
Spaces. http://discoverspaces.live.com/?loc=en-CA




More information about the MPlayer-users mailing list