From nobody Mon Feb 9 04:09:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1564938350; cv=none; d=zoho.com; s=zohoarc; b=lNRBPB1QVStXgHphHUvWR9SUtQV8Oep6AKIu5arINIGSQyCzBPL9DcZqdmOAN6fspbMudiG3ZZptrTqcSX2RtYjP1XaO05Kb7Ux9ardJlWJRU95q8rEbILHpwKtY0nRP1jQKRaV0LmMGicW8gU9szXRor5k/RCDBN9kpy3CYekE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564938350; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=zmwu7QnhjoOubCcj+gXAWMt870pR20NYhJgBFOm+pcY=; b=KLMTHWVneNIQYyC1FCg0/d3hlxxm8W2c1xcRAD+CEZ+UIMxuaDLgWO1JjlkH9RPV/O9Xe8iSQJ/YwITUnFjsxrCrlv5kHRXu64EGI6t56eiw0U7e2rD1BNQu+V3C8vby0SznKuuZUBFDqqVuoa/5KlYNM9OSbRgPxBlPaqVvcdE= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1564938350858837.971804995754; Sun, 4 Aug 2019 10:05:50 -0700 (PDT) Received: from localhost ([::1]:48848 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1huJx0-000479-Oz for importer@patchew.org; Sun, 04 Aug 2019 13:05:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56698) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1huJw4-0002OC-T0 for qemu-devel@nongnu.org; Sun, 04 Aug 2019 13:04:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1huJw2-00048H-KS for qemu-devel@nongnu.org; Sun, 04 Aug 2019 13:04:44 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:34459) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1huJw1-0003ze-Fv for qemu-devel@nongnu.org; Sun, 04 Aug 2019 13:04:42 -0400 Received: by mail-wr1-x443.google.com with SMTP id 31so82085050wrm.1 for ; Sun, 04 Aug 2019 10:04:32 -0700 (PDT) Received: from nullptr.home.dirty-ice.org (2a01-036c-0113-632c-0000-0000-0000-0005.pool6.digikabel.hu. [2a01:36c:113:632c::5]) by smtp.gmail.com with ESMTPSA id s10sm104876106wmf.8.2019.08.04.10.04.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Aug 2019 10:04:30 -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=zmwu7QnhjoOubCcj+gXAWMt870pR20NYhJgBFOm+pcY=; b=jEqVo2fK+2u6XPFW8INx6LlrDfFO3fChm2iVibxrS0maywteoVZ+UFS2B+GeLNHL+H oiOakOtpquPjRzFZcv8Dx96mTL6UKBFwn7lN8P/lcYOPEooZg1fYRdHC8ykl7SCKqxS/ 90HzVoarARcEMCIgEFqDzKX6BhHH4jIByVTOhaMuuDbL5VdRhGiFflyolfGiNU8RGwdw qjwHpEaMYvR3A23NwAnfVC06Hh52Z7eaFj2NxrZeXRgGdV9IBZYKQnaVMFNs9xkAAyuc xiy0Qt6wSXpde57tgNbKZ61gdCZl/hYxU/BAmZAlnz6fYu0OVwVfOzAyavpqM0mmhIvW J/Ow== 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=zmwu7QnhjoOubCcj+gXAWMt870pR20NYhJgBFOm+pcY=; b=WrYCZ/tNHKuTX1JNcJZEopM64ekHDtEe2rR4BpI/JD3zFgKsolNcyj3yvwXbzpukOE s70SpE35Ypg2xA/yVwFnVkR7iFAjAebVJvIeLeFbiF3MFUc6IJLKXKpAJmFeCEHQu+3a IUGpC825+ukqQFj2/RnaPC2mfNCiJ6SWDMC0iF2p5UT3zqOZktL4QzFiy7YWzTWksPo/ YkkVW+cNQHZ+TEy/8j+wYIs3FHzsSE1AhkKxCPfhj7dg5YClHCpXyujhNgSAM/eA6SnA h6n7B0BL3UMG24fQVT7Dr/EYA2VHCyNnWZSRMITdHlvze7vMVDcxQKbfLqSxLCIX5kvn pkYA== X-Gm-Message-State: APjAAAXsLlCMsT9y5QUsBC3jSlDbuWVNpsfOQx6zEOhhsm2bpbvY+pC6 xNdPiLV4v9WYYMoVPmgr8NJs2REs X-Google-Smtp-Source: APXvYqyLclFUfHfrCqTS3tSz9ri/yc/kTX6beKbxSClOGZIZuosdye6wvqea+k/HfLrDQqvMb54WKA== X-Received: by 2002:adf:cc85:: with SMTP id p5mr148494496wrj.47.1564938271149; Sun, 04 Aug 2019 10:04:31 -0700 (PDT) From: "=?UTF-8?q?K=C5=91v=C3=A1g=C3=B3=2C=20Zolt=C3=A1n?=" X-Google-Original-From: =?UTF-8?q?K=C5=91v=C3=A1g=C3=B3=2C=20Zolt=C3=A1n?= To: qemu-devel@nongnu.org Date: Sun, 4 Aug 2019 19:04:15 +0200 Message-Id: X-Mailer: git-send-email 2.22.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 Subject: [Qemu-devel] [PATCH v3 03/14] audio: add audiodev property to vnc and wav_capture 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: Markus Armbruster , Gerd Hoffmann , "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Signed-off-by: K=C5=91v=C3=A1g=C3=B3, Zolt=C3=A1n Acked-by: Dr. David Alan Gilbert --- Notes: Changes from v2: =20 * audiodev parameter for wavcapture is now mandatory. * removed some unnecessary qdict_haskey calls from hmp_wavcapture ui/vnc.h | 2 ++ monitor/misc.c | 22 +++++++++++----------- ui/vnc.c | 15 ++++++++++++++- hmp-commands.hx | 11 ++++++----- qemu-options.hx | 6 ++++++ 5 files changed, 39 insertions(+), 17 deletions(-) diff --git a/ui/vnc.h b/ui/vnc.h index 2f84db3142..6f54653455 100644 --- a/ui/vnc.h +++ b/ui/vnc.h @@ -183,6 +183,8 @@ struct VncDisplay #ifdef CONFIG_VNC_SASL VncDisplaySASL sasl; #endif + + AudioState *audio_state; }; =20 typedef struct VncTight { diff --git a/monitor/misc.c b/monitor/misc.c index e393333a0e..bdf857555f 100644 --- a/monitor/misc.c +++ b/monitor/misc.c @@ -1142,21 +1142,21 @@ static void hmp_stopcapture(Monitor *mon, const QDi= ct *qdict) static void hmp_wavcapture(Monitor *mon, const QDict *qdict) { const char *path =3D qdict_get_str(qdict, "path"); - int has_freq =3D qdict_haskey(qdict, "freq"); - int freq =3D qdict_get_try_int(qdict, "freq", -1); - int has_bits =3D qdict_haskey(qdict, "bits"); - int bits =3D qdict_get_try_int(qdict, "bits", -1); - int has_channels =3D qdict_haskey(qdict, "nchannels"); - int nchannels =3D qdict_get_try_int(qdict, "nchannels", -1); + int freq =3D qdict_get_try_int(qdict, "freq", 44100); + int bits =3D qdict_get_try_int(qdict, "bits", 16); + int nchannels =3D qdict_get_try_int(qdict, "nchannels", 2); + const char *audiodev =3D qdict_get_str(qdict, "audiodev"); CaptureState *s; + AudioState *as =3D audio_state_by_name(audiodev); + + if (!as) { + monitor_printf(mon, "Audiodev '%s' not found\n", audiodev); + return; + } =20 s =3D g_malloc0 (sizeof (*s)); =20 - freq =3D has_freq ? freq : 44100; - bits =3D has_bits ? bits : 16; - nchannels =3D has_channels ? nchannels : 2; - - if (wav_start_capture(NULL, s, path, freq, bits, nchannels)) { + if (wav_start_capture(as, s, path, freq, bits, nchannels)) { monitor_printf(mon, "Failed to add wave capture\n"); g_free (s); return; diff --git a/ui/vnc.c b/ui/vnc.c index 140f364dda..24f9be5b5d 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -1222,7 +1222,7 @@ static void audio_add(VncState *vs) ops.destroy =3D audio_capture_destroy; ops.capture =3D audio_capture; =20 - vs->audio_cap =3D AUD_add_capture(NULL, &vs->as, &ops, vs); + vs->audio_cap =3D AUD_add_capture(vs->vd->audio_state, &vs->as, &ops, = vs); if (!vs->audio_cap) { error_report("Failed to add audio capture"); } @@ -3369,6 +3369,9 @@ static QemuOptsList qemu_vnc_opts =3D { },{ .name =3D "non-adaptive", .type =3D QEMU_OPT_BOOL, + },{ + .name =3D "audiodev", + .type =3D QEMU_OPT_STRING, }, { /* end of list */ } }, @@ -3806,6 +3809,7 @@ void vnc_display_open(const char *id, Error **errp) const char *saslauthz; int lock_key_sync =3D 1; int key_delay_ms; + const char *audiodev; =20 if (!vd) { error_setg(errp, "VNC display not active"); @@ -3991,6 +3995,15 @@ void vnc_display_open(const char *id, Error **errp) } vd->ledstate =3D 0; =20 + audiodev =3D qemu_opt_get(opts, "audiodev"); + if (audiodev) { + vd->audio_state =3D audio_state_by_name(audiodev); + if (!vd->audio_state) { + error_setg(errp, "Audiodev '%s' not found", audiodev); + goto fail; + } + } + device_id =3D qemu_opt_get(opts, "display"); if (device_id) { int head =3D qemu_opt_get_number(opts, "head", 0); diff --git a/hmp-commands.hx b/hmp-commands.hx index bfa5681dd2..cfcc044ce4 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -819,16 +819,17 @@ ETEXI =20 { .name =3D "wavcapture", - .args_type =3D "path:F,freq:i?,bits:i?,nchannels:i?", - .params =3D "path [frequency [bits [channels]]]", + .args_type =3D "path:F,audiodev:s,freq:i?,bits:i?,nchannels:i?", + .params =3D "path audiodev [frequency [bits [channels]]]", .help =3D "capture audio to a wave file (default frequency= =3D44100 bits=3D16 channels=3D2)", .cmd =3D hmp_wavcapture, }, STEXI -@item wavcapture @var{filename} [@var{frequency} [@var{bits} [@var{channel= s}]]] +@item wavcapture @var{filename} @var{audiodev} [@var{frequency} [@var{bits= } [@var{channels}]]] @findex wavcapture -Capture audio into @var{filename}. Using sample rate @var{frequency} -bits per sample @var{bits} and number of channels @var{channels}. +Capture audio into @var{filename} from @var{audiodev}, using sample rate +@var{frequency} bits per sample @var{bits} and number of channels +@var{channels}. =20 Defaults: @itemize @minus diff --git a/qemu-options.hx b/qemu-options.hx index 9621e934c0..a308e5f5aa 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1978,6 +1978,12 @@ can help the device and guest to keep up and not los= e events in case events are arriving in bulk. Possible causes for the latter are flaky network connections, or scripts for automated testing. =20 +@item audiodev=3D@var{audiodev} + +Use the specified @var{audiodev} when the VNC client requests audio +transmission. When not using an -audiodev argument, this option must +be omitted, otherwise is must be present and specify a valid audiodev. + @end table ETEXI =20 --=20 2.22.0