From: Claudio Fontana <cfontana@suse.de>
To: "Volker Rümelin" <vr_qemu@t-online.de>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Christian Schoenebeck" <qemu_oss@crudebyte.com>,
"Akihiko Odaki" <akihiko.odaki@gmail.com>
Cc: qemu-devel@nongnu.org,
"Richard Henderson" <richard.henderson@linaro.org>,
"Daniel P . Berrangé" <berrange@redhat.com>,
"BALATON Zoltan" <balaton@eik.bme.hu>
Subject: Re: [PATCH v2] audio: add help option for -audio and -audiodev
Date: Thu, 8 Sep 2022 10:03:22 +0200 [thread overview]
Message-ID: <7e8e893b-7445-8fe5-fd6f-ba48e0688adf@suse.de> (raw)
In-Reply-To: <930ed191-5354-b0d0-2998-0e771a97973f@t-online.de>
On 9/8/22 07:55, Volker Rümelin wrote:
> Am 07.09.22 um 19:30 schrieb Claudio Fontana:
>
>> 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>
>> ---
>> audio/audio.c | 20 ++++++++++++++++++++
>> audio/audio.h | 1 +
>> qemu-options.hx | 10 ++++++----
>> softmmu/vl.c | 9 +++++++--
>> 4 files changed, 34 insertions(+), 6 deletions(-)
>>
>> v1 -> v2: also extend the help to -audio.
>>
>> -audio help
>> -audio driver=help
>> -audiodev help
>>
>> will all show the same results.
>>
>> diff --git a/audio/audio.c b/audio/audio.c
>> index 4f4bb10cce..ffb09ec825 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"
>> @@ -2105,10 +2106,29 @@ static void audio_validate_opts(Audiodev *dev, Error **errp)
>> }
>> }
>>
>> +void audio_help(void)
>> +{
>> + int i;
>> +
>> + printf("Available audio drivers:\n");
>> + printf("none\n");
>> +
>> + for (i = 0; audio_prio_list[i]; i++) {
>> + audio_driver *driver = audio_driver_lookup(audio_prio_list[i]);
>
> Hi Claudio,
>
> there is no guarantee that the audio_prio_list contains all audio
> backend drivers. I would use this
>
> + for (i = 0; i < AUDIODEV_DRIVER__MAX; i++) {
> + const char *name = AudiodevDriver_str(i);
> + audio_driver *driver = audio_driver_lookup(name);
>
> to enumerate all audio backend drivers.
Thanks Volker, will update accordingly.
Claudio
>
> With best regards,
> Volker
>
>> + if (driver) {
>> + printf("%s\n", driver->name);
>> + }
>> + }
>> +}
>> +
>>
>
prev parent reply other threads:[~2022-09-08 8:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-07 17:30 [PATCH v2] audio: add help option for -audio and -audiodev Claudio Fontana
2022-09-08 5:55 ` Volker Rümelin
2022-09-08 8:03 ` Claudio Fontana [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7e8e893b-7445-8fe5-fd6f-ba48e0688adf@suse.de \
--to=cfontana@suse.de \
--cc=akihiko.odaki@gmail.com \
--cc=balaton@eik.bme.hu \
--cc=berrange@redhat.com \
--cc=f4bug@amsat.org \
--cc=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu_oss@crudebyte.com \
--cc=richard.henderson@linaro.org \
--cc=vr_qemu@t-online.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).