[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 09/11] hw/audio/virtio-sound: introduce virtio_snd_set_active(
From: |
Volker Rümelin |
Subject: |
[PATCH v2 09/11] hw/audio/virtio-sound: introduce virtio_snd_set_active() |
Date: |
Sun, 18 Feb 2024 09:33:49 +0100 |
Split out the function virtio_snd_pcm_set_active() from
virtio_snd_pcm_start_stop(). A later patch also needs this
new funcion. There is no functional change.
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
---
hw/audio/virtio-snd.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/hw/audio/virtio-snd.c b/hw/audio/virtio-snd.c
index a1d14caba0..06a27ef8d9 100644
--- a/hw/audio/virtio-snd.c
+++ b/hw/audio/virtio-snd.c
@@ -471,6 +471,21 @@ static void virtio_snd_pcm_open(VirtIOSoundPCMStream
*stream)
}
}
+/*
+ * Activate/deactivate a stream.
+ *
+ * @stream: VirtIOSoundPCMStream *stream
+ * @active: whether to activate or deactivate the stream
+ */
+static void virtio_snd_pcm_set_active(VirtIOSoundPCMStream *stream, bool
active)
+{
+ if (stream->info.direction == VIRTIO_SND_D_OUTPUT) {
+ AUD_set_active_out(stream->voice.out, active);
+ } else {
+ AUD_set_active_in(stream->voice.in, active);
+ }
+}
+
/*
* Close a stream and free all its resources.
*
@@ -606,11 +621,7 @@ static uint32_t virtio_snd_pcm_start_stop(VirtIOSound *s,
stream->state = VSND_PCMSTREAM_STATE_STOPPED;
}
- if (stream->info.direction == VIRTIO_SND_D_OUTPUT) {
- AUD_set_active_out(stream->voice.out, start);
- } else {
- AUD_set_active_in(stream->voice.in, start);
- }
+ virtio_snd_pcm_set_active(stream, start);
return cpu_to_le32(VIRTIO_SND_S_OK);
}
--
2.35.3
- [PATCH v2 00/11] virtio-sound migration part 1, Volker Rümelin, 2024/02/18
- [PATCH v2 01/11] hw/audio/virtio-sound: return correct command response size, Volker Rümelin, 2024/02/18
- [PATCH v2 02/11] hw/audio/virtio-sound: fix segmentation fault in tx/rx xfer handler, Volker Rümelin, 2024/02/18
- [PATCH v2 03/11] hw/audio/virtio-sound: remove command and stream mutexes, Volker Rümelin, 2024/02/18
- [PATCH v2 05/11] hw/audio/virtio-sound: free all stream buffers on reset, Volker Rümelin, 2024/02/18
- [PATCH v2 04/11] hw/audio/virtio-sound: allocate an array of streams, Volker Rümelin, 2024/02/18
- [PATCH v2 06/11] hw/audio/virtio-sound: split out virtio_snd_pcm_start_stop(), Volker Rümelin, 2024/02/18
- [PATCH v2 07/11] hw/audio/virtio-sound: add stream state variable, Volker Rümelin, 2024/02/18
- [PATCH v2 08/11] hw/audio/virtio-sound: introduce virtio_snd_pcm_open(), Volker Rümelin, 2024/02/18
- [PATCH v2 10/11] hw/audio/virtio-sound: add missing vmstate fields, Volker Rümelin, 2024/02/18
- [PATCH v2 09/11] hw/audio/virtio-sound: introduce virtio_snd_set_active(),
Volker Rümelin <=
- [PATCH v2 11/11] hw/audio/virtio-sound: add placeholder for buffer write position, Volker Rümelin, 2024/02/18