From nobody Thu May 15 10:11:00 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28
as permitted sender) client-ip=209.132.183.28;
envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com;
Authentication-Results: mx.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 15106671308251001.2996258168886;
Tue, 14 Nov 2017 05:45:30 -0800 (PST)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
[10.5.11.12])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 42F386A7EE;
Tue, 14 Nov 2017 13:45:29 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 1BEF8183D5;
Tue, 14 Nov 2017 13:45:29 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id C85C41800C87;
Tue, 14 Nov 2017 13:45:28 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com
[10.5.11.11])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id vAEDjQRw001618 for ;
Tue, 14 Nov 2017 08:45:26 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 437118B56F; Tue, 14 Nov 2017 13:45:26 +0000 (UTC)
Received: from antique-work.brq.redhat.com (unknown [10.43.2.152])
by smtp.corp.redhat.com (Postfix) with ESMTP id BEF93D767E
for ; Tue, 14 Nov 2017 13:45:25 +0000 (UTC)
From: Pavel Hrdina
To: libvir-list@redhat.com
Date: Tue, 14 Nov 2017 14:45:09 +0100
Message-Id:
<774c33a21122436dd813584ed3f727b115e4aa68.1510667009.git.phrdina@redhat.com>
In-Reply-To:
References:
In-Reply-To:
References:
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH 4/6] conf: introduce
=20
+
+ Since 3.10.0 sound device can have
+ an optional output
element which configures where
+ the audio output is connected within host. There is mandatory
+ type
attribute where valid values are 'none' to
+ disable the audio output, 'spice', 'pa', 'sdl', 'alsa', 'oss'.
+ This might not be supported by all hypervisors.
+
+
=20
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 9cec1a0637..c499229c43 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3803,6 +3803,20 @@
[
]
+
+
+
+
+ none
+ spice
+ pa
+ sdl
+ alsa
+ oss
+
+
+
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index fffcc8e9da..33e59c7667 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -517,6 +517,15 @@ VIR_ENUM_IMPL(virDomainSoundModel, VIR_DOMAIN_SOUND_MO=
DEL_LAST,
"ich9",
"usb")
=20
+VIR_ENUM_IMPL(virDomainSoundOutput, VIR_DOMAIN_SOUND_OUTPUT_TYPE_LAST,
+ "default",
+ "none",
+ "spice",
+ "pa",
+ "sdl",
+ "alsa",
+ "oss")
+
VIR_ENUM_IMPL(virDomainKeyWrapCipherName,
VIR_DOMAIN_KEY_WRAP_CIPHER_NAME_LAST,
"aes",
@@ -13687,6 +13696,50 @@ virDomainSoundCodecDefParseXML(xmlNodePtr node)
}
=20
=20
+static int
+virDomainSoundOutputParseXML(xmlXPathContextPtr ctxt,
+ virDomainSoundDefPtr sound)
+{
+ int ret =3D -1;
+ char *type =3D NULL;
+ int typeVal;
+ xmlNodePtr *outputNodes =3D NULL;
+ int noutputs;
+
+ noutputs =3D virXPathNodeSet("./output", ctxt, &outputNodes);
+ if (noutputs < 0)
+ return -1;
+
+ if (noutputs > 1) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("sound device can have only one output configured=
"));
+ goto cleanup;
+ }
+
+ if (noutputs > 0) {
+ if (!(type =3D virXMLPropString(outputNodes[0], "type"))) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("sound output type must be specified"));
+ goto cleanup;
+ }
+
+ if ((typeVal =3D virDomainSoundOutputTypeFromString(type)) < 0) {
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("invalid sound output type '%s'"), type);
+ goto cleanup;
+ }
+
+ sound->output =3D typeVal;
+ }
+
+ ret =3D 0;
+ cleanup:
+ VIR_FREE(outputNodes);
+ VIR_FREE(type);
+ return ret;
+}
+
+
static virDomainSoundDefPtr
virDomainSoundDefParseXML(virDomainXMLOptionPtr xmlopt,
xmlNodePtr node,
@@ -13741,6 +13794,9 @@ virDomainSoundDefParseXML(virDomainXMLOptionPtr xml=
opt,
}
}
=20
+ if (virDomainSoundOutputParseXML(ctxt, def) < 0)
+ goto error;
+
if (virDomainDeviceInfoParseXML(xmlopt, node, NULL, &def->info, flags)=
< 0)
goto error;
=20
@@ -24111,6 +24167,11 @@ virDomainSoundDefFormat(virBufferPtr buf,
=20
virDomainDeviceInfoFormat(&childBuf, &def->info, flags);
=20
+ if (def->output !=3D VIR_DOMAIN_SOUND_OUTPUT_TYPE_DEFAULT) {
+ virBufferAsprintf(&childBuf, "\n",
+ virDomainSoundOutputTypeToString(def->output));
+ }
+
if (virBufferCheckError(&childBuf) < 0)
return -1;
=20
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index e3f060b122..55a984c781 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1332,12 +1332,25 @@ struct _virDomainSoundCodecDef {
int cad;
};
=20
+typedef enum {
+ VIR_DOMAIN_SOUND_OUTPUT_TYPE_DEFAULT,
+ VIR_DOMAIN_SOUND_OUTPUT_TYPE_NONE,
+ VIR_DOMAIN_SOUND_OUTPUT_TYPE_SPICE,
+ VIR_DOMAIN_SOUND_OUTPUT_TYPE_PA,
+ VIR_DOMAIN_SOUND_OUTPUT_TYPE_SDL,
+ VIR_DOMAIN_SOUND_OUTPUT_TYPE_ALSA,
+ VIR_DOMAIN_SOUND_OUTPUT_TYPE_OSS,
+
+ VIR_DOMAIN_SOUND_OUTPUT_TYPE_LAST
+} virDomainSoundOutputType;
+
struct _virDomainSoundDef {
int model;
virDomainDeviceInfo info;
=20
size_t ncodecs;
virDomainSoundCodecDefPtr *codecs;
+ virDomainSoundOutputType output;
};
=20
typedef enum {
@@ -3246,6 +3259,7 @@ VIR_ENUM_DECL(virDomainChrTcpProtocol)
VIR_ENUM_DECL(virDomainChrSpicevmc)
VIR_ENUM_DECL(virDomainSoundCodec)
VIR_ENUM_DECL(virDomainSoundModel)
+VIR_ENUM_DECL(virDomainSoundOutput)
VIR_ENUM_DECL(virDomainKeyWrapCipherName)
VIR_ENUM_DECL(virDomainMemballoonModel)
VIR_ENUM_DECL(virDomainSmbiosMode)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 5a4d50471d..0ef7e896d8 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -516,6 +516,8 @@ virDomainSmbiosModeTypeToString;
virDomainSoundDefFree;
virDomainSoundModelTypeFromString;
virDomainSoundModelTypeToString;
+virDomainSoundOutputTypeFromString;
+virDomainSoundOutputTypeToString;
virDomainStartupPolicyTypeFromString;
virDomainStartupPolicyTypeToString;
virDomainStateReasonFromString;
--=20
2.13.6
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list