mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 23:03:54 -06:00
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>
This commit is contained in:
parent
ecd97e9592
commit
f0b9f36d71
5 changed files with 39 additions and 17 deletions
|
@ -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);
|
||||
|
||||
if (!as) {
|
||||
monitor_printf(mon, "Audiodev '%s' not found\n", audiodev);
|
||||
return;
|
||||
}
|
||||
|
||||
s = g_malloc0 (sizeof (*s));
|
||||
|
||||
freq = has_freq ? freq : 44100;
|
||||
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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue