From patchwork Tue Dec 15 10:18:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 58421 Delivered-To: patch@linaro.org Received: by 10.112.129.4 with SMTP id ns4csp101509lbb; Tue, 15 Dec 2015 02:19:44 -0800 (PST) X-Received: by 10.140.105.36 with SMTP id b33mr50128263qgf.94.1450174784406; Tue, 15 Dec 2015 02:19:44 -0800 (PST) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id o199si558599qhb.20.2015.12.15.02.19.44 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 15 Dec 2015 02:19:44 -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]:36043 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8mhr-0002sd-UU for patch@linaro.org; Tue, 15 Dec 2015 05:19:43 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54448) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8mgm-0001py-EL for qemu-devel@nongnu.org; Tue, 15 Dec 2015 05:18:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a8mgk-0001KS-GA for qemu-devel@nongnu.org; Tue, 15 Dec 2015 05:18:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59802) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8mgk-0001KM-8I for qemu-devel@nongnu.org; Tue, 15 Dec 2015 05:18:34 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id BD6104C65E; Tue, 15 Dec 2015 10:18:33 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-35.ams2.redhat.com [10.36.116.35]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tBFAIWaT017346; Tue, 15 Dec 2015 05:18:33 -0500 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 010C780AC1; Tue, 15 Dec 2015 11:18:30 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 15 Dec 2015 11:18:28 +0100 Message-Id: <1450174708-20499-6-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.23 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 5/5] audio/coreaudio.c: Avoid deprecated AudioDeviceAdd/RemoveIOProc APIs 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 AudioDeviceAddIOProc() and AudioDeviceRemoveIOProc() functions were deprecated in OSX 10.5. Since we don't support any earlier versions of OSX, we can simply replace them with the new APIs AudioDeviceCreateIOProcID() and AudioDeviceRemoveIOProcID(). Signed-off-by: Peter Maydell Message-id: 1448747724-15572-6-git-send-email-peter.maydell@linaro.org Signed-off-by: Gerd Hoffmann --- audio/coreaudio.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) -- 1.8.3.1 diff --git a/audio/coreaudio.c b/audio/coreaudio.c index 32a997b..7150604 100644 --- a/audio/coreaudio.c +++ b/audio/coreaudio.c @@ -49,6 +49,7 @@ typedef struct coreaudioVoiceOut { AudioDeviceID outputDeviceID; UInt32 audioDevicePropertyBufferFrameSize; AudioStreamBasicDescription outputStreamBasicDescription; + AudioDeviceIOProcID ioprocid; int live; int decr; int rpos; @@ -598,8 +599,12 @@ static int coreaudio_init_out(HWVoiceOut *hw, struct audsettings *as, } /* set Callback */ - status = AudioDeviceAddIOProc(core->outputDeviceID, audioDeviceIOProc, hw); - if (status != kAudioHardwareNoError) { + core->ioprocid = NULL; + status = AudioDeviceCreateIOProcID(core->outputDeviceID, + audioDeviceIOProc, + hw, + &core->ioprocid); + if (status != kAudioHardwareNoError || core->ioprocid == NULL) { coreaudio_logerr2 (status, typ, "Could not set IOProc\n"); core->outputDeviceID = kAudioDeviceUnknown; return -1; @@ -607,10 +612,10 @@ static int coreaudio_init_out(HWVoiceOut *hw, struct audsettings *as, /* start Playback */ if (!isPlaying(core->outputDeviceID)) { - status = AudioDeviceStart(core->outputDeviceID, audioDeviceIOProc); + status = AudioDeviceStart(core->outputDeviceID, core->ioprocid); if (status != kAudioHardwareNoError) { coreaudio_logerr2 (status, typ, "Could not start playback\n"); - AudioDeviceRemoveIOProc(core->outputDeviceID, audioDeviceIOProc); + AudioDeviceDestroyIOProcID(core->outputDeviceID, core->ioprocid); core->outputDeviceID = kAudioDeviceUnknown; return -1; } @@ -628,15 +633,15 @@ static void coreaudio_fini_out (HWVoiceOut *hw) if (!isAtexit) { /* stop playback */ if (isPlaying(core->outputDeviceID)) { - status = AudioDeviceStop(core->outputDeviceID, audioDeviceIOProc); + status = AudioDeviceStop(core->outputDeviceID, core->ioprocid); if (status != kAudioHardwareNoError) { coreaudio_logerr (status, "Could not stop playback\n"); } } /* remove callback */ - status = AudioDeviceRemoveIOProc(core->outputDeviceID, - audioDeviceIOProc); + status = AudioDeviceDestroyIOProcID(core->outputDeviceID, + core->ioprocid); if (status != kAudioHardwareNoError) { coreaudio_logerr (status, "Could not remove IOProc\n"); } @@ -659,7 +664,7 @@ static int coreaudio_ctl_out (HWVoiceOut *hw, int cmd, ...) case VOICE_ENABLE: /* start playback */ if (!isPlaying(core->outputDeviceID)) { - status = AudioDeviceStart(core->outputDeviceID, audioDeviceIOProc); + status = AudioDeviceStart(core->outputDeviceID, core->ioprocid); if (status != kAudioHardwareNoError) { coreaudio_logerr (status, "Could not resume playback\n"); } @@ -670,7 +675,8 @@ static int coreaudio_ctl_out (HWVoiceOut *hw, int cmd, ...) /* stop playback */ if (!isAtexit) { if (isPlaying(core->outputDeviceID)) { - status = AudioDeviceStop(core->outputDeviceID, audioDeviceIOProc); + status = AudioDeviceStop(core->outputDeviceID, + core->ioprocid); if (status != kAudioHardwareNoError) { coreaudio_logerr (status, "Could not pause playback\n"); }