From patchwork Fri Mar 8 22:34:25 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: 10845539 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 79C0A14E1 for ; Fri, 8 Mar 2019 22:46:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66D59306DE for ; Fri, 8 Mar 2019 22:46:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 64D3D306CA; Fri, 8 Mar 2019 22:46:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A33AA305A1 for ; Fri, 8 Mar 2019 22:46:20 +0000 (UTC) Received: from localhost ([127.0.0.1]:50965 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h2OFw-0000qE-5g for patchwork-qemu-devel@patchwork.kernel.org; Fri, 08 Mar 2019 17:46:20 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38748) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h2O4n-0007tj-Bj for qemu-devel@nongnu.org; Fri, 08 Mar 2019 17:34:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h2O4k-0002j3-Hv for qemu-devel@nongnu.org; Fri, 08 Mar 2019 17:34:49 -0500 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:33226) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h2O4h-0002fn-IW for qemu-devel@nongnu.org; Fri, 08 Mar 2019 17:34:45 -0500 Received: by mail-wm1-x343.google.com with SMTP id c13so9858973wmb.0 for ; Fri, 08 Mar 2019 14:34:41 -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=wxIu56HmMTAmUDUnm4qtPAz0v2l8dKOwcPabL+bUGBk=; b=IPhhrSnvCTU459IwlSiCPeQsaiA9ODGAlYE5eJjkycM9T53TtBsNwaxtv2ZdObgAyZ mdDzuxWSP/s1wZZY8U6ZiKB0Di3UIp6rsXLFI3YUTccD1vBtn30Yf7iE7/BmE7wE+4wS aqXwHupju2jj03KaIG61puuhbyTubr/yl3ANyTHIyV+EmOPWvolTrUxx6pgNyOtH1LjZ vxKjf6WJoyuv3S0nwV61k6aWKvexSoxA+L6onX3ck1dPBrow6SziaAmuhmyMlSu+W2MA +Cwm/Ub3FU5xxokG2Ookxzga9i0+JQUhGk9YJ70e1Krzb4Z86QnWVy7NLEBhA8l5Q9DI MknA== 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=wxIu56HmMTAmUDUnm4qtPAz0v2l8dKOwcPabL+bUGBk=; b=SGKWKgnFwfqePOWmlfBsMLPIP0g8HW0Pqhu9wQoaVbBYn5lXYcBx2S6OIxoi15DITW SiBTDghY8v9F6Ky5cxQ4drN9rB14wBr4FmqUGQtrfZzrHDTEQAmL1raiizgdxge0jPFX 3L5j97MP51Nkq0EEfpnK5iS5G/gtmItOnto9KllO3Ky3arQRAvZTz0/6MnH1qnEtDdE/ vX/vQnyV8/lDPVZGsNpUsn3aZ0un509CR3S23UmZjp6HGMbjXuLk/KF3+M7GpBPdXUe7 LNJSqCcPMfJJs5yDRyY98NkEQ97u5gKFBQWBOF1HfR4cxohtEkvZKuBCXmB0IAcenlbq 1qmA== X-Gm-Message-State: APjAAAWYc7JLAWisT5JayhPzZmyh9vya10nwYaqi7jPgPG7ixWpf9BWe eidotKNGtE/mVuhcchrCikWR2dScfJM= X-Google-Smtp-Source: APXvYqzFGZZ7CvmoCio77UNeLukQaZzYR3KoSjHfT2MCgMVXVbq/CQpC8Ol5Uqe+kebElsjI245vLw== X-Received: by 2002:a1c:2dc9:: with SMTP id t192mr10149300wmt.119.1552084480148; Fri, 08 Mar 2019 14:34:40 -0800 (PST) Received: from nullptr.home.dirty-ice.org (2a01-036c-0113-6af5-0000-0000-0000-0005.pool6.digikabel.hu. [2a01:36c:113:6af5::5]) by smtp.gmail.com with ESMTPSA id v2sm15269144wme.29.2019.03.08.14.34.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Mar 2019 14:34:39 -0800 (PST) From: " =?utf-8?b?S8WRdsOhZ8OzLCBab2x0w6Fu?= " X-Google-Original-From: =?utf-8?b?S8WRdsOhZ8OzLCBab2x0w6Fu?= To: qemu-devel@nongnu.org Date: Fri, 8 Mar 2019 23:34:25 +0100 Message-Id: <82c176a5222a56e4fde45d2b423ada797caddd5d.1552083282.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::343 Subject: [Qemu-devel] [PATCH v6 14/14] audio: -audiodev command line option: cleanup 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Remove no longer needed code. Signed-off-by: Kővágó, Zoltán --- audio/audio_int.h | 17 ----- audio/audio.c | 186 +--------------------------------------------- 2 files changed, 4 insertions(+), 199 deletions(-) diff --git a/audio/audio_int.h b/audio/audio_int.h index 7bf5dfc0b5..3f14842709 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -33,22 +33,6 @@ struct audio_pcm_ops; -typedef enum { - AUD_OPT_INT, - AUD_OPT_FMT, - AUD_OPT_STR, - AUD_OPT_BOOL -} audio_option_tag_e; - -struct audio_option { - const char *name; - audio_option_tag_e tag; - void *valp; - const char *descr; - int *overriddenp; - int overridden; -}; - struct audio_callback { void *opaque; audio_callback_fn fn; @@ -145,7 +129,6 @@ typedef struct audio_driver audio_driver; struct audio_driver { const char *name; const char *descr; - struct audio_option *options; void *(*init) (Audiodev *); void (*fini) (void *); struct audio_pcm_ops *pcm_ops; diff --git a/audio/audio.c b/audio/audio.c index 79ed360666..5fd9a58a80 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -172,113 +172,6 @@ void *audio_calloc (const char *funcname, int nmemb, size_t size) return g_malloc0 (len); } -static const char *audio_audfmt_to_string (AudioFormat fmt) -{ - switch (fmt) { - case AUDIO_FORMAT_U8: - return "U8"; - - case AUDIO_FORMAT_U16: - return "U16"; - - case AUDIO_FORMAT_S8: - return "S8"; - - case AUDIO_FORMAT_S16: - return "S16"; - - case AUDIO_FORMAT_U32: - return "U32"; - - case AUDIO_FORMAT_S32: - return "S32"; - - default: - abort(); - } - - dolog ("Bogus audfmt %d returning S16\n", fmt); - return "S16"; -} - -static AudioFormat audio_string_to_audfmt (const char *s, AudioFormat defval, - int *defaultp) -{ - if (!strcasecmp (s, "u8")) { - *defaultp = 0; - return AUDIO_FORMAT_U8; - } - else if (!strcasecmp (s, "u16")) { - *defaultp = 0; - return AUDIO_FORMAT_U16; - } - else if (!strcasecmp (s, "u32")) { - *defaultp = 0; - return AUDIO_FORMAT_U32; - } - else if (!strcasecmp (s, "s8")) { - *defaultp = 0; - return AUDIO_FORMAT_S8; - } - else if (!strcasecmp (s, "s16")) { - *defaultp = 0; - return AUDIO_FORMAT_S16; - } - else if (!strcasecmp (s, "s32")) { - *defaultp = 0; - return AUDIO_FORMAT_S32; - } - else { - dolog ("Bogus audio format `%s' using %s\n", - s, audio_audfmt_to_string (defval)); - *defaultp = 1; - return defval; - } -} - -static AudioFormat audio_get_conf_fmt (const char *envname, - AudioFormat defval, - int *defaultp) -{ - const char *var = getenv (envname); - if (!var) { - *defaultp = 1; - return defval; - } - return audio_string_to_audfmt (var, defval, defaultp); -} - -static int audio_get_conf_int (const char *key, int defval, int *defaultp) -{ - int val; - char *strval; - - strval = getenv (key); - if (strval && !qemu_strtoi(strval, NULL, 10, &val)) { - *defaultp = 0; - return val; - } - else { - *defaultp = 1; - return defval; - } -} - -static const char *audio_get_conf_str (const char *key, - const char *defval, - int *defaultp) -{ - const char *val = getenv (key); - if (!val) { - *defaultp = 1; - return defval; - } - else { - *defaultp = 0; - return val; - } -} - void AUD_vlog (const char *cap, const char *fmt, va_list ap) { if (cap) { @@ -297,74 +190,6 @@ void AUD_log (const char *cap, const char *fmt, ...) va_end (ap); } -static void audio_process_options (const char *prefix, - struct audio_option *opt) -{ - gchar *prefix_upper; - - if (audio_bug(__func__, !prefix)) { - dolog ("prefix = NULL\n"); - return; - } - - if (audio_bug(__func__, !opt)) { - dolog ("opt = NULL\n"); - return; - } - - prefix_upper = g_utf8_strup(prefix, -1); - - for (; opt->name; opt++) { - char *optname; - int def; - - if (!opt->valp) { - dolog ("Option value pointer for `%s' is not set\n", - opt->name); - continue; - } - - optname = g_strdup_printf("QEMU_%s_%s", prefix_upper, opt->name); - - def = 1; - switch (opt->tag) { - case AUD_OPT_BOOL: - case AUD_OPT_INT: - { - int *intp = opt->valp; - *intp = audio_get_conf_int (optname, *intp, &def); - } - break; - - case AUD_OPT_FMT: - { - AudioFormat *fmtp = opt->valp; - *fmtp = audio_get_conf_fmt (optname, *fmtp, &def); - } - break; - - case AUD_OPT_STR: - { - const char **strp = opt->valp; - *strp = audio_get_conf_str (optname, *strp, &def); - } - break; - - default: - dolog ("Bad value tag for option `%s' - %d\n", - optname, opt->tag); - break; - } - - if (!opt->overriddenp) { - opt->overriddenp = &opt->overridden; - } - *opt->overriddenp = !def; - g_free (optname); - } - g_free(prefix_upper); -} - static void audio_print_settings (struct audsettings *as) { dolog ("frequency=%d nchannels=%d fmt=", as->freq, as->nchannels); @@ -1072,7 +897,7 @@ void AUD_set_active_out (SWVoiceOut *sw, int on) if (!hw->enabled) { hw->enabled = 1; if (s->vm_running) { - hw->pcm_ops->ctl_out(hw, VOICE_ENABLE, true); + hw->pcm_ops->ctl_out(hw, VOICE_ENABLE); audio_reset_timer (s); } } @@ -1117,7 +942,7 @@ void AUD_set_active_in (SWVoiceIn *sw, int on) if (!hw->enabled) { hw->enabled = 1; if (s->vm_running) { - hw->pcm_ops->ctl_in(hw, VOICE_ENABLE, true); + hw->pcm_ops->ctl_in(hw, VOICE_ENABLE); audio_reset_timer (s); } } @@ -1441,9 +1266,6 @@ void audio_run (const char *msg) static int audio_driver_init(AudioState *s, struct audio_driver *drv, bool msg, Audiodev *dev) { - if (drv->options) { - audio_process_options (drv->name, drv->options); - } s->drv_opaque = drv->init(dev); if (s->drv_opaque) { @@ -1470,11 +1292,11 @@ static void audio_vm_change_state_handler (void *opaque, int running, s->vm_running = running; while ((hwo = audio_pcm_hw_find_any_enabled_out (hwo))) { - hwo->pcm_ops->ctl_out(hwo, op, true); + hwo->pcm_ops->ctl_out(hwo, op); } while ((hwi = audio_pcm_hw_find_any_enabled_in (hwi))) { - hwi->pcm_ops->ctl_in(hwi, op, true); + hwi->pcm_ops->ctl_in(hwi, op); } audio_reset_timer (s); }