On 01/21/2011 03:53 PM, Cole Robinson wrote:
In QEMU, the card itself is a PCI device, but it requires a codec
(either -device hda-output or -device hda-duplex) to actually output
sound. Specifying <sound model='ich6'/> gives us -device intel-hda
-device hda-duplex I think it's important that a simple <sound
model='ich6'/>
sets up a useful codec, to have consistent behavior with all other sound cards.
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index c20f031..627ec43 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1774,11 +1774,13 @@ qemuBuildSoundDevStr(virDomainSoundDefPtr sound)
goto error;
}
- /* Hack for 2 wierdly unusal devices name in QEMU */
+ /* Hack for wierdly unusal devices name in QEMU */
Pre-existing double typo, but you might as well fix it while touching
this line:
s/wierdly unusal/weirdly unusual/
+static char *
+qemuBuildSoundCodecStr(virDomainSoundDefPtr sound,
+ const char *codec)
+{
+ virBuffer buf = VIR_BUFFER_INITIALIZER;
+ int cad = 0;
+
+ virBufferVSprintf(&buf, "%s", codec);
+ virBufferVSprintf(&buf, ",id=%s-codec%d", sound->info.alias, cad);
+ virBufferVSprintf(&buf, ",bus=%s.0", sound->info.alias);
+ virBufferVSprintf(&buf, ",cad=%d", cad);
It's slightly more efficient to use a single virBufferVSprintf with
multiple arguments, but I don't know if it would hurt read-ability. So
no problems if you keep it this way.
ACK with the spelling nit fixed.
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org