diff options
author | Claudio Fontana | 2022-09-08 10:14:41 +0200 |
---|---|---|
committer | Paolo Bonzini | 2022-09-19 15:15:59 +0200 |
commit | 5e03b6daf66dfb0f5512a0dfc9e21e749b6f67b7 (patch) | |
tree | dec53f75a01efdb02bf44dfb4e44c9880837a6a1 /audio | |
parent | tests/tcg: remove old SSE tests (diff) | |
download | qemu-5e03b6daf66dfb0f5512a0dfc9e21e749b6f67b7.tar.gz qemu-5e03b6daf66dfb0f5512a0dfc9e21e749b6f67b7.tar.xz qemu-5e03b6daf66dfb0f5512a0dfc9e21e749b6f67b7.zip |
audio: add help option for -audio and -audiodev
add a simple help option for -audio and -audiodev
to show the list of available drivers, and document them.
Signed-off-by: Claudio Fontana <cfontana@suse.de>
Message-Id: <20220908081441.7111-1-cfontana@suse.de>
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, 20 insertions, 0 deletions
diff --git a/audio/audio.c b/audio/audio.c index 76b8735b44..cfa4119c05 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -32,6 +32,7 @@ #include "qapi/qapi-visit-audio.h" #include "qemu/cutils.h" #include "qemu/module.h" +#include "qemu/help_option.h" #include "sysemu/sysemu.h" #include "sysemu/replay.h" #include "sysemu/runstate.h" @@ -2101,10 +2102,28 @@ static void audio_validate_opts(Audiodev *dev, Error **errp) } } +void audio_help(void) +{ + int i; + + printf("Available audio drivers:\n"); + + for (i = 0; i < AUDIODEV_DRIVER__MAX; i++) { + audio_driver *driver = audio_driver_lookup(AudiodevDriver_str(i)); + if (driver) { + printf("%s\n", driver->name); + } + } +} + void audio_parse_option(const char *opt) { Audiodev *dev = NULL; + if (is_help_option(opt)) { + audio_help(); + exit(EXIT_SUCCESS); + } Visitor *v = qobject_input_visitor_new_str(opt, "driver", &error_fatal); visit_type_Audiodev(v, NULL, &dev, &error_fatal); visit_free(v); diff --git a/audio/audio.h b/audio/audio.h index 27e67079a0..01bdc567fb 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -171,6 +171,7 @@ void audio_sample_from_uint64(void *samples, int pos, void audio_define(Audiodev *audio); void audio_parse_option(const char *opt); bool audio_init_audiodevs(void); +void audio_help(void); void audio_legacy_help(void); AudioState *audio_state_by_name(const char *name); |