aboutsummaryrefslogtreecommitdiff
path: root/monitor
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2019-08-21 15:18:50 +0100
committerPeter Maydell <peter.maydell@linaro.org>2019-08-21 15:18:50 +0100
commit33f18cf7dca7741d3647d514040904ce83edd73d (patch)
tree6b4d7d07672dac3fd63a0846a59468adee9f504a /monitor
parente65472c7bc413d79faa61eb1d05c540b03945894 (diff)
parente76ba19a1f1377314573a6df7e2d82b597aa3d0a (diff)
Merge remote-tracking branch 'remotes/kraxel/tags/audio-20190821-pull-request' into staging
audio: second batch of -audiodev support, adding support for multiple backends. # gpg: Signature made Wed 21 Aug 2019 09:40:37 BST # gpg: using RSA key 4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full] # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" [full] # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full] # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/audio-20190821-pull-request: audio: fix memory leak reported by ASAN audio: use size_t where makes sense audio: remove read and write pcm_ops paaudio: fix playback glitches audio: do not run each backend in audio_run audio: remove audio_MIN, audio_MAX paaudio: properly disconnect streams in fini_* paaudio: do not move stream when sink/source name is specified audio: audiodev= parameters no longer optional when -audiodev present paaudio: prepare for multiple audiodev audio: add audiodev properties to frontends audio: add audiodev property to vnc and wav_capture audio: basic support for multi backend audio audio: reduce glob_audio_state usage audio: Add missing fall through comments Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
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 d229e65450..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 (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;