From patchwork Sun Dec 23 20:51:52 2018 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: 1018092 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=208.118.235.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="unTrerOd"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43NFC21PqMz9sDr for ; Mon, 24 Dec 2018 08:01:02 +1100 (AEDT) Received: from localhost ([127.0.0.1]:42205 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gbArr-0001y6-PC for incoming@patchwork.ozlabs.org; Sun, 23 Dec 2018 16:00:59 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52238) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gbAju-0007eA-VK for qemu-devel@nongnu.org; Sun, 23 Dec 2018 15:52:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gbAjt-0002C1-A7 for qemu-devel@nongnu.org; Sun, 23 Dec 2018 15:52:46 -0500 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:50271) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gbAjt-00028S-0n for qemu-devel@nongnu.org; Sun, 23 Dec 2018 15:52:45 -0500 Received: by mail-wm1-x342.google.com with SMTP id n190so9881461wmd.0 for ; Sun, 23 Dec 2018 12:52:44 -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=+cUsRleoO4YUEA7trsmly6GGSR7W4F/uhGZGMcrGvso=; b=unTrerOdRuyEoCuFM/3Ag8KuhyClHvlouEg4L3RljhxyZF6syamR0CNZkDM8dBHn0g VJOxC2N3lG5NAZr19PlD+vcWFov8YsINz9O+KRQzC790fSNhDvkRwB5fwHJl5j0jdKE6 FKHBC5SjVs7AWnTrTqx/EmE436ehdP8E4XvtM7YmNiE4dpLl2lJ9gsQK0jeBz/tmZp2h Er2fuadON8cJySIa1MRHSRHwtQ5HFOvKEsZL7LE/WV+sBfETdfo6O5WoZOct+2JcSa+j OQcXaFS791Ac4E4aNweCbarthoLFcdJzeRBLdVJa9cdGpX7E+Wvng/w3GEGcP5+Dapsq KMSw== 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=+cUsRleoO4YUEA7trsmly6GGSR7W4F/uhGZGMcrGvso=; b=LqiNGcsBUCZTs61IzOcFJuaEYBYmSK61KLrdZrz2wFmLJv4kS4RU8V/CSx84dRR52m vhmE8QNTVhciYQjLsryxFNLb/l8ymLXcm7pOaGP0UpxPGM/taoclREeyPf+pldrnw8Vr 9X/XiykQuKR8rIqXLkF/PDMpUJm8d2iP7pmsLZ2R4oNMeAwrtbfGs9AFKUYwxOPb+G3o pHFh3y2BF59IDvo/dIy34nAWz01Plg2YCH07klvB+EXGqaSn8VxFQr+qD25fC+gv8OHL 3P9fzWa9BnGlFVv76V9WbT9on0p7tNzyrDLgc0H2kDg2LD3AuvQ5G3S10vEGZQPoOqfD dtSg== X-Gm-Message-State: AA+aEWbbMt86qv2FKvC7LYnTb+woZzyiZERv/d7vPsl9iSH2ib/DZ9AJ /Smva0/ArnSDqWjk9NTJQUasa5KUHGM= X-Google-Smtp-Source: AFSGD/Wja3IoSUQv0O9scAK4mYhfxuVQk9mpNKVZ50E8dnfawx0toAy7jv6aerAUHz1AO8jXhJaY9w== X-Received: by 2002:a1c:27c6:: with SMTP id n189mr9939766wmn.108.1545598363666; Sun, 23 Dec 2018 12:52:43 -0800 (PST) Received: from nullptr.home.dirty-ice.org (2a01-036c-0113-24a3-0000-0000-0000-0005.pool6.digikabel.hu. [2a01:36c:113:24a3::5]) by smtp.gmail.com with ESMTPSA id g198sm25456920wmd.23.2018.12.23.12.52.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Dec 2018 12:52:43 -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: Sun, 23 Dec 2018 21:51:52 +0100 Message-Id: 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::342 Subject: [Qemu-devel] [PATCH v2 16/52] 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Remove no longer needed code. Signed-off-by: Kővágó, Zoltán --- audio/audio.c | 201 +--------------------------------------------- audio/audio_int.h | 17 ---- 2 files changed, 4 insertions(+), 214 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index e7f25ea84b..0c3f0efd46 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -173,113 +173,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) { @@ -298,89 +191,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) -{ - char *optname; - const char qemu_prefix[] = "QEMU_"; - size_t preflen, optlen; - - if (audio_bug(__func__, !prefix)) { - dolog ("prefix = NULL\n"); - return; - } - - if (audio_bug(__func__, !opt)) { - dolog ("opt = NULL\n"); - return; - } - - preflen = strlen (prefix); - - for (; opt->name; opt++) { - size_t len, i; - int def; - - if (!opt->valp) { - dolog ("Option value pointer for `%s' is not set\n", - opt->name); - continue; - } - - len = strlen (opt->name); - /* len of opt->name + len of prefix + size of qemu_prefix - * (includes trailing zero) + zero + underscore (on behalf of - * sizeof) */ - optlen = len + preflen + sizeof (qemu_prefix) + 1; - optname = g_malloc (optlen); - - pstrcpy (optname, optlen, qemu_prefix); - - /* copy while upper-casing, including trailing zero */ - for (i = 0; i <= preflen; ++i) { - optname[i + sizeof (qemu_prefix) - 1] = qemu_toupper(prefix[i]); - } - pstrcat (optname, optlen, "_"); - pstrcat (optname, optlen, 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); - } -} - static void audio_print_settings (struct audsettings *as) { dolog ("frequency=%d nchannels=%d fmt=", as->freq, as->nchannels); @@ -1093,7 +903,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 /* todo */); + hw->pcm_ops->ctl_out(hw, VOICE_ENABLE); audio_reset_timer (s); } } @@ -1138,7 +948,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 /* todo */); + hw->pcm_ops->ctl_in(hw, VOICE_ENABLE); audio_reset_timer (s); } } @@ -1462,9 +1272,6 @@ void audio_run (const char *msg) static int audio_driver_init(AudioState *s, struct audio_driver *drv, Audiodev *dev) { - if (drv->options) { - audio_process_options (drv->name, drv->options); - } s->drv_opaque = drv->init(dev); if (s->drv_opaque) { @@ -1489,11 +1296,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 /* todo */); + 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 /* todo */); + hwi->pcm_ops->ctl_in(hwi, op); } audio_reset_timer (s); } diff --git a/audio/audio_int.h b/audio/audio_int.h index 24b8793496..83fb517b2a 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;