mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
conf: add support for audio backend for the VNC server
When there are multiple <audio> backends specified, it is possible to assign a specific one to the VNC server using <graphics type='vnc'...> <audio id='1'/> </graphics> Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
915b637257
commit
cf1c5c6344
@ -5800,6 +5800,19 @@ interaction with the admin.
|
|||||||
graphics type ``egl-headless`` (see below) which will instruct QEMU to
|
graphics type ``egl-headless`` (see below) which will instruct QEMU to
|
||||||
open and use drm nodes for OpenGL rendering.
|
open and use drm nodes for OpenGL rendering.
|
||||||
|
|
||||||
|
A VNC server could be optionally mapped to the specific host audio
|
||||||
|
backend using the ``<audio>`` sub-element:
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
<graphics type='vnc' ...>
|
||||||
|
<audio id='1'>
|
||||||
|
</graphics>
|
||||||
|
|
||||||
|
Where ``1`` is an id of the `audio device <#elementsAudio>`__. If no
|
||||||
|
ID is specified, then the default audio backend will be used.
|
||||||
|
:since:`Since 7.2.0, qemu`.
|
||||||
|
|
||||||
``spice`` :since:`Since 0.8.6`
|
``spice`` :since:`Since 0.8.6`
|
||||||
Starts a SPICE server. The ``port`` attribute specifies the TCP port
|
Starts a SPICE server. The ``port`` attribute specifies the TCP port
|
||||||
number (with -1 as legacy syntax indicating that it should be
|
number (with -1 as legacy syntax indicating that it should be
|
||||||
@ -6805,8 +6818,8 @@ Valid values are:
|
|||||||
Each ``sound`` element has an optional sub-element ``<address>`` which can tie
|
Each ``sound`` element has an optional sub-element ``<address>`` which can tie
|
||||||
the device to a particular PCI slot, `documented above <#elementsAddress>`__.
|
the device to a particular PCI slot, `documented above <#elementsAddress>`__.
|
||||||
|
|
||||||
:since:`Since 6.7.0`, a sound device could be optionally mapped to the specific
|
A sound device could be optionally mapped to the specific host audio
|
||||||
host audio backend using the ``<audio>`` sub-element:
|
backend using the ``<audio>`` sub-element:
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
@ -6818,8 +6831,9 @@ host audio backend using the ``<audio>`` sub-element:
|
|||||||
</devices>
|
</devices>
|
||||||
...
|
...
|
||||||
|
|
||||||
Where ``1`` is an id of the `audio device <#elementsAudio>`__.
|
Where ``1`` is an id of the `audio device <#elementsAudio>`__. If no
|
||||||
This is supported for bhyve only.
|
ID is specified, then the default audio backend will be used.
|
||||||
|
:since:`Since 6.7.0, bhyve; Since 7.2.0, qemu`.
|
||||||
|
|
||||||
:anchor:`<a id="elementsAudio"/>`
|
:anchor:`<a id="elementsAudio"/>`
|
||||||
|
|
||||||
|
@ -3697,7 +3697,16 @@
|
|||||||
<value>keep</value>
|
<value>keep</value>
|
||||||
</attribute>
|
</attribute>
|
||||||
</optional>
|
</optional>
|
||||||
|
<interleave>
|
||||||
|
<optional>
|
||||||
|
<element name="audio">
|
||||||
|
<attribute name="id">
|
||||||
|
<ref name="uint8"/>
|
||||||
|
</attribute>
|
||||||
|
</element>
|
||||||
|
</optional>
|
||||||
<ref name="listenElements"/>
|
<ref name="listenElements"/>
|
||||||
|
</interleave>
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<attribute name="type">
|
<attribute name="type">
|
||||||
|
@ -13204,6 +13204,8 @@ virDomainGraphicsDefParseXMLVNC(virDomainGraphicsDefPtr def,
|
|||||||
g_autofree char *sharePolicy = virXMLPropString(node, "sharePolicy");
|
g_autofree char *sharePolicy = virXMLPropString(node, "sharePolicy");
|
||||||
g_autofree char *autoport = virXMLPropString(node, "autoport");
|
g_autofree char *autoport = virXMLPropString(node, "autoport");
|
||||||
g_autofree char *powerControl = virXMLPropString(node, "powerControl");
|
g_autofree char *powerControl = virXMLPropString(node, "powerControl");
|
||||||
|
xmlNodePtr audioNode;
|
||||||
|
VIR_XPATH_NODE_AUTORESTORE(ctxt)
|
||||||
|
|
||||||
if (virDomainGraphicsListensParseXML(def, node, ctxt, flags) < 0)
|
if (virDomainGraphicsListensParseXML(def, node, ctxt, flags) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
@ -13272,6 +13274,24 @@ virDomainGraphicsDefParseXMLVNC(virDomainGraphicsDefPtr def,
|
|||||||
|
|
||||||
def->data.vnc.keymap = virXMLPropString(node, "keymap");
|
def->data.vnc.keymap = virXMLPropString(node, "keymap");
|
||||||
|
|
||||||
|
ctxt->node = node;
|
||||||
|
audioNode = virXPathNode("./audio", ctxt);
|
||||||
|
if (audioNode) {
|
||||||
|
g_autofree char *tmp = NULL;
|
||||||
|
tmp = virXMLPropString(audioNode, "id");
|
||||||
|
if (!tmp) {
|
||||||
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
|
_("missing audio 'id' attribute"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (virStrToLong_ui(tmp, NULL, 10, &def->data.vnc.audioId) < 0 ||
|
||||||
|
def->data.vnc.audioId == 0) {
|
||||||
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
|
_("Invalid audio 'id' value '%s'"), tmp);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (virDomainGraphicsAuthDefParseXML(node, &def->data.vnc.auth,
|
if (virDomainGraphicsAuthDefParseXML(node, &def->data.vnc.auth,
|
||||||
def->type) < 0)
|
def->type) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
@ -27512,6 +27532,18 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
|
|||||||
virDomainSpiceGLDefFormat(buf, def);
|
virDomainSpiceGLDefFormat(buf, def);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
|
||||||
|
if (!children) {
|
||||||
|
virBufferAddLit(buf, ">\n");
|
||||||
|
virBufferAdjustIndent(buf, 2);
|
||||||
|
children = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (def->data.vnc.audioId > 0)
|
||||||
|
virBufferAsprintf(buf, "<audio id='%d'/>\n",
|
||||||
|
def->data.vnc.audioId);
|
||||||
|
}
|
||||||
|
|
||||||
if (children) {
|
if (children) {
|
||||||
virBufferAdjustIndent(buf, -2);
|
virBufferAdjustIndent(buf, -2);
|
||||||
virBufferAddLit(buf, "</graphics>\n");
|
virBufferAddLit(buf, "</graphics>\n");
|
||||||
|
@ -1740,6 +1740,7 @@ struct _virDomainGraphicsDef {
|
|||||||
virDomainGraphicsAuthDef auth;
|
virDomainGraphicsAuthDef auth;
|
||||||
int sharePolicy;
|
int sharePolicy;
|
||||||
virTristateBool powerControl;
|
virTristateBool powerControl;
|
||||||
|
unsigned int audioId;
|
||||||
} vnc;
|
} vnc;
|
||||||
struct {
|
struct {
|
||||||
char *display;
|
char *display;
|
||||||
|
Loading…
Reference in New Issue
Block a user