[MPlayer-dev-eng] [PATCH RESEND] Mac OS X: fix libao2 compilation on Mac OS X 10.4

Aaro Koskinen aaro.koskinen at iki.fi
Sun Dec 19 15:38:52 CET 2010


Hello,

On Wed, 15 Dec 2010, Diego Biurrun wrote:
> On Fri, Dec 10, 2010 at 11:48:55PM +0200, Aaro Koskinen wrote:
>> The patch below fixes mplayer compilation on Mac OS X 10.4 (it has been
>> broken since r31713). Please apply - it should not change anything on
>> newer Mac OS X versions.
>
> Apparently you do actually use 10.4, but - I'm curious - why?

Mainly because I have some old Macs which are not supported by newer
Mac OS X versions.

>> --- libao2/ao_coreaudio.c	(revision 32667)
>> +++ libao2/ao_coreaudio.c	(working copy)
>> @@ -68,6 +68,23 @@
>>  /* Prefix for all mp_msg() calls */
>>  #define ao_msg(a, b, c...) mp_msg(a, b, "AO: [coreaudio] " c)
>>
>> +#if MAC_OS_X_VERSION_MAX_ALLOWED <= 1040
>> +/*
>> + * AudioDeviceIOProcID does not exist in Mac OS X 10.4. We can emulate this
>> + * by using AudioDeviceAddIOProc() and AudioDeviceRemoveIOProc().
>
> Wouldn't it be more portable to implement it this way for all OS X versions?

Based on commit r31713 the old functions are deprecated on newer versions
(however not yet on 10.4), which probably means you'll get compilation
warnings and probably at some point they will be removed.

>> + */
>> +#define AudioDeviceIOProcID AudioDeviceIOProc
>> +#define AudioDeviceDestroyIOProcID AudioDeviceRemoveIOProc
>> +static OSStatus AudioDeviceCreateIOProcID(AudioDeviceID dev,
>> +					  AudioDeviceIOProc proc,
>> +					  void *data,
>> +					  AudioDeviceIOProcID *procid)
>> +{
>> +	*procid = proc;
>> +	return AudioDeviceAddIOProc(dev, proc, data);
>
> Why the procid variable indirection?

The procid is an output parameter returning a handle to the caller which
is used for removal.

>> +}
>> +#endif
>> +
>>  typedef struct ao_coreaudio_s
>>  {
>
> Please place your function below the struct declaration.

I can move it if that's needed, I just wanted to avoid creating multiple
#if ... #endif sections.

A.


More information about the MPlayer-dev-eng mailing list