mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-09 06:25:19 +00:00
qemu: command: Drop the code for configuring audio devices via environment variables
Remove the old now unused code. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
31ee59d4e1
commit
fb9eece471
@ -8068,189 +8068,6 @@ qemuBuildAudioCommandLineArgs(virCommand *cmd,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
qemuBuildAudioCommonEnv(virCommand *cmd,
|
||||
const char *prefix,
|
||||
virDomainAudioIOCommon *def)
|
||||
{
|
||||
if (def->fixedSettings)
|
||||
virCommandAddEnvFormat(cmd, "%sFIXED_SETTINGS=%s",
|
||||
prefix,
|
||||
virTristateSwitchTypeToString(def->fixedSettings));
|
||||
|
||||
if (def->voices)
|
||||
virCommandAddEnvFormat(cmd, "%sVOICES=%u",
|
||||
prefix, def->voices);
|
||||
|
||||
if (def->fixedSettings) {
|
||||
if (def->frequency)
|
||||
virCommandAddEnvFormat(cmd, "%sFIXED_FREQ=%u",
|
||||
prefix, def->frequency);
|
||||
if (def->channels)
|
||||
virCommandAddEnvFormat(cmd, "%sFIXED_CHANNELS=%u",
|
||||
prefix, def->channels);
|
||||
if (def->format)
|
||||
virCommandAddEnvFormat(cmd, "%sFIXED_FMT=%s",
|
||||
prefix,
|
||||
virDomainAudioFormatTypeToString(def->format));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
qemuBuildAudioALSAEnv(virCommand *cmd,
|
||||
const char *prefix,
|
||||
virDomainAudioIOALSA *def)
|
||||
{
|
||||
if (def->dev)
|
||||
virCommandAddEnvFormat(cmd, "%sDEV=%s",
|
||||
prefix, def->dev);
|
||||
}
|
||||
|
||||
static void
|
||||
qemuBuildAudioCoreAudioEnv(virCommand *cmd,
|
||||
virDomainAudioDef *def)
|
||||
{
|
||||
if (def->backend.coreaudio.output.bufferCount)
|
||||
virCommandAddEnvFormat(cmd, "QEMU_COREAUDIO_BUFFER_COUNT=%u",
|
||||
def->backend.coreaudio.output.bufferCount);
|
||||
if (def->output.bufferLength)
|
||||
virCommandAddEnvFormat(cmd, "QEMU_COREAUDIO_BUFFER_SIZE=%u",
|
||||
def->output.bufferLength);
|
||||
}
|
||||
|
||||
static void
|
||||
qemuBuildAudioOSSEnv(virCommand *cmd,
|
||||
const char *prefix,
|
||||
const char *prefix2,
|
||||
virDomainAudioIOOSS *def)
|
||||
{
|
||||
if (def->dev)
|
||||
virCommandAddEnvFormat(cmd, "%sDEV=%s",
|
||||
prefix, def->dev);
|
||||
if (def->tryPoll)
|
||||
virCommandAddEnvFormat(cmd, "%sTRY_POLL=%s", prefix2,
|
||||
virTristateSwitchTypeToString(def->tryPoll));
|
||||
}
|
||||
|
||||
static void
|
||||
qemuBuildAudioPulseAudioEnv(virCommand *cmd,
|
||||
virDomainAudioDef *def)
|
||||
{
|
||||
if (def->backend.pulseaudio.input.name)
|
||||
virCommandAddEnvPair(cmd, "QEMU_PA_SOURCE",
|
||||
def->backend.pulseaudio.input.name);
|
||||
if (def->backend.pulseaudio.output.name)
|
||||
virCommandAddEnvPair(cmd, "QEMU_PA_SINK",
|
||||
def->backend.pulseaudio.output.name);
|
||||
|
||||
if (def->input.bufferLength)
|
||||
virCommandAddEnvFormat(cmd, "QEMU_PA_SAMPLES=%u",
|
||||
def->input.bufferLength);
|
||||
|
||||
if (def->backend.pulseaudio.serverName)
|
||||
virCommandAddEnvPair(cmd, "QEMU_PA_SERVER=%s",
|
||||
def->backend.pulseaudio.serverName);
|
||||
}
|
||||
|
||||
|
||||
static int G_GNUC_UNUSED
|
||||
qemuBuildAudioCommandLineEnv(virCommand *cmd,
|
||||
virDomainDef *def)
|
||||
{
|
||||
virDomainAudioDef *audio;
|
||||
if (def->naudios != 1)
|
||||
return 0;
|
||||
|
||||
audio = def->audios[0];
|
||||
virCommandAddEnvPair(cmd, "QEMU_AUDIO_DRV",
|
||||
qemuAudioDriverTypeToString(audio->type));
|
||||
|
||||
if (audio->timerPeriod)
|
||||
virCommandAddEnvFormat(cmd, "QEMU_AUDIO_TIMER_PERIOD=%u",
|
||||
audio->timerPeriod);
|
||||
|
||||
qemuBuildAudioCommonEnv(cmd, "QEMU_AUDIO_ADC_", &audio->input);
|
||||
qemuBuildAudioCommonEnv(cmd, "QEMU_AUDIO_DAC_", &audio->output);
|
||||
|
||||
switch (audio->type) {
|
||||
case VIR_DOMAIN_AUDIO_TYPE_NONE:
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_AUDIO_TYPE_ALSA:
|
||||
qemuBuildAudioALSAEnv(cmd, "QEMU_AUDIO_ADC_", &audio->backend.alsa.input);
|
||||
qemuBuildAudioALSAEnv(cmd, "QEMU_AUDIO_DAC_", &audio->backend.alsa.output);
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_AUDIO_TYPE_COREAUDIO:
|
||||
qemuBuildAudioCoreAudioEnv(cmd, audio);
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_AUDIO_TYPE_JACK:
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_AUDIO_TYPE_OSS:
|
||||
qemuBuildAudioOSSEnv(cmd, "QEMU_OSS_ADC_", "QEMU_AUDIO_ADC_",
|
||||
&audio->backend.oss.input);
|
||||
qemuBuildAudioOSSEnv(cmd, "QEMU_OSS_DAC_", "QEMU_AUDIO_DAC_",
|
||||
&audio->backend.oss.output);
|
||||
|
||||
if (audio->backend.oss.input.bufferCount)
|
||||
virCommandAddEnvFormat(cmd, "QEMU_OSS_NFRAGS=%u",
|
||||
audio->backend.oss.input.bufferCount);
|
||||
|
||||
if (audio->backend.oss.tryMMap)
|
||||
virCommandAddEnvFormat(cmd, "QEMU_OSS_MMAP=%s",
|
||||
virTristateSwitchTypeToString(audio->backend.oss.tryMMap));
|
||||
if (audio->backend.oss.exclusive)
|
||||
virCommandAddEnvFormat(cmd, "QEMU_OSS_EXCLUSIVE=%s",
|
||||
virTristateSwitchTypeToString(audio->backend.oss.exclusive));
|
||||
if (audio->backend.oss.dspPolicySet)
|
||||
virCommandAddEnvFormat(cmd, "QEMU_OSS_POLICY=%d",
|
||||
audio->backend.oss.dspPolicy);
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_AUDIO_TYPE_PULSEAUDIO:
|
||||
qemuBuildAudioPulseAudioEnv(cmd, audio);
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_AUDIO_TYPE_SDL:
|
||||
if (audio->output.bufferLength)
|
||||
virCommandAddEnvFormat(cmd, "QEMU_SDL_SAMPLES=%u",
|
||||
audio->output.bufferLength);
|
||||
|
||||
if (audio->backend.sdl.driver) {
|
||||
/*
|
||||
* Some SDL audio driver names are different on SDL 1.2
|
||||
* vs 2.0. Given how old SDL 1.2 is, we're not going
|
||||
* make any attempt to support it here as it is unlikely
|
||||
* to have an real world users. We can assume libvirt
|
||||
* driver name strings match SDL 2.0 names.
|
||||
*/
|
||||
virCommandAddEnvPair(cmd, "SDL_AUDIODRIVER",
|
||||
virDomainAudioSDLDriverTypeToString(
|
||||
audio->backend.sdl.driver));
|
||||
}
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_AUDIO_TYPE_SPICE:
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_AUDIO_TYPE_FILE:
|
||||
if (audio->backend.file.path)
|
||||
virCommandAddEnvFormat(cmd, "QEMU_WAV_PATH=%s",
|
||||
audio->backend.file.path);
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_AUDIO_TYPE_DBUS:
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_AUDIO_TYPE_LAST:
|
||||
default:
|
||||
virReportEnumRangeError(virDomainAudioType, audio->type);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
qemuBuildAudioCommandLine(virCommand *cmd,
|
||||
|
Loading…
Reference in New Issue
Block a user