From 8058998e1ae71adbc8c7cfc5fd69856707260ef7 Mon Sep 17 00:00:00 2001 From: Claudio Matsuoka Date: Thu, 23 Oct 2014 17:40:34 -0200 Subject: [PATCH] Address deprecated call warnings in CoreAudio driver Signed-off-by: Claudio Matsuoka --- Changelog | 3 +++ configure.ac | 2 +- src/sound_coreaudio.c | 18 +++++++++++++----- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Changelog b/Changelog index 0c88e21..dca134a 100644 --- a/Changelog +++ b/Changelog @@ -1,6 +1,9 @@ Stable versions --------------- +4.0.10 (): + - Update deprecated calls in CoreAudio driver + 4.0.9 (20140926): - Add option '-p' to set the default pan amplitude - Add parameter 'default_pan' to configuration file diff --git a/configure.ac b/configure.ac index c60328b..c7372f1 100644 --- a/configure.ac +++ b/configure.ac @@ -137,7 +137,7 @@ amigaos*|aros) AM_CONDITIONAL([SOUND_AHI], [true]) ;; darwin*) - AC_CHECK_HEADER(CoreAudio/CoreAudio.h) + AC_CHECK_HEADERS(AudioUnit/AudioComponent.h CoreAudio/CoreAudio.h) if test "${ac_cv_header_CoreAudio_CoreAudio_h}" = "yes"; then AC_DEFINE(SOUND_COREAUDIO) AM_CONDITIONAL([SOUND_COREAUDIO], [true]) diff --git a/src/sound_coreaudio.c b/src/sound_coreaudio.c index cfd5dc1..1c77ea8 100644 --- a/src/sound_coreaudio.c +++ b/src/sound_coreaudio.c @@ -15,6 +15,14 @@ static AudioUnit au; +#ifndef HAVE_AUDIOUNIT_AUDIOCOMPONENT_H +#define AudioComponent Component +#define AudioComponentDescription ComponentDescription +#define AudioComponentFindNext FindNextComponent +#define AudioComponentInstanceNew OpenAComponent +#define AudioComponentInstanceDispose CloseComponent +#endif + /* * CoreAudio helpers by Timothy J. Wood from mplayer/libao * The player fills a ring buffer, OSX retrieves data from the buffer @@ -121,8 +129,8 @@ OSStatus render_proc(void *inRefCon, static int init(struct options *options) { AudioStreamBasicDescription ad; - Component comp; - ComponentDescription cd; + AudioComponent comp; + AudioComponentDescription cd; AURenderCallbackStruct rc; OSStatus err; UInt32 size, max_frames; @@ -160,12 +168,12 @@ static int init(struct options *options) cd.componentFlags = 0; cd.componentFlagsMask = 0; - if ((comp = FindNextComponent(NULL, &cd)) == NULL) { + if ((comp = AudioComponentFindNext(NULL, &cd)) == NULL) { fprintf(stderr, "error: FindNextComponent\n"); return -1; } - if ((err = OpenAComponent(comp, &au))) { + if ((err = AudioComponentInstanceNew(comp, &au))) { fprintf(stderr, "error: OpenAComponent (%d)\n", (int)err); return -1; } @@ -250,7 +258,7 @@ static void deinit(void) { AudioOutputUnitStop(au); AudioUnitUninitialize(au); - CloseComponent(au); + AudioComponentInstanceDispose(au); free(buffer); }