From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51784) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a2nSz-0004jW-3N for qemu-devel@nongnu.org; Sat, 28 Nov 2015 16:55:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a2nSx-0006lr-VE for qemu-devel@nongnu.org; Sat, 28 Nov 2015 16:55:36 -0500 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:58995) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a2nSx-0006kf-N6 for qemu-devel@nongnu.org; Sat, 28 Nov 2015 16:55:35 -0500 From: Peter Maydell Date: Sat, 28 Nov 2015 21:55:20 +0000 Message-Id: <1448747724-15572-2-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1448747724-15572-1-git-send-email-peter.maydell@linaro.org> References: <1448747724-15572-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PATCH 1/5] audio/coreaudio.c: Factor out use of AudioHardwareGetProperty List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: John Arbuckle , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Gerd Hoffmann , patches@linaro.org The CoreAudio function AudioHardwareGetProperty has been deprecated starting with OSX 10.6, so factor out our call to it so we can provide an equivalent with the new APIs when they exist. Signed-off-by: Peter Maydell --- audio/coreaudio.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/audio/coreaudio.c b/audio/coreaudio.c index 6dfd63e..433e009 100644 --- a/audio/coreaudio.c +++ b/audio/coreaudio.c @@ -50,6 +50,16 @@ typedef struct coreaudioVoiceOut { int rpos; } coreaudioVoiceOut; +static OSStatus coreaudio_get_voice(AudioDeviceID *id) +{ + UInt32 size = sizeof(*id); + + return AudioHardwareGetProperty( + kAudioHardwarePropertyDefaultOutputDevice, + &size, + id); +} + static void coreaudio_logstatus (OSStatus status) { const char *str = "BUG"; @@ -303,12 +313,7 @@ static int coreaudio_init_out(HWVoiceOut *hw, struct audsettings *as, audio_pcm_init_info (&hw->info, as); - /* open default output device */ - propertySize = sizeof(core->outputDeviceID); - status = AudioHardwareGetProperty( - kAudioHardwarePropertyDefaultOutputDevice, - &propertySize, - &core->outputDeviceID); + status = coreaudio_get_voice(&core->outputDeviceID); if (status != kAudioHardwareNoError) { coreaudio_logerr2 (status, typ, "Could not get default output Device\n"); -- 2.6.2