All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kővágó, Zoltán" <dirty.ice.hu@gmail.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>, Eric Blake <eblake@redhat.com>,
	Markus Armbruster <armbru@redhat.com>
Subject: [Qemu-devel] [PATCH v2 03/52] qapi: qapi for audio backends
Date: Sun, 23 Dec 2018 21:51:39 +0100	[thread overview]
Message-ID: <b35ceed43600ab8572d8d7881adc14f3937ef91f.1545598229.git.DirtY.iCE.hu@gmail.com> (raw)
In-Reply-To: <cover.1545598229.git.DirtY.iCE.hu@gmail.com>

This patch adds structures into qapi to replace the existing
configuration structures used by audio backends currently. This qapi
will be the base of the -audiodev command line parameter (that replaces
the old environment variables based config).

This is not a 1:1 translation of the old options, I've tried to make
them much more consistent (e.g. almost every backend had an option to
specify buffer size, but the name was different for every backend, and
some backends required usecs, while some other required frames, samples
or bytes). Also tried to reduce the number of abbreviations used by the
config keys.

Some of the more important changes:
* use `in` and `out` instead of `ADC` and `DAC`, as the former is more
  user friendly imho
* moved buffer settings into the global setting area (so it's the same
  for all backends that support it. Backends that can't change buffer
  size will simply ignore them). Also using usecs, as it's probably more
  user friendly than samples or bytes.
* try-poll is now an alsa backend specific option (as all other backends
  currently ignore it)

Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
---
 Makefile.objs         |   6 +-
 qapi/audio.json       | 253 ++++++++++++++++++++++++++++++++++++++++++
 qapi/qapi-schema.json |   1 +
 3 files changed, 257 insertions(+), 3 deletions(-)
 create mode 100644 qapi/audio.json

diff --git a/Makefile.objs b/Makefile.objs
index bc5b8a8442..3f833a70c0 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -1,6 +1,6 @@
-QAPI_MODULES = block-core block char common crypto introspect job migration
-QAPI_MODULES += misc net rdma rocker run-state sockets tpm trace transaction
-QAPI_MODULES += ui
+QAPI_MODULES = audio block-core block char common crypto introspect job
+QAPI_MODULES += migration misc net rdma rocker run-state sockets tpm trace
+QAPI_MODULES += transaction ui
 
 #######################################################################
 # Common libraries for tools and emulators
diff --git a/qapi/audio.json b/qapi/audio.json
new file mode 100644
index 0000000000..56d8ce439f
--- /dev/null
+++ b/qapi/audio.json
@@ -0,0 +1,253 @@
+# -*- mode: python -*-
+#
+# Copyright (C) 2015 Zoltán Kővágó <DirtY.iCE.hu@gmail.com>
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or later.
+# See the COPYING file in the top-level directory.
+
+##
+# @AudiodevNoOptions:
+#
+# The none, coreaudio, sdl and spice audio backend have no options.
+#
+# Since: 3.2
+##
+{ 'struct': 'AudiodevNoOptions',
+  'data': { } }
+
+##
+# @AudiodevAlsaPerDirectionOptions:
+#
+# Options of the alsa backend that are used for both playback and recording.
+#
+# @dev: #optional the name of the alsa device to use (default 'default')
+#
+# @try-poll: #optional attempt to use poll mode, falling back to non polling
+#            access on failure (default on)
+#
+# Since: 3.2
+##
+{ 'struct': 'AudiodevAlsaPerDirectionOptions',
+  'data': {
+    '*dev':      'str',
+    '*try-poll': 'bool' } }
+
+##
+# @AudiodevAlsaOptions:
+#
+# Options of the alsa audio backend.
+#
+# @alsa-in: options of the capture stream
+#
+# @alsa-out: options of the playback stream
+#
+# @threshold: #optional set the threshold (in microseconds) when playback starts
+#
+# Since: 3.2
+##
+{ 'struct': 'AudiodevAlsaOptions',
+  'data': {
+    'alsa-in':    'AudiodevAlsaPerDirectionOptions',
+    'alsa-out':   'AudiodevAlsaPerDirectionOptions',
+    '*threshold': 'int' } }
+
+##
+# @AudiodevDsoundOptions:
+#
+# Options of the dsound audio backend.
+#
+# @latency: #optional add extra latency to playback in microseconds (default
+#           10000)
+#
+# Since: 3.2
+##
+{ 'struct': 'AudiodevDsoundOptions',
+  'data': {
+    '*latency': 'int' } }
+
+##
+# @AudiodevOssPerDirectionOptions:
+#
+# Options of the oss backend that are used for both playback and recording.
+#
+# @dev: #optional file name of the oss device (default '/dev/dsp')
+#
+# @try-poll: #optional attempt to use poll mode, falling back to non polling
+#            access on failure (default on)
+#
+# Since: 3.2
+##
+{ 'struct': 'AudiodevOssPerDirectionOptions',
+  'data': {
+    '*dev':      'str',
+    '*try-poll': 'bool' } }
+
+##
+# @AudiodevOssOptions:
+#
+# Options of the oss audio backend.
+#
+# @oss-in: options of the capture stream
+#
+# @oss-out: options of the playback stream
+#
+# @try-mmap: #optional try using memory mapped access, falling back to non
+#            memory mapped access on failure (default off)
+#
+# @exclusive: #optional open device in exclusive mode (vmix won't work)
+#             (default off)
+#
+# @dsp-policy: #optional set the timing policy of the device (between 0 and 10,
+#              where smaller number means smaller latency but higher CPU usage)
+#              or -1 to use fragment mode (option ignored on some platforms)
+#              (default 5)
+#
+# Since: 3.2
+##
+{ 'struct': 'AudiodevOssOptions',
+  'data': {
+    'oss-in':      'AudiodevOssPerDirectionOptions',
+    'oss-out':     'AudiodevOssPerDirectionOptions',
+    '*try-mmap':   'bool',
+    '*exclusive':  'bool',
+    '*dsp-policy': 'int' } }
+
+##
+# @AudiodevPaPerDirectionOptions:
+#
+# Options of the pa backend that are used for both playback and recording.
+#
+# @name: #optional name of the sink/source to use
+#
+# Since: 3.2
+##
+{ 'struct': 'AudiodevPaPerDirectionOptions',
+  'data': {
+    '*name': 'str' } }
+
+##
+# @AudiodevPaOptions:
+#
+# Options of the pa (PulseAudio) audio backend.
+#
+# @server: #optional PulseAudio server address (default: let PulseAudio choose)
+#
+# @sink: sink specific options
+#
+# @source: source specific options
+#
+# Since: 3.2
+##
+{ 'struct': 'AudiodevPaOptions',
+  'data': {
+    '*server': 'str',
+    'sink':    'AudiodevPaPerDirectionOptions',
+    'source':  'AudiodevPaPerDirectionOptions' } }
+
+##
+# @AudiodevWavOptions:
+#
+# Options of the wav audio backend.
+#
+# @path: #optional name of the wav file to record (default 'qemu.wav')
+#
+# Since: 3.2
+##
+{ 'struct': 'AudiodevWavOptions',
+  'data': {
+    '*path': 'str' } }
+
+
+##
+# @AudioFormat:
+#
+# An enumeration of possible audio formats.
+#
+# Since: 3.2
+##
+{ 'enum': 'AudioFormat',
+  'data': [ 'u8', 's8', 'u16', 's16', 'u32', 's32' ] }
+
+##
+# @AudiodevDriver:
+#
+# An enumeration of possible audio backend drivers.
+#
+# Since: 3.2
+##
+{ 'enum': 'AudiodevDriver',
+  'data': [ 'none', 'alsa', 'coreaudio', 'dsound', 'oss', 'pa', 'sdl', 'spice',
+            'wav' ] }
+
+##
+# @AudiodevPerDirectionOptions:
+#
+# General audio backend options that are used for both playback and recording.
+#
+# @fixed-settings: #optional use fixed settings for host input/output.  When
+#                  off, frequency, channels and format must not be specified
+#                  (default on)
+#
+# @frequency: #optional frequency to use when using fixed settings
+#             (default 44100)
+#
+# @channels: #optional number of channels when using fixed settings
+#            (default 2)
+#
+# @voices: #optional number of voices to use (default 1)
+#
+# @format: #optional sample format to use when using fixed settings
+#          (default s16)
+#
+# @buffer-len: #optional the buffer size in microseconds
+#
+# @buffer-count: #optional number of buffers
+#
+# Since: 3.2
+##
+{ 'struct': 'AudiodevPerDirectionOptions',
+  'data': {
+    '*fixed-settings': 'bool',
+    '*frequency':      'int',
+    '*channels':       'int',
+    '*voices':         'int',
+    '*format':         'AudioFormat',
+    '*buffer-len':     'int',
+    '*buffer-count':   'int' } }
+
+##
+# @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: #optional timer period (in microseconds, 0: use lowest
+#                possible)
+#
+# Since: 3.2
+##
+{ 'union': 'Audiodev',
+  'base': {
+    'id':            'str',
+    'driver':        'AudiodevDriver',
+    'in':            'AudiodevPerDirectionOptions',
+    'out':           'AudiodevPerDirectionOptions',
+    '*timer-period': 'int' },
+  'discriminator': 'driver',
+  'data': {
+    'none':      'AudiodevNoOptions',
+    'alsa':      'AudiodevAlsaOptions',
+    'coreaudio': 'AudiodevNoOptions',
+    'dsound':    'AudiodevDsoundOptions',
+    'oss':       'AudiodevOssOptions',
+    'pa':        'AudiodevPaOptions',
+    'sdl':       'AudiodevNoOptions',
+    'spice':     'AudiodevNoOptions',
+    'wav':       'AudiodevWavOptions' } }
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' }
-- 
2.20.1

  parent reply	other threads:[~2018-12-23 20:52 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-23 20:51 [Qemu-devel] [PATCH v2 00/52] Audio 5.1 patches Kővágó, Zoltán
2018-12-23 20:51 ` [Qemu-devel] [PATCH v2 01/52] qapi: support alternates in OptsVisitor Kővágó, Zoltán
2018-12-23 20:51 ` [Qemu-devel] [PATCH v2 02/52] qapi: support nested structs " Kővágó, Zoltán
2018-12-23 20:51 ` Kővágó, Zoltán [this message]
2019-01-10  2:49   ` [Qemu-devel] [PATCH v2 03/52] qapi: qapi for audio backends Eric Blake
2018-12-23 20:51 ` [Qemu-devel] [PATCH v2 04/52] audio: use qapi AudioFormat instead of audfmt_e Kővágó, Zoltán
2018-12-23 20:51 ` [Qemu-devel] [PATCH v2 05/52] audio: -audiodev command line option: documentation Kővágó, Zoltán
2018-12-23 20:51 ` [Qemu-devel] [PATCH v2 06/52] audio: -audiodev command line option basic implementation Kővágó, Zoltán
2019-01-07 13:13   ` Markus Armbruster
2019-01-07 20:48     ` Zoltán Kővágó
2019-01-08  3:42       ` Markus Armbruster
2019-01-10  0:13         ` Zoltán Kővágó
2019-01-10  7:25           ` Gerd Hoffmann
2019-01-10  9:40             ` Zoltán Kővágó
2019-01-10 10:37               ` Gerd Hoffmann
2019-01-08  6:06       ` Gerd Hoffmann
2018-12-23 20:51 ` [Qemu-devel] [PATCH v2 07/52] alsaaudio: port to -audiodev config Kővágó, Zoltán
2018-12-23 20:51 ` [Qemu-devel] [PATCH v2 08/52] coreaudio: " Kővágó, Zoltán
2018-12-23 20:51 ` [Qemu-devel] [PATCH v2 09/52] dsoundaudio: " Kővágó, Zoltán
2018-12-23 20:51 ` [Qemu-devel] [PATCH v2 10/52] noaudio: " Kővágó, Zoltán
2018-12-23 20:51 ` [Qemu-devel] [PATCH v2 11/52] ossaudio: " Kővágó, Zoltán
2018-12-23 20:51 ` [Qemu-devel] [PATCH v2 12/52] paaudio: " Kővágó, Zoltán
2018-12-23 20:51 ` [Qemu-devel] [PATCH v2 13/52] sdlaudio: " Kővágó, Zoltán
2018-12-23 20:51 ` [Qemu-devel] [PATCH v2 14/52] spiceaudio: " Kővágó, Zoltán
2018-12-23 20:51 ` [Qemu-devel] [PATCH v2 15/52] wavaudio: " Kővágó, Zoltán
2018-12-23 20:51 ` [Qemu-devel] [PATCH v2 16/52] audio: -audiodev command line option: cleanup Kővágó, Zoltán
2018-12-23 20:51 ` [Qemu-devel] [PATCH v2 17/52] audio: reduce glob_audio_state usage Kővágó, Zoltán
2018-12-23 20:51 ` [Qemu-devel] [PATCH v2 18/52] audio: basic support for multi backend audio Kővágó, Zoltán
2018-12-23 20:51 ` [Qemu-devel] [PATCH v2 19/52] audio: add audiodev properties to frontends Kővágó, Zoltán
2018-12-23 20:51 ` [Qemu-devel] [PATCH v2 20/52] audio: audiodev= parameters no longer optional when -audiodev present Kővágó, Zoltán
2018-12-23 20:51 ` [Qemu-devel] [PATCH v2 21/52] paaudio: do not move stream when sink/source name is specified Kővágó, Zoltán
2018-12-23 20:51 ` [Qemu-devel] [PATCH v2 22/52] paaudio: properly disconnect streams in fini_* Kővágó, Zoltán
2018-12-23 20:51 ` [Qemu-devel] [PATCH v2 23/52] audio: remove audio_MIN, audio_MAX Kővágó, Zoltán
2018-12-23 23:49   ` Philippe Mathieu-Daudé
2018-12-24  2:16     ` Zoltán Kővágó
2018-12-24 17:16       ` Philippe Mathieu-Daudé
2018-12-24 20:48         ` Kővágó Zoltán
2018-12-25 10:40           ` Philippe Mathieu-Daudé
2018-12-27 12:49             ` Kővágó Zoltán
2019-01-07  9:54               ` Gerd Hoffmann
2019-01-07 14:26                 ` Eric Blake
2018-12-23 20:52 ` [Qemu-devel] [PATCH v2 24/52] audio: do not run each backend in audio_run Kővágó, Zoltán
2018-12-23 20:52 ` [Qemu-devel] [PATCH v2 25/52] paaudio: fix playback glitches Kővágó, Zoltán
2018-12-23 20:52 ` [Qemu-devel] [PATCH v2 26/52] audio: remove read and write pcm_ops Kővágó, Zoltán
2018-12-23 20:52 ` [Qemu-devel] [PATCH v2 27/52] audio: use size_t where makes sense Kővágó, Zoltán
2018-12-24  6:19   ` Pavel Dovgalyuk
2018-12-25 11:08   ` Philippe Mathieu-Daudé
2019-01-07  9:58     ` Gerd Hoffmann
2018-12-23 20:52 ` [Qemu-devel] [PATCH v2 28/52] audio: api for mixeng code free backends Kővágó, Zoltán
2018-12-23 20:52 ` [Qemu-devel] [PATCH v2 29/52] alsaaudio: port to the new audio backend api Kővágó, Zoltán
2018-12-23 20:52 ` [Qemu-devel] [PATCH v2 30/52] coreaudio: " Kővágó, Zoltán
2018-12-23 20:52 ` [Qemu-devel] [PATCH v2 31/52] dsoundaudio: " Kővágó, Zoltán
2018-12-23 20:52 ` [Qemu-devel] [PATCH v2 32/52] noaudio: " Kővágó, Zoltán
2018-12-23 20:52 ` [Qemu-devel] [PATCH v2 33/52] ossaudio: " Kővágó, Zoltán
2018-12-23 20:52 ` [Qemu-devel] [PATCH v2 34/52] paaudio: " Kővágó, Zoltán
2018-12-23 20:52 ` [Qemu-devel] [PATCH v2 35/52] sdlaudio: " Kővágó, Zoltán
2018-12-23 20:52 ` [Qemu-devel] [PATCH v2 36/52] spiceaudio: " Kővágó, Zoltán
2018-12-23 20:52 ` [Qemu-devel] [PATCH v2 37/52] wavaudio: " Kővágó, Zoltán
2018-12-23 20:52 ` [Qemu-devel] [PATCH v2 38/52] audio: remove remains of the old " Kővágó, Zoltán
2018-12-23 20:52 ` [Qemu-devel] [PATCH v2 39/52] audio: unify input and output mixeng buffer management Kővágó, Zoltán
2018-12-23 20:52 ` [Qemu-devel] [PATCH v2 40/52] audio: remove hw->samples, buffer_size_in/out pcm_ops Kővágó, Zoltán
2018-12-23 20:52 ` [Qemu-devel] [PATCH v2 41/52] audio: common rate control code for timer based outputs Kővágó, Zoltán
2018-12-23 20:52 ` [Qemu-devel] [PATCH v2 42/52] audio: split ctl_* functions into enable_* and volume_* Kővágó, Zoltán
2018-12-23 20:52 ` [Qemu-devel] [PATCH v2 43/52] audio: add mixeng option (documentation) Kővágó, Zoltán
2019-01-10  1:43   ` Eric Blake
2019-01-10  9:12     ` Markus Armbruster
2019-01-16 20:27     ` Zoltán Kővágó
2019-01-16 22:40       ` Eric Blake
2018-12-23 20:52 ` [Qemu-devel] [PATCH v2 44/52] audio: make mixeng optional Kővágó, Zoltán
2018-12-23 20:52 ` [Qemu-devel] [PATCH v2 46/52] audio: support more than two channels in volume setting Kővágó, Zoltán
2018-12-23 20:52 ` [Qemu-devel] [PATCH v2 47/52] audio: replace shift in audio_pcm_info with bytes_per_frame Kővágó, Zoltán
2018-12-23 20:52 ` [Qemu-devel] [PATCH v2 48/52] audio: basic support for multichannel audio Kővágó, Zoltán
2018-12-23 20:52 ` [Qemu-devel] [PATCH v2 49/52] paaudio: channel-map option Kővágó, Zoltán
2018-12-23 20:52 ` [Qemu-devel] [PATCH v2 50/52] usb-audio: do not count on avail bytes actually available Kővágó, Zoltán
2018-12-23 20:52 ` [Qemu-devel] [PATCH v2 52/52] usbaudio: change playback counters to 64 bit Kővágó, Zoltán
2018-12-25 10:50   ` Philippe Mathieu-Daudé
2018-12-27 22:08     ` Kővágó Zoltán
2018-12-25 10:43 ` [Qemu-devel] [PATCH v2 00/52] Audio 5.1 patches Philippe Mathieu-Daudé

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=b35ceed43600ab8572d8d7881adc14f3937ef91f.1545598229.git.DirtY.iCE.hu@gmail.com \
    --to=dirty.ice.hu@gmail.com \
    --cc=armbru@redhat.com \
    --cc=eblake@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.