From patchwork Mon Jul 15 21:08:08 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: 11045025 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 0EDBF746 for ; Mon, 15 Jul 2019 21:10:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F0F2A26E1A for ; Mon, 15 Jul 2019 21:10:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E1F71284DA; Mon, 15 Jul 2019 21:10:16 +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=-5.0 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 816AA26E1A for ; Mon, 15 Jul 2019 21:10:16 +0000 (UTC) Received: from localhost ([::1]:43828 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hn8Eh-0007MK-71 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 15 Jul 2019 17:10:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42253) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hn8Cx-00086R-Ej for qemu-devel@nongnu.org; Mon, 15 Jul 2019 17:08:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hn8Cv-0004jx-AV for qemu-devel@nongnu.org; Mon, 15 Jul 2019 17:08:27 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:52562) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hn8Cv-0004jH-3j for qemu-devel@nongnu.org; Mon, 15 Jul 2019 17:08:25 -0400 Received: by mail-wm1-x341.google.com with SMTP id s3so16558785wms.2 for ; Mon, 15 Jul 2019 14:08:25 -0700 (PDT) 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=PksipMVzAiiMTAlABLCmlNruZKZ2bg95M8Q+Ha0hlqQ=; b=G5bFZKNhY9vNYOs2xPB+aVEMZvpUnswTKrN51d9DHyefk7viQkCb2nxqysyCX+nATh daBob80lswoa+g8Z1EhLkCzfWg/fCAU3Vk/S0k+l0AtyMhzs03HqK1ZlfZ2fsMtlQ3mE bh5WrPSknf0XVBiJtycYfS3V1fmUWihm8CCVujIOXus9CWU9UTGrv76y1psKP0X7zpJA 6cBCCVawjNMmHmv1sr94fv2WwkGyULvDBKm9UcvF93KsV+G9CRNer7d2R4DifXu/ehBV Q7Ef/sU61zqVI9I4Dks2HSpriJJ8Mn+n4OtqYK6jI18bY9DrixenAcPmBEKE8AfupD15 fmjw== 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=PksipMVzAiiMTAlABLCmlNruZKZ2bg95M8Q+Ha0hlqQ=; b=OuBlszEzBjUqz46tKE8kO6ZOByus7z4xYcvUt5MzstaFKD2XqK6+dGsel6X+wUFKOW Nir2Qvyx31WmagpAAbSKETxXVkV1rMrfFiu+R3mz83uaEGhGsgC9m6w/PL08W5P3/zBy A1nFukoFSdhiGJEN4ufY/4riGdjGPwmPDFL8b4ya6GGH6iu1vvTgqhAeoiJ0MO8ygGZ/ p38OU3tBtAfmworfaoCapdWtRmBaf/RJemiOjfwnQHTiF71+k3p3MGopI5jWrI9vpGKC SpXVYfX+gQ5/rRTnQLYe8EkOrr3P4Yw11xigEqvUjqvrxyXuUOrQGYQdqzRkPvj6+Qgk r5Yg== X-Gm-Message-State: APjAAAWE4d+hdocYmY7iv2wqcG2Ea9gB7CbsgTqJsGhsdJKqbOMiSWPv JjjDHQpgFc3CQCt1mhfcpSu0eYTh X-Google-Smtp-Source: APXvYqwsAGBInWetcdh5UZ0Sz/lcEFWwVg7j2nSVabiv40I7RbTm8O/qq6iygWG04n09pckGeSDe1A== X-Received: by 2002:a1c:cb43:: with SMTP id b64mr26681580wmg.86.1563224903735; Mon, 15 Jul 2019 14:08:23 -0700 (PDT) Received: from nullptr.home.dirty-ice.org (2a01-036c-0113-31ca-0000-0000-0000-0005.pool6.digikabel.hu. [2a01:36c:113:31ca::5]) by smtp.gmail.com with ESMTPSA id n8sm11513447wro.89.2019.07.15.14.08.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jul 2019 14:08:23 -0700 (PDT) From: " =?utf-8?b?S8WRdsOhZ8OzLCBab2x0w6Fu?= " X-Google-Original-From: =?utf-8?b?S8WRdsOhZ8OzLCBab2x0w6Fu?= To: qemu-devel@nongnu.org Date: Mon, 15 Jul 2019 23:08:08 +0200 Message-Id: X-Mailer: git-send-email 2.22.0 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 v2 06/14] audio: audiodev= parameters no longer optional when -audiodev present X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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 This means you should probably stop using -soundhw (as it doesn't allow you to specify any options) and add the device manually with -device. The exception is pcspk, it's currently not possible to manually add it. To use it with audiodev, use something like this: -audiodev id=foo,... -global isa-pcspk.audiodev=foo -soundhw pcspk Signed-off-by: Kővágó, Zoltán --- Notes: Changes from v1: * Split off paaudio changes to a different commit. audio/audio.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index 4baa37caac..d131958194 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -101,6 +101,8 @@ const struct mixeng_volume nominal_volume = { #endif }; +static bool legacy_config = true; + #ifdef AUDIO_IS_FLAWLESS_AND_NO_CHECKS_ARE_REQURIED #error No its not #else @@ -1392,7 +1394,7 @@ static AudiodevListEntry *audiodev_find( * if dev == NULL => legacy implicit initialization, return the already created * state or create a new one */ -static AudioState *audio_init(Audiodev *dev) +static AudioState *audio_init(Audiodev *dev, const char *name) { static bool atexit_registered; size_t i; @@ -1406,12 +1408,13 @@ static AudioState *audio_init(Audiodev *dev) if (dev) { /* -audiodev option */ + legacy_config = false; drvname = AudiodevDriver_str(dev->driver); } else if (!QTAILQ_EMPTY(&audio_states)) { - /* - * todo: check for -audiodev once we have normal audiodev selection - * support - */ + if (!legacy_config) { + dolog("You must specify an audiodev= for the device %s\n", name); + exit(1); + } return QTAILQ_FIRST(&audio_states); } else { /* legacy implicit initialization */ @@ -1518,7 +1521,7 @@ void audio_free_audiodev_list(AudiodevListHead *head) void AUD_register_card (const char *name, QEMUSoundCard *card) { if (!card->state) { - card->state = audio_init(NULL); + card->state = audio_init(NULL, name); } card->name = g_strdup (name); @@ -1544,8 +1547,11 @@ CaptureVoiceOut *AUD_add_capture( struct capture_callback *cb; if (!s) { - /* todo: remove when we have normal audiodev selection support */ - s = audio_init(NULL); + if (!legacy_config) { + dolog("You must specify audiodev when trying to capture\n"); + return NULL; + } + s = audio_init(NULL, NULL); } if (audio_validate_settings (as)) { @@ -1776,7 +1782,7 @@ void audio_init_audiodevs(void) AudiodevListEntry *e; QSIMPLEQ_FOREACH(e, &audiodevs, next) { - audio_init(e->dev); + audio_init(e->dev, NULL); } }