From: "Zoltán Kővágó" <dirty.ice.hu@gmail.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v4 01/14] qapi: qapi for audio backends
Date: Thu, 7 Feb 2019 21:26:02 +0100 [thread overview]
Message-ID: <2dd27326-e491-9460-5fae-5706449d004e@gmail.com> (raw)
In-Reply-To: <87lg33h9lo.fsf@dusky.pond.sub.org>
On 2019-01-29 14:33, Markus Armbruster wrote:
> "Kővágó, Zoltán" <dirty.ice.hu@gmail.com> writes:
[...]
>> +
>> +##
>> +# @AudiodevPaOptions:
>> +#
>> +# Options of the pa (PulseAudio) audio backend.
>> +#
>> +# @server: PulseAudio server address (default: let PulseAudio choose)
>> +#
>> +# @sink: name of the sink to use
>> +#
>> +# @source: name of the source to use
>> +#
>> +# Since: 4.0
>> +##
>> +{ 'struct': 'AudiodevPaOptions',
>> + 'data': {
>> + '*server': 'str',
>> + '*sink': 'AudiodevPaPerDirectionOptions',
>> + '*source': 'AudiodevPaPerDirectionOptions' } }
>> +
>> +##
>> +# @AudiodevWavOptions:
>> +#
>> +# Options of the wav audio backend.
>> +#
>> +# @path: name of the wav file to record (default 'qemu.wav')
>> +#
>> +# Since: 4.0
>> +##
>> +{ 'struct': 'AudiodevWavOptions',
>> + 'data': {
>> + '*path': 'str' } }
>
> Pattern so far:
>
> * AudiodevFooOptions
>
> Foo direction options other options
> Alsa alsa-in, alsa-out threshold
> Dsound latency
> Oss oss-in, oss-out try-map, exclusive, dsp-policy
> Pa sink, source server
> Wav path
>
> Any particular reason for naming the direction options differently?
I probably chose that name because in PulseAudio parlance you have
sources and sinks, and the current environment variable based setting of
pa doesn't use ADC/DAC to refer to source/sink, but now that you mention
it it probably makes sense to rename them to pa-in and pa-out, it's more
uniform that way.
[...]
>> +##
>> +# @Audiodev:
>> +#
>> +# Options of an audio backend.
>> +#
>> +# @id: identifier of the backend
>> +#
>> +# @driver: the backend driver to use
>> +#
>> +# @in: options of the capture stream
>> +#
>> +# @out: options of the playback stream
>> +#
>> +# @timer-period: timer period (in microseconds, 0: use lowest possible)
>> +#
>> +# Since: 4.0
>> +##
>> +{ 'union': 'Audiodev',
>> + 'base': {
>> + 'id': 'str',
>> + 'driver': 'AudiodevDriver',
>> + '*in': 'AudiodevPerDirectionOptions',
>> + '*out': 'AudiodevPerDirectionOptions',
>> + '*timer-period': 'uint32' },
>> + 'discriminator': 'driver',
>> + 'data': {
>> + 'alsa': 'AudiodevAlsaOptions',
>> + 'dsound': 'AudiodevDsoundOptions',
>> + 'oss': 'AudiodevOssOptions',
>> + 'pa': 'AudiodevPaOptions',
>> + 'wav': 'AudiodevWavOptions' } }
>
> 'none', 'coreaudio', 'sdl' and 'spice' have no driver-specific options.
>
> Do all the generic options apply to all drivers? Even 'none'?
'fixed-settings', 'frequency', 'channels', 'voices' and 'format' are
used by the mixeng thus they apply to all backends, even 'none'.
(Whether it makes any sense to set them is a different story.)
'buffer-len' and 'buffer-count' was introduced as a means to give a more
uniform interface to setting buffer sizes, because currently to set
buffer size:
* in case of alsa: you set microseconds or frames depending on a second
environment variable
* in case of coreaudio: you set it in frames
* in case of dsound, oss: you set it in milliseconds
* in case of pa, sdl: you set it in samples
* in case of spice, wav: you can't set it
I added 'buffer-len' and 'buffer-count' because they seemed like a
generic option that *most* backends would support, and I didn't want to
create extra backend specific options for them. But if I combine it
with your inheritance-like proposal, it's probably not that bad.
> Do @in and @out apply to drivers 'dsound' and 'wav'?
@out applies to every driver. @in shouldn't apply to drivers without
input support, but currently the base of mixeng is created for the input
too, it'll just fail if the sound card tries to create a capture stream...
>
> Per-direction options are split between generic ones in @in and @out,
> and driver-specific ones in @alsa-in and @alsa-out / @oss-in and
> @oss-out / @sink and @source.
>
> Perhaps the following would be tidier: make the generic per-direction
> options AudiodevPerDirectionOptions the base of driver-specific ones
> AudiodevAlsaPerDirectionOptions, AudiodevOssPerDirectionOptions,
> AudiodevPaPerDirectionOptions, and then
>
> { 'struct': 'AudiodevGenericOptions',
> 'data': {
> '*in': 'AudiodevPerDirectionOptions',
> '*out': 'AudiodevPerDirectionOptions' } }
>
> { 'union': 'Audiodev',
> 'base': {
> 'id': 'str',
> 'driver': 'AudiodevDriver',
> '*timer-period': 'uint32' },
> 'discriminator': 'driver',
> 'data': {
> 'none': 'AudiodevGenericOptions',
> 'alsa': 'AudiodevAlsaOptions',
> 'coreaudio: 'AudiodevGenericOptions',
> 'dsound': 'AudiodevDsoundOptions',
> 'oss': 'AudiodevOssOptions',
> 'pa': 'AudiodevPaOptions',
> 'sdl: 'AudiodevGenericOptions',
> 'spice': 'AudiodevGenericOptions',
> 'wav': 'AudiodevWavOptions' } }
Neat, I'll play around with this a bit.
>> diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json
>> index 3bbdfcee84..d5f9856be7 100644
>> --- a/qapi/qapi-schema.json
>> +++ b/qapi/qapi-schema.json
>> @@ -95,3 +95,4 @@
>> { 'include': 'trace.json' }
>> { 'include': 'introspect.json' }
>> { 'include': 'misc.json' }
>> +{ 'include': 'audio.json' }
>
> Looks pretty good.
>
Regards,
Zoltan
next prev parent reply other threads:[~2019-02-07 20:26 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-28 22:43 [Qemu-devel] [PATCH v4 00/14] Audio patches (was: Audio 5.1 patches) Kővágó, Zoltán
2019-01-28 22:43 ` [Qemu-devel] [PATCH v4 01/14] qapi: qapi for audio backends Kővágó, Zoltán
2019-01-29 13:33 ` Markus Armbruster
2019-02-07 20:26 ` Zoltán Kővágó [this message]
2019-01-29 15:52 ` Markus Armbruster
2019-01-28 22:43 ` [Qemu-devel] [PATCH v4 02/14] audio: use qapi AudioFormat instead of audfmt_e Kővágó, Zoltán
2019-01-29 6:22 ` Thomas Huth
2019-01-28 22:43 ` [Qemu-devel] [PATCH v4 03/14] audio: -audiodev command line option: documentation Kővágó, Zoltán
2019-01-29 6:13 ` Thomas Huth
2019-01-28 22:43 ` [Qemu-devel] [PATCH v4 04/14] audio: -audiodev command line option basic implementation Kővágó, Zoltán
2019-01-29 15:56 ` Markus Armbruster
2019-02-07 20:29 ` Zoltán Kővágó
2019-01-28 22:43 ` [Qemu-devel] [PATCH v4 05/14] alsaaudio: port to -audiodev config Kővágó, Zoltán
2019-01-28 22:43 ` [Qemu-devel] [PATCH v4 06/14] coreaudio: " Kővágó, Zoltán
2019-01-28 22:43 ` [Qemu-devel] [PATCH v4 07/14] dsoundaudio: " Kővágó, Zoltán
2019-01-28 22:43 ` [Qemu-devel] [PATCH v4 08/14] noaudio: " Kővágó, Zoltán
2019-01-28 22:43 ` [Qemu-devel] [PATCH v4 09/14] ossaudio: " Kővágó, Zoltán
2019-01-28 22:43 ` [Qemu-devel] [PATCH v4 10/14] paaudio: " Kővágó, Zoltán
2019-01-28 22:43 ` [Qemu-devel] [PATCH v4 11/14] sdlaudio: " Kővágó, Zoltán
2019-01-28 22:43 ` [Qemu-devel] [PATCH v4 12/14] spiceaudio: " Kővágó, Zoltán
2019-01-28 22:43 ` [Qemu-devel] [PATCH v4 13/14] wavaudio: " Kővágó, Zoltán
2019-01-28 22:43 ` [Qemu-devel] [PATCH v4 14/14] audio: -audiodev command line option: cleanup Kővágó, Zoltán
2019-01-31 17:56 ` [Qemu-devel] [PATCH v4 00/14] Audio patches (was: Audio 5.1 patches) no-reply
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=2dd27326-e491-9460-5fae-5706449d004e@gmail.com \
--to=dirty.ice.hu@gmail.com \
--cc=armbru@redhat.com \
--cc=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).