[PATCH v2 2/4] conf: allow to map sound device to host device
Daniel P. Berrangé
berrange at redhat.com
Thu Jul 30 10:51:59 UTC 2020
On Tue, Jul 28, 2020 at 06:58:41PM +0400, Roman Bogorodskiy wrote:
> Introduce a new device element "<audio>" which allows
> to map guest sound device specified using the "<sound>"
> element to specific audio backend.
>
> Example:
>
> <sound model='ich6'>
> <audio id='audio0'/>
> </sound>
> <audio id='audio' type='oss'>
> <input dev='/dev/dsp0'/>
> <output dev='/dev/dsp0'/>
> </audio>
>
> This block maps to OSS audio backend on the host using
> /dev/dsp0 device for both input (recording)
> and output (playback).
>
> OSS is the only backend supported so far.
>
> Signed-off-by: Roman Bogorodskiy <bogorodskiy at gmail.com>
> ---
> docs/schemas/domaincommon.rng | 36 ++++++++
Also docs/formatdomain.html.in needs an update
> src/conf/domain_capabilities.c | 4 +
> src/conf/domain_conf.c | 156 ++++++++++++++++++++++++++++++++-
> src/conf/domain_conf.h | 24 +++++
> src/conf/virconftypes.h | 3 +
> src/libvirt_private.syms | 2 +
> src/qemu/qemu_command.c | 1 +
> src/qemu/qemu_domain.c | 1 +
> src/qemu/qemu_domain_address.c | 2 +
> src/qemu/qemu_driver.c | 5 ++
> src/qemu/qemu_hotplug.c | 3 +
> src/qemu/qemu_validate.c | 1 +
> 12 files changed, 236 insertions(+), 2 deletions(-)
> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index 241149af24..fefd428ccd 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -85,6 +85,7 @@ typedef enum {
> VIR_DOMAIN_DEVICE_MEMORY,
> VIR_DOMAIN_DEVICE_IOMMU,
> VIR_DOMAIN_DEVICE_VSOCK,
> + VIR_DOMAIN_DEVICE_AUDIO,
>
> VIR_DOMAIN_DEVICE_LAST
> } virDomainDeviceType;
> @@ -116,6 +117,7 @@ struct _virDomainDeviceDef {
> virDomainMemoryDefPtr memory;
> virDomainIOMMUDefPtr iommu;
> virDomainVsockDefPtr vsock;
> + virDomainAudioDefPtr audio;
> } data;
> };
>
> @@ -1415,6 +1417,23 @@ struct _virDomainSoundDef {
>
> size_t ncodecs;
> virDomainSoundCodecDefPtr *codecs;
> +
> + char *audioId;
> +};
> +
> +typedef enum {
> + VIR_DOMAIN_AUDIO_TYPE_OSS,
> +
> + VIR_DOMAIN_AUDIO_TYPE_LAST
> +} virDomainAudioType;
> +
> +struct _virDomainAudioDef {
> + int type;
> +
> + char *id;
> +
> + /* OSS specific configuration */
> + char *inputDev, *outputDev;
Since we're expecting multiple backends, lets go straight for a union
here.
union {
struct {
char *inputDev, *outputDev;
} oss;
} backend;
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
More information about the libvir-list
mailing list