From patchwork Sat Nov 28 21:55:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 57389 Delivered-To: patches@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp618333lbb; Sat, 28 Nov 2015 13:55:33 -0800 (PST) X-Received: by 10.107.30.80 with SMTP id e77mr51787892ioe.180.1448747730837; Sat, 28 Nov 2015 13:55:30 -0800 (PST) Return-Path: Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id o35si2142170ioi.152.2015.11.28.13.55.29 for (version=TLS1_2 cipher=AES128-SHA bits=128/128); Sat, 28 Nov 2015 13:55:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::1 as permitted sender) client-ip=2001:8b0:1d0::1; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::1 as permitted sender) smtp.mailfrom=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1a2nSm-00043h-KP; Sat, 28 Nov 2015 21:55:24 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, =?UTF-8?q?Andreas=20F=C3=A4rber?= , John Arbuckle , Gerd Hoffmann Subject: [PATCH 1/5] audio/coreaudio.c: Factor out use of AudioHardwareGetProperty Date: Sat, 28 Nov 2015 21:55:20 +0000 Message-Id: <1448747724-15572-2-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1448747724-15572-1-git-send-email-peter.maydell@linaro.org> References: <1448747724-15572-1-git-send-email-peter.maydell@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(-) -- 2.6.2 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");