summaryrefslogtreecommitdiffstats
path: root/monitor
diff options
context:
space:
mode:
authorKővágó, Zoltán2019-08-19 01:06:48 +0200
committerGerd Hoffmann2019-08-21 09:13:37 +0200
commitf0b9f36d71a373d469da9feb133c91546d37643c (patch)
tree3fa26cf176b85afd36571865936610c27f2c4f75 /monitor
parentaudio: basic support for multi backend audio (diff)
downloadqemu-f0b9f36d71a373d469da9feb133c91546d37643c.tar.gz
qemu-f0b9f36d71a373d469da9feb133c91546d37643c.tar.xz
qemu-f0b9f36d71a373d469da9feb133c91546d37643c.zip
audio: add audiodev property to vnc and wav_capture
Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com> Message-id: 8cbc9e865bbf40850c14340fc0549e6ac2d5fe9c.1566168923.git.DirtY.iCE.hu@gmail.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'monitor')
-rw-r--r--monitor/misc.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/monitor/misc.c b/monitor/misc.c
index 6b71059739..aef16f6cfb 100644
--- a/monitor/misc.c
+++ b/monitor/misc.c
@@ -1142,21 +1142,21 @@ static void hmp_stopcapture(Monitor *mon, const QDict *qdict)
static void hmp_wavcapture(Monitor *mon, const QDict *qdict)
{
const char *path = qdict_get_str(qdict, "path");
- int has_freq = qdict_haskey(qdict, "freq");
- int freq = qdict_get_try_int(qdict, "freq", -1);
- int has_bits = qdict_haskey(qdict, "bits");
- 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);
+ int freq = qdict_get_try_int(qdict, "freq", 44100);
+ int bits = qdict_get_try_int(qdict, "bits", 16);
+ int nchannels = qdict_get_try_int(qdict, "nchannels", 2);
+ const char *audiodev = qdict_get_str(qdict, "audiodev");
CaptureState *s;
+ AudioState *as = audio_state_by_name(audiodev);
- s = g_malloc0 (sizeof (*s));
+ if (!as) {
+ monitor_printf(mon, "Audiodev '%s' not found\n", audiodev);
+ return;
+ }
- freq = has_freq ? freq : 44100;
- bits = has_bits ? bits : 16;
- nchannels = has_channels ? nchannels : 2;
+ s = g_malloc0 (sizeof (*s));
- 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;