All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kővágó, Zoltán" <dirty.ice.hu@gmail.com>
To: qemu-devel@nongnu.org
Cc: Markus Armbruster <armbru@redhat.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: [Qemu-devel] [PATCH v2 03/14] audio: add audiodev property to vnc and wav_capture
Date: Mon, 15 Jul 2019 23:08:05 +0200	[thread overview]
Message-ID: <8245dab2e59b99b55f3f7773fd39dc920ae48951.1563224628.git.DirtY.iCE.hu@gmail.com> (raw)
In-Reply-To: <cover.1563224628.git.DirtY.iCE.hu@gmail.com>

Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
---
 ui/vnc.h        |  2 ++
 monitor/misc.c  | 12 +++++++++++-
 ui/vnc.c        | 15 ++++++++++++++-
 hmp-commands.hx | 13 ++++++++-----
 qemu-options.hx |  6 ++++++
 5 files changed, 41 insertions(+), 7 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;
 };
 
 typedef struct VncTight {
diff --git a/monitor/misc.c b/monitor/misc.c
index e393333a0e..f97810d370 100644
--- a/monitor/misc.c
+++ b/monitor/misc.c
@@ -1148,7 +1148,17 @@ static void hmp_wavcapture(Monitor *mon, const QDict *qdict)
     int bits = qdict_get_try_int(qdict, "bits", -1);
     int has_channels = qdict_haskey(qdict, "nchannels");
     int nchannels = qdict_get_try_int(qdict, "nchannels", -1);
+    const char *audiodev = qdict_get_try_str(qdict, "audiodev");
     CaptureState *s;
+    AudioState *as = NULL;
+
+    if (audiodev) {
+        as = audio_state_by_name(audiodev);
+        if (!as) {
+            monitor_printf(mon, "Invalid audiodev specified\n");
+            return;
+        }
+    }
 
     s = g_malloc0 (sizeof (*s));
 
@@ -1156,7 +1166,7 @@ static void hmp_wavcapture(Monitor *mon, const QDict *qdict)
     bits = has_bits ? bits : 16;
     nchannels = 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 = audio_capture_destroy;
     ops.capture = audio_capture;
 
-    vs->audio_cap = AUD_add_capture(NULL, &vs->as, &ops, vs);
+    vs->audio_cap = 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 = {
         },{
             .name = "non-adaptive",
             .type = QEMU_OPT_BOOL,
+        },{
+            .name = "audiodev",
+            .type = 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 = 1;
     int key_delay_ms;
+    const char *audiodev;
 
     if (!vd) {
         error_setg(errp, "VNC display not active");
@@ -3991,6 +3995,15 @@ void vnc_display_open(const char *id, Error **errp)
     }
     vd->ledstate = 0;
 
+    audiodev = qemu_opt_get(opts, "audiodev");
+    if (audiodev) {
+        vd->audio_state = audio_state_by_name(audiodev);
+        if (!vd->audio_state) {
+            error_setg(errp, "Audiodev '%s' not found", audiodev);
+            goto fail;
+        }
+    }
+
     device_id = qemu_opt_get(opts, "display");
     if (device_id) {
         int head = qemu_opt_get_number(opts, "head", 0);
diff --git a/hmp-commands.hx b/hmp-commands.hx
index bfa5681dd2..fa7f009268 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -819,16 +819,19 @@ ETEXI
 
     {
         .name       = "wavcapture",
-        .args_type  = "path:F,freq:i?,bits:i?,nchannels:i?",
-        .params     = "path [frequency [bits [channels]]]",
+        .args_type  = "path:F,freq:i?,bits:i?,nchannels:i?,audiodev:s?",
+        .params     = "path [frequency [bits [channels [audiodev]]]]",
         .help       = "capture audio to a wave file (default frequency=44100 bits=16 channels=2)",
         .cmd        = hmp_wavcapture,
     },
 STEXI
-@item wavcapture @var{filename} [@var{frequency} [@var{bits} [@var{channels}]]]
+@item wavcapture @var{filename} [@var{frequency} [@var{bits} [@var{channels} [@var{audiodev}]]]]
 @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}. When not using an -audiodev argument on command line,
+@var{audiodev} must be omitted, otherwise is must specify a valid
+audiodev.
 
 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 lose events in case
 events are arriving in bulk.  Possible causes for the latter are flaky
 network connections, or scripts for automated testing.
 
+@item audiodev=@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
 
-- 
2.22.0



  parent reply	other threads:[~2019-07-15 21:08 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-15 21:08 [Qemu-devel] [PATCH v2 00/14] Multiple simultaneous audio backends Kővágó, Zoltán
2019-07-15 21:08 ` [Qemu-devel] [PATCH v2 01/14] audio: reduce glob_audio_state usage Kővágó, Zoltán
2019-07-15 21:08 ` [Qemu-devel] [PATCH v2 02/14] audio: basic support for multi backend audio Kővágó, Zoltán
2019-07-15 21:08 ` Kővágó, Zoltán [this message]
2019-07-16  6:23   ` [Qemu-devel] [PATCH v2 03/14] audio: add audiodev property to vnc and wav_capture Markus Armbruster
2019-07-16 10:02     ` Dr. David Alan Gilbert
2019-07-21 15:05     ` Zoltán Kővágó
2019-07-22 14:21       ` Markus Armbruster
2019-07-28 13:42         ` Zoltán Kővágó
2019-07-28 15:08           ` Zoltán Kővágó
2019-07-29  6:11             ` Markus Armbruster
2019-07-15 21:08 ` [Qemu-devel] [PATCH v2 04/14] audio: add audiodev properties to frontends Kővágó, Zoltán
2019-07-15 21:08 ` [Qemu-devel] [PATCH v2 05/14] paaudio: prepare for multiple audiodev Kővágó, Zoltán
2019-07-15 21:08 ` [Qemu-devel] [PATCH v2 06/14] audio: audiodev= parameters no longer optional when -audiodev present Kővágó, Zoltán
2019-07-15 21:08 ` [Qemu-devel] [PATCH v2 07/14] paaudio: do not move stream when sink/source name is specified Kővágó, Zoltán
2019-07-15 21:08 ` [Qemu-devel] [PATCH v2 08/14] paaudio: properly disconnect streams in fini_* Kővágó, Zoltán
2019-07-15 21:08 ` [Qemu-devel] [PATCH v2 09/14] audio: remove audio_MIN, audio_MAX Kővágó, Zoltán
2019-07-15 21:08 ` [Qemu-devel] [PATCH v2 10/14] audio: do not run each backend in audio_run Kővágó, Zoltán
2019-07-15 21:08 ` [Qemu-devel] [PATCH v2 11/14] paaudio: fix playback glitches Kővágó, Zoltán
2019-07-15 21:08 ` [Qemu-devel] [PATCH v2 12/14] audio: remove read and write pcm_ops Kővágó, Zoltán
2019-07-15 21:08 ` [Qemu-devel] [PATCH v2 13/14] audio: use size_t where makes sense Kővágó, Zoltán
2019-07-15 21:08 ` [Qemu-devel] [PATCH v2 14/14] audio: fix memory leak reported by ASAN Kővágó, Zoltán
2019-07-15 21:16 ` [Qemu-devel] [PATCH v2 00/14] Multiple simultaneous audio backends no-reply
2019-07-16 18:01 ` no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8245dab2e59b99b55f3f7773fd39dc920ae48951.1563224628.git.DirtY.iCE.hu@gmail.com \
    --to=dirty.ice.hu@gmail.com \
    --cc=armbru@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.