From patchwork Tue Dec 15 10:18:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 58422 Delivered-To: patch@linaro.org Received: by 10.112.129.4 with SMTP id ns4csp101535lbb; Tue, 15 Dec 2015 02:19:47 -0800 (PST) X-Received: by 10.55.80.68 with SMTP id e65mr51219543qkb.46.1450174787785; Tue, 15 Dec 2015 02:19:47 -0800 (PST) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id g203si525882qhc.91.2015.12.15.02.19.47 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 15 Dec 2015 02:19:47 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Received: from localhost ([::1]:36044 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8mhv-0002z1-HQ for patch@linaro.org; Tue, 15 Dec 2015 05:19:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54446) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8mgm-0001pw-EG for qemu-devel@nongnu.org; Tue, 15 Dec 2015 05:18:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a8mgj-0001Js-6f for qemu-devel@nongnu.org; Tue, 15 Dec 2015 05:18:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33494) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8mgj-0001Jg-1g for qemu-devel@nongnu.org; Tue, 15 Dec 2015 05:18:33 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 7B96B3798BE; Tue, 15 Dec 2015 10:18:32 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-35.ams2.redhat.com [10.36.116.35]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tBFAIVx9030956; Tue, 15 Dec 2015 05:18:32 -0500 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id B96EA80579; Tue, 15 Dec 2015 11:18:30 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 15 Dec 2015 11:18:24 +0100 Message-Id: <1450174708-20499-2-git-send-email-kraxel@redhat.com> In-Reply-To: <1450174708-20499-1-git-send-email-kraxel@redhat.com> References: <1450174708-20499-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Peter Maydell , Gerd Hoffmann Subject: [Qemu-devel] [PULL 1/5] audio/coreaudio.c: Factor out use of AudioHardwareGetProperty X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Peter Maydell 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 Message-id: 1448747724-15572-2-git-send-email-peter.maydell@linaro.org Signed-off-by: Gerd Hoffmann --- audio/coreaudio.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) -- 1.8.3.1 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");