mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
conf: add helper to test for sound device codec support
The check for ICH6 || ICH9 is repeated in many places in the code. The new virDomainSoundModelSupportsCodecs() method provides a helper to standardize this check. Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
fe304b02f0
commit
657999b04f
@ -13774,8 +13774,7 @@ virDomainSoundDefParseXML(virDomainXMLOptionPtr xmlopt,
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (def->model == VIR_DOMAIN_SOUND_MODEL_ICH6 ||
|
||||
def->model == VIR_DOMAIN_SOUND_MODEL_ICH9) {
|
||||
if (virDomainSoundModelSupportsCodecs(def)) {
|
||||
int ncodecs;
|
||||
g_autofree xmlNodePtr *codecNodes = NULL;
|
||||
|
||||
@ -30356,6 +30355,14 @@ virDomainDefFindAudioForSound(virDomainDefPtr def,
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
virDomainSoundModelSupportsCodecs(virDomainSoundDefPtr def)
|
||||
{
|
||||
return def->model == VIR_DOMAIN_SOUND_MODEL_ICH6 ||
|
||||
def->model == VIR_DOMAIN_SOUND_MODEL_ICH9;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
virDomainObjGetMetadata(virDomainObjPtr vm,
|
||||
int type,
|
||||
|
@ -3786,6 +3786,8 @@ int virDomainDefFindDevice(virDomainDefPtr def,
|
||||
virDomainAudioDefPtr
|
||||
virDomainDefFindAudioForSound(virDomainDefPtr def,
|
||||
virDomainSoundDefPtr sound);
|
||||
bool
|
||||
virDomainSoundModelSupportsCodecs(virDomainSoundDefPtr def);
|
||||
|
||||
const char *virDomainChrSourceDefGetPath(virDomainChrSourceDefPtr chr);
|
||||
|
||||
|
@ -618,6 +618,7 @@ virDomainSmbiosModeTypeToString;
|
||||
virDomainSoundDefFind;
|
||||
virDomainSoundDefFree;
|
||||
virDomainSoundDefRemove;
|
||||
virDomainSoundModelSupportsCodecs;
|
||||
virDomainSoundModelTypeFromString;
|
||||
virDomainSoundModelTypeToString;
|
||||
virDomainStartupPolicyTypeFromString;
|
||||
|
@ -4101,9 +4101,7 @@ qemuBuildSoundCommandLine(virCommandPtr cmd,
|
||||
return -1;
|
||||
|
||||
virCommandAddArg(cmd, str);
|
||||
if (sound->model == VIR_DOMAIN_SOUND_MODEL_ICH6 ||
|
||||
sound->model == VIR_DOMAIN_SOUND_MODEL_ICH9) {
|
||||
|
||||
if (virDomainSoundModelSupportsCodecs(sound)) {
|
||||
for (j = 0; j < sound->ncodecs; j++) {
|
||||
g_autofree char *codecstr = NULL;
|
||||
virCommandAddArg(cmd, "-device");
|
||||
|
@ -4219,8 +4219,7 @@ qemuValidateDomainDeviceDefSound(virDomainSoundDefPtr sound,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (sound->model == VIR_DOMAIN_SOUND_MODEL_ICH6 ||
|
||||
sound->model == VIR_DOMAIN_SOUND_MODEL_ICH9) {
|
||||
if (virDomainSoundModelSupportsCodecs(sound)) {
|
||||
for (i = 0; i < sound->ncodecs; i++) {
|
||||
const char *stype;
|
||||
int type, flags;
|
||||
|
Loading…
Reference in New Issue
Block a user