diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2023-10-05 12:17:28 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2023-10-08 21:08:27 +0200 |
commit | 8f527a3c0d2866df1affe8f0fb8ab73fbbb8ac52 (patch) | |
tree | f802631ccaf9986d204b8f95a8f99840524414cc /audio | |
parent | c753bf479ab75fe245c2de6a414b60b9e25a2bd7 (diff) | |
download | qemu-8f527a3c0d2866df1affe8f0fb8ab73fbbb8ac52.zip qemu-8f527a3c0d2866df1affe8f0fb8ab73fbbb8ac52.tar.gz qemu-8f527a3c0d2866df1affe8f0fb8ab73fbbb8ac52.tar.bz2 |
audio: extract audio_define_default
It will be used soon to define a default audio device from the
command line.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'audio')
-rw-r--r-- | audio/audio.c | 19 | ||||
-rw-r--r-- | audio/audio.h | 1 |
2 files changed, 13 insertions, 7 deletions
diff --git a/audio/audio.c b/audio/audio.c index 67a7e25..887219e 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1686,8 +1686,6 @@ static const VMStateDescription vmstate_audio = { } }; -static void audio_validate_opts(Audiodev *dev, Error **errp); - void audio_create_default_audiodevs(void) { const char *drvname = getenv("QEMU_AUDIO_DRV"); @@ -1706,7 +1704,6 @@ void audio_create_default_audiodevs(void) if (audio_driver_lookup(audio_prio_list[i])) { QDict *dict = qdict_new(); Audiodev *dev = NULL; - AudiodevListEntry *e; Visitor *v; qdict_put_str(dict, "driver", audio_prio_list[i]); @@ -1717,10 +1714,7 @@ void audio_create_default_audiodevs(void) visit_type_Audiodev(v, NULL, &dev, &error_fatal); visit_free(v); - audio_validate_opts(dev, &error_abort); - e = g_new0(AudiodevListEntry, 1); - e->dev = dev; - QSIMPLEQ_INSERT_TAIL(&default_audiodevs, e, next); + audio_define_default(dev, &error_abort); } } } @@ -2165,6 +2159,17 @@ void audio_define(Audiodev *dev) QSIMPLEQ_INSERT_TAIL(&audiodevs, e, next); } +void audio_define_default(Audiodev *dev, Error **errp) +{ + AudiodevListEntry *e; + + audio_validate_opts(dev, errp); + + e = g_new0(AudiodevListEntry, 1); + e->dev = dev; + QSIMPLEQ_INSERT_TAIL(&default_audiodevs, e, next); +} + void audio_init_audiodevs(void) { AudiodevListEntry *e; diff --git a/audio/audio.h b/audio/audio.h index 53b1d7e..6da5e8f 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -169,6 +169,7 @@ void audio_sample_from_uint64(void *samples, int pos, uint64_t left, uint64_t right); void audio_define(Audiodev *audio); +void audio_define_default(Audiodev *dev, Error **errp); void audio_parse_option(const char *opt); void audio_create_default_audiodevs(void); void audio_init_audiodevs(void); |