From patchwork Wed Jan 16 23:37:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?UTF-8?B?Wm9sdMOhbiBLxZF2w6Fnw7M=?= X-Patchwork-Id: 1026312 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ZvF3OS5T"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43g4273vhWz9sCX for ; Thu, 17 Jan 2019 10:59:43 +1100 (AEDT) Received: from localhost ([127.0.0.1]:36435 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjv5x-00041B-F0 for incoming@patchwork.ozlabs.org; Wed, 16 Jan 2019 18:59:41 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58207) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjul4-0004MD-Rx for qemu-devel@nongnu.org; Wed, 16 Jan 2019 18:38:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjul3-0003Od-IH for qemu-devel@nongnu.org; Wed, 16 Jan 2019 18:38:06 -0500 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:39776) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gjukz-0003Dw-Kj for qemu-devel@nongnu.org; Wed, 16 Jan 2019 18:38:03 -0500 Received: by mail-wm1-x341.google.com with SMTP id y8so3854222wmi.4 for ; Wed, 16 Jan 2019 15:37:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=P3sISsyPGyI6dDd861yACBt9mzegFzKQghZpd8A4G8Q=; b=ZvF3OS5TZD0g+mR5tzAZzBZrS4SCSVaw3SAz+QeDctZ9uuHAxx+3TjEhIpNaz+EGdb T223Gknw2lapA2KbPGXcOgToTJ+/Rp0crvwMVx3mQl3hGa7maYFEBP8agJMB5QYoXfis qT2QMNbFTNOw21XvX/xzRlMvSVUyTGXN8vaOuXdR7tz17Xaf5gQ/FgyxsH2k9KjCo8x2 x/wqImueN5+rg8OltsHkydVMa0irRihtw6v1b8/LHwweRSG/J6eXMLP0kbaXYjdYtSb8 W/+CD7q6lKeN7drPuoveiSB+8ynHJIU+Bu1Z3QXxwkJ1RYcSI4PI3/Zyja8i5999Z3ul qbDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=P3sISsyPGyI6dDd861yACBt9mzegFzKQghZpd8A4G8Q=; b=IZfqB6a3hR025Brn5l/FJWRHx6GEqAVIdCV4seHz834gGhmXqBlGjcs10bcVPrG/f8 x2szjT31kQRkOfiXAj+rA3Y0B2zQAG1at29xzcvh1OC6ZAZc9skgR+GhJ2JsnCQZstKw 2aExVsiNKov89Js77fAdLF9ktX7DkkG9hTPwsDBOIYjawMZxeguzgUyKiTU/FhLAGGZ/ JwMgJhk9WBdGctRWylbCp7nzs1rs/ePV+TeHCUvHn0G2nBETLtaoSDsaDmrRRVnWAmJj IuPzIICRAilLULXkW5LtNmm69EcHr9niTszaMA0SyQOxeqIlTG0FQZrbPtOKA7lUYCot 3jiQ== X-Gm-Message-State: AJcUukcy1U8lfA3B7mwKW4JbHtK9rHFsIRJaOcEVaJT2WYGA3wEPM4Qi LP6uE/10dJycONb1AHCOXCw2MIWw7wY= X-Google-Smtp-Source: ALg8bN7jsG95eolsnyvXDKs0RDlhW5s8ggZIqIzpSl3bv9OstAPAcTh9gdKQatUcLVoyJKQO240y3g== X-Received: by 2002:a1c:7f0c:: with SMTP id a12mr9050991wmd.89.1547681877657; Wed, 16 Jan 2019 15:37:57 -0800 (PST) Received: from nullptr.home.dirty-ice.org (2a01-036c-0113-e4b0-0000-0000-0000-0005.pool6.digikabel.hu. [2a01:36c:113:e4b0::5]) by smtp.gmail.com with ESMTPSA id s66sm30760437wmf.34.2019.01.16.15.37.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Jan 2019 15:37:57 -0800 (PST) From: "=?UTF-8?q?K=C5=91v=C3=A1g=C3=B3=2C=20Zolt=C3=A1n?=" X-Google-Original-From: =?utf-8?b?S8WRdsOhZ8OzLCBab2x0w6Fu?= To: qemu-devel@nongnu.org Date: Thu, 17 Jan 2019 00:37:09 +0100 Message-Id: <145498a842625fd7e025660dafce06db2edaf196.1547681517.git.DirtY.iCE.hu@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 Subject: [Qemu-devel] [PATCH v3 36/50] audio: remove remains of the old backend api X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Kővágó, Zoltán --- audio/audio_int.h | 7 ------- audio/audio.c | 42 ++++++------------------------------------ 2 files changed, 6 insertions(+), 43 deletions(-) diff --git a/audio/audio_int.h b/audio/audio_int.h index 056c63d45c..1f6ec15e18 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -152,7 +152,6 @@ struct audio_driver { struct audio_pcm_ops { int (*init_out)(HWVoiceOut *hw, audsettings *as, void *drv_opaque); void (*fini_out)(HWVoiceOut *hw); - size_t (*run_out)(HWVoiceOut *hw, size_t live); size_t (*write) (HWVoiceOut *hw, void *buf, size_t size); /* * get a buffer that after later can be passed to put_buffer_out; optional @@ -170,7 +169,6 @@ struct audio_pcm_ops { int (*init_in) (HWVoiceIn *hw, audsettings *as, void *drv_opaque); void (*fini_in) (HWVoiceIn *hw); - size_t (*run_in)(HWVoiceIn *hw); size_t (*read) (HWVoiceIn *hw, void *buf, size_t size); void *(*get_buffer_in)(HWVoiceIn *hw, size_t *size); void (*put_buffer_in)(HWVoiceIn *hw, void *buf, size_t size); @@ -236,11 +234,6 @@ audio_driver *audio_driver_lookup(const char *name); void audio_pcm_init_info (struct audio_pcm_info *info, struct audsettings *as); void audio_pcm_info_clear_buf (struct audio_pcm_info *info, void *buf, int len); -size_t audio_pcm_hw_get_live_in(HWVoiceIn *hw); - -size_t audio_pcm_hw_clip_out(HWVoiceOut *hw, void *pcm_buf, - size_t live, size_t pending); - int audio_bug (const char *funcname, int cond); void *audio_calloc (const char *funcname, int nmemb, size_t size); diff --git a/audio/audio.c b/audio/audio.c index f4d538618f..8bfc122e60 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -542,7 +542,7 @@ static size_t audio_pcm_hw_find_min_in (HWVoiceIn *hw) return m; } -size_t audio_pcm_hw_get_live_in(HWVoiceIn *hw) +static size_t audio_pcm_hw_get_live_in(HWVoiceIn *hw) { size_t live = hw->total_samples_captured - audio_pcm_hw_find_min_in (hw); if (audio_bug(__func__, live > hw->samples)) { @@ -552,29 +552,7 @@ size_t audio_pcm_hw_get_live_in(HWVoiceIn *hw) return live; } -size_t audio_pcm_hw_clip_out(HWVoiceOut *hw, void *pcm_buf, - size_t live, size_t pending) -{ - size_t left = hw->samples - pending; - size_t len = MIN (left, live); - size_t clipped = 0; - - while (len) { - struct st_sample *src = hw->mix_buf + hw->rpos; - uint8_t *dst = advance (pcm_buf, hw->rpos << hw->info.shift); - size_t samples_till_end_of_buf = hw->samples - hw->rpos; - size_t samples_to_clip = MIN (len, samples_till_end_of_buf); - - hw->clip (dst, src, samples_to_clip); - - hw->rpos = (hw->rpos + samples_to_clip) % hw->samples; - len -= samples_to_clip; - clipped += samples_to_clip; - } - return clipped; -} - -static void audio_pcm_hw_clip_out2(HWVoiceOut *hw, void *pcm_buf, size_t len) +static void audio_pcm_hw_clip_out(HWVoiceOut *hw, void *pcm_buf, size_t len) { size_t clipped = 0; size_t pos = hw->rpos; @@ -1079,7 +1057,7 @@ static size_t audio_pcm_hw_run_out(HWVoiceOut *hw, size_t live) void *buf = hw->pcm_ops->get_buffer_out(hw, &size); decr = MIN(size >> hw->info.shift, live); - audio_pcm_hw_clip_out2(hw, buf, decr); + audio_pcm_hw_clip_out(hw, buf, decr); proc = hw->pcm_ops->put_buffer_out(hw, buf, decr << hw->info.shift) >> hw->info.shift; @@ -1142,11 +1120,7 @@ static void audio_run_out (AudioState *s) } prev_rpos = hw->rpos; - if (hw->pcm_ops->run_out) { - played = hw->pcm_ops->run_out(hw, live); - } else { - played = audio_pcm_hw_run_out(hw, live); - } + played = audio_pcm_hw_run_out(hw, live); replay_audio_out(&played); if (audio_bug(__func__, hw->rpos >= hw->samples)) { dolog("hw->rpos=%zu hw->samples=%zu played=%zu\n", @@ -1243,12 +1217,8 @@ static void audio_run_in (AudioState *s) size_t captured = 0, min; if (replay_mode != REPLAY_MODE_PLAY) { - if (hw->pcm_ops->run_in) { - captured = hw->pcm_ops->run_in(hw); - } else { - captured = audio_pcm_hw_run_in( - hw, hw->samples - audio_pcm_hw_get_live_in(hw)); - } + captured = audio_pcm_hw_run_in( + hw, hw->samples - audio_pcm_hw_get_live_in(hw)); } replay_audio_in(&captured, hw->conv_buf, &hw->wpos, hw->samples);