audio: disable default backends if -audio/-audiodev is used
Match what is done for other options, for example -monitor, and also the behavior of QEMU 8.1 (see the "legacy_config" variable). Require the user to specify a backend if one is specified on the command line. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
c7c5caeb1f
commit
c753bf479a
|
@ -1688,14 +1688,10 @@ static const VMStateDescription vmstate_audio = {
|
||||||
|
|
||||||
static void audio_validate_opts(Audiodev *dev, Error **errp);
|
static void audio_validate_opts(Audiodev *dev, Error **errp);
|
||||||
|
|
||||||
static void audio_create_default_audiodevs(void)
|
void audio_create_default_audiodevs(void)
|
||||||
{
|
{
|
||||||
const char *drvname = getenv("QEMU_AUDIO_DRV");
|
const char *drvname = getenv("QEMU_AUDIO_DRV");
|
||||||
|
|
||||||
if (!defaults_enabled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* QEMU_AUDIO_DRV=none is used by libqtest. */
|
/* QEMU_AUDIO_DRV=none is used by libqtest. */
|
||||||
if (drvname && !g_str_equal(drvname, "none")) {
|
if (drvname && !g_str_equal(drvname, "none")) {
|
||||||
error_report("Please use -audiodev instead of QEMU_AUDIO_*");
|
error_report("Please use -audiodev instead of QEMU_AUDIO_*");
|
||||||
|
@ -1827,9 +1823,6 @@ bool AUD_register_card (const char *name, QEMUSoundCard *card, Error **errp)
|
||||||
}
|
}
|
||||||
card->state = QTAILQ_FIRST(&audio_states);
|
card->state = QTAILQ_FIRST(&audio_states);
|
||||||
} else {
|
} else {
|
||||||
if (QSIMPLEQ_EMPTY(&default_audiodevs)) {
|
|
||||||
audio_create_default_audiodevs();
|
|
||||||
}
|
|
||||||
card->state = audio_init(NULL, errp);
|
card->state = audio_init(NULL, errp);
|
||||||
if (!card->state) {
|
if (!card->state) {
|
||||||
if (!QSIMPLEQ_EMPTY(&audiodevs)) {
|
if (!QSIMPLEQ_EMPTY(&audiodevs)) {
|
||||||
|
|
|
@ -170,6 +170,7 @@ void audio_sample_from_uint64(void *samples, int pos,
|
||||||
|
|
||||||
void audio_define(Audiodev *audio);
|
void audio_define(Audiodev *audio);
|
||||||
void audio_parse_option(const char *opt);
|
void audio_parse_option(const char *opt);
|
||||||
|
void audio_create_default_audiodevs(void);
|
||||||
void audio_init_audiodevs(void);
|
void audio_init_audiodevs(void);
|
||||||
void audio_help(void);
|
void audio_help(void);
|
||||||
|
|
||||||
|
|
|
@ -442,6 +442,9 @@ line using a ``secret`` object instance.
|
||||||
The ``-audiodev`` and ``-audio`` command line options are now the only
|
The ``-audiodev`` and ``-audio`` command line options are now the only
|
||||||
way to specify audio backend settings.
|
way to specify audio backend settings.
|
||||||
|
|
||||||
|
Note that the default audio backend must be configured on the command
|
||||||
|
line if the ``-nodefaults`` options is used.
|
||||||
|
|
||||||
Creating vnc without ``audiodev=`` property (removed in 8.2)
|
Creating vnc without ``audiodev=`` property (removed in 8.2)
|
||||||
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
|
||||||
|
|
|
@ -184,6 +184,7 @@ static const char *qtest_log;
|
||||||
static bool opt_one_insn_per_tb;
|
static bool opt_one_insn_per_tb;
|
||||||
|
|
||||||
static int has_defaults = 1;
|
static int has_defaults = 1;
|
||||||
|
static int default_audio = 1;
|
||||||
static int default_serial = 1;
|
static int default_serial = 1;
|
||||||
static int default_parallel = 1;
|
static int default_parallel = 1;
|
||||||
static int default_monitor = 1;
|
static int default_monitor = 1;
|
||||||
|
@ -1327,6 +1328,7 @@ static void qemu_disable_default_devices(void)
|
||||||
default_sdcard = 0;
|
default_sdcard = 0;
|
||||||
}
|
}
|
||||||
if (!has_defaults) {
|
if (!has_defaults) {
|
||||||
|
default_audio = 0;
|
||||||
default_monitor = 0;
|
default_monitor = 0;
|
||||||
default_net = 0;
|
default_net = 0;
|
||||||
default_vga = 0;
|
default_vga = 0;
|
||||||
|
@ -1963,6 +1965,9 @@ static void qemu_create_early_backends(void)
|
||||||
*/
|
*/
|
||||||
configure_blockdev(&bdo_queue, machine_class, snapshot);
|
configure_blockdev(&bdo_queue, machine_class, snapshot);
|
||||||
audio_init_audiodevs();
|
audio_init_audiodevs();
|
||||||
|
if (default_audio) {
|
||||||
|
audio_create_default_audiodevs();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2925,6 +2930,7 @@ void qemu_init(int argc, char **argv)
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case QEMU_OPTION_audiodev:
|
case QEMU_OPTION_audiodev:
|
||||||
|
default_audio = 0;
|
||||||
audio_parse_option(optarg);
|
audio_parse_option(optarg);
|
||||||
break;
|
break;
|
||||||
case QEMU_OPTION_audio: {
|
case QEMU_OPTION_audio: {
|
||||||
|
@ -2933,6 +2939,7 @@ void qemu_init(int argc, char **argv)
|
||||||
Audiodev *dev = NULL;
|
Audiodev *dev = NULL;
|
||||||
Visitor *v;
|
Visitor *v;
|
||||||
QDict *dict = keyval_parse(optarg, "driver", &help, &error_fatal);
|
QDict *dict = keyval_parse(optarg, "driver", &help, &error_fatal);
|
||||||
|
default_audio = 0;
|
||||||
if (help || (qdict_haskey(dict, "driver") &&
|
if (help || (qdict_haskey(dict, "driver") &&
|
||||||
is_help_option(qdict_get_str(dict, "driver")))) {
|
is_help_option(qdict_get_str(dict, "driver")))) {
|
||||||
audio_help();
|
audio_help();
|
||||||
|
|
Loading…
Reference in New Issue