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;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (def->model == VIR_DOMAIN_SOUND_MODEL_ICH6 ||
|
if (virDomainSoundModelSupportsCodecs(def)) {
|
||||||
def->model == VIR_DOMAIN_SOUND_MODEL_ICH9) {
|
|
||||||
int ncodecs;
|
int ncodecs;
|
||||||
g_autofree xmlNodePtr *codecNodes = NULL;
|
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 *
|
char *
|
||||||
virDomainObjGetMetadata(virDomainObjPtr vm,
|
virDomainObjGetMetadata(virDomainObjPtr vm,
|
||||||
int type,
|
int type,
|
||||||
|
@ -3786,6 +3786,8 @@ int virDomainDefFindDevice(virDomainDefPtr def,
|
|||||||
virDomainAudioDefPtr
|
virDomainAudioDefPtr
|
||||||
virDomainDefFindAudioForSound(virDomainDefPtr def,
|
virDomainDefFindAudioForSound(virDomainDefPtr def,
|
||||||
virDomainSoundDefPtr sound);
|
virDomainSoundDefPtr sound);
|
||||||
|
bool
|
||||||
|
virDomainSoundModelSupportsCodecs(virDomainSoundDefPtr def);
|
||||||
|
|
||||||
const char *virDomainChrSourceDefGetPath(virDomainChrSourceDefPtr chr);
|
const char *virDomainChrSourceDefGetPath(virDomainChrSourceDefPtr chr);
|
||||||
|
|
||||||
|
@ -618,6 +618,7 @@ virDomainSmbiosModeTypeToString;
|
|||||||
virDomainSoundDefFind;
|
virDomainSoundDefFind;
|
||||||
virDomainSoundDefFree;
|
virDomainSoundDefFree;
|
||||||
virDomainSoundDefRemove;
|
virDomainSoundDefRemove;
|
||||||
|
virDomainSoundModelSupportsCodecs;
|
||||||
virDomainSoundModelTypeFromString;
|
virDomainSoundModelTypeFromString;
|
||||||
virDomainSoundModelTypeToString;
|
virDomainSoundModelTypeToString;
|
||||||
virDomainStartupPolicyTypeFromString;
|
virDomainStartupPolicyTypeFromString;
|
||||||
|
@ -4101,9 +4101,7 @@ qemuBuildSoundCommandLine(virCommandPtr cmd,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
virCommandAddArg(cmd, str);
|
virCommandAddArg(cmd, str);
|
||||||
if (sound->model == VIR_DOMAIN_SOUND_MODEL_ICH6 ||
|
if (virDomainSoundModelSupportsCodecs(sound)) {
|
||||||
sound->model == VIR_DOMAIN_SOUND_MODEL_ICH9) {
|
|
||||||
|
|
||||||
for (j = 0; j < sound->ncodecs; j++) {
|
for (j = 0; j < sound->ncodecs; j++) {
|
||||||
g_autofree char *codecstr = NULL;
|
g_autofree char *codecstr = NULL;
|
||||||
virCommandAddArg(cmd, "-device");
|
virCommandAddArg(cmd, "-device");
|
||||||
|
@ -4219,8 +4219,7 @@ qemuValidateDomainDeviceDefSound(virDomainSoundDefPtr sound,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sound->model == VIR_DOMAIN_SOUND_MODEL_ICH6 ||
|
if (virDomainSoundModelSupportsCodecs(sound)) {
|
||||||
sound->model == VIR_DOMAIN_SOUND_MODEL_ICH9) {
|
|
||||||
for (i = 0; i < sound->ncodecs; i++) {
|
for (i = 0; i < sound->ncodecs; i++) {
|
||||||
const char *stype;
|
const char *stype;
|
||||||
int type, flags;
|
int type, flags;
|
||||||
|
Loading…
Reference in New Issue
Block a user