xref: /qemu/qapi/audio.json (revision b2a3cbb8)
1# -*- mode: python -*-
2# vim: filetype=python
3#
4# Copyright (C) 2015-2019 Zoltán Kővágó <DirtY.iCE.hu@gmail.com>
5#
6# This work is licensed under the terms of the GNU GPL, version 2 or later.
7# See the COPYING file in the top-level directory.
8
9##
10# = Audio
11##
12
13##
14# @AudiodevPerDirectionOptions:
15#
16# General audio backend options that are used for both playback and
17# recording.
18#
19# @mixing-engine: use QEMU's mixing engine to mix all streams inside QEMU and
20#                 convert audio formats when not supported by the backend. When
21#                 set to off, fixed-settings must be also off (default on,
22#                 since 4.2)
23#
24# @fixed-settings: use fixed settings for host input/output. When off,
25#                  frequency, channels and format must not be
26#                  specified (default true)
27#
28# @frequency: frequency to use when using fixed settings
29#             (default 44100)
30#
31# @channels: number of channels when using fixed settings (default 2)
32#
33# @voices: number of voices to use (default 1)
34#
35# @format: sample format to use when using fixed settings
36#          (default s16)
37#
38# @buffer-length: the buffer length in microseconds
39#
40# Since: 4.0
41##
42{ 'struct': 'AudiodevPerDirectionOptions',
43  'data': {
44    '*mixing-engine':  'bool',
45    '*fixed-settings': 'bool',
46    '*frequency':      'uint32',
47    '*channels':       'uint32',
48    '*voices':         'uint32',
49    '*format':         'AudioFormat',
50    '*buffer-length':  'uint32' } }
51
52##
53# @AudiodevGenericOptions:
54#
55# Generic driver-specific options.
56#
57# @in: options of the capture stream
58#
59# @out: options of the playback stream
60#
61# Since: 4.0
62##
63{ 'struct': 'AudiodevGenericOptions',
64  'data': {
65    '*in':  'AudiodevPerDirectionOptions',
66    '*out': 'AudiodevPerDirectionOptions' } }
67
68##
69# @AudiodevAlsaPerDirectionOptions:
70#
71# Options of the ALSA backend that are used for both playback and
72# recording.
73#
74# @dev: the name of the ALSA device to use (default 'default')
75#
76# @period-length: the period length in microseconds
77#
78# @try-poll: attempt to use poll mode, falling back to non-polling
79#            access on failure (default true)
80#
81# Since: 4.0
82##
83{ 'struct': 'AudiodevAlsaPerDirectionOptions',
84  'base': 'AudiodevPerDirectionOptions',
85  'data': {
86    '*dev':           'str',
87    '*period-length': 'uint32',
88    '*try-poll':      'bool' } }
89
90##
91# @AudiodevAlsaOptions:
92#
93# Options of the ALSA audio backend.
94#
95# @in: options of the capture stream
96#
97# @out: options of the playback stream
98#
99# @threshold: set the threshold (in microseconds) when playback starts
100#
101# Since: 4.0
102##
103{ 'struct': 'AudiodevAlsaOptions',
104  'data': {
105    '*in':        'AudiodevAlsaPerDirectionOptions',
106    '*out':       'AudiodevAlsaPerDirectionOptions',
107    '*threshold': 'uint32' } }
108
109##
110# @AudiodevSndioOptions:
111#
112# Options of the sndio audio backend.
113#
114# @in: options of the capture stream
115#
116# @out: options of the playback stream
117#
118# @dev: the name of the sndio device to use (default 'default')
119#
120# @latency: play buffer size (in microseconds)
121#
122# Since: 7.2
123##
124{ 'struct': 'AudiodevSndioOptions',
125  'data': {
126    '*in':        'AudiodevPerDirectionOptions',
127    '*out':       'AudiodevPerDirectionOptions',
128    '*dev':       'str',
129    '*latency':   'uint32'} }
130
131##
132# @AudiodevCoreaudioPerDirectionOptions:
133#
134# Options of the Core Audio backend that are used for both playback and
135# recording.
136#
137# @buffer-count: number of buffers
138#
139# Since: 4.0
140##
141{ 'struct': 'AudiodevCoreaudioPerDirectionOptions',
142  'base': 'AudiodevPerDirectionOptions',
143  'data': {
144    '*buffer-count': 'uint32' } }
145
146##
147# @AudiodevCoreaudioOptions:
148#
149# Options of the coreaudio audio backend.
150#
151# @in: options of the capture stream
152#
153# @out: options of the playback stream
154#
155# Since: 4.0
156##
157{ 'struct': 'AudiodevCoreaudioOptions',
158  'data': {
159    '*in':  'AudiodevCoreaudioPerDirectionOptions',
160    '*out': 'AudiodevCoreaudioPerDirectionOptions' } }
161
162##
163# @AudiodevDsoundOptions:
164#
165# Options of the DirectSound audio backend.
166#
167# @in: options of the capture stream
168#
169# @out: options of the playback stream
170#
171# @latency: add extra latency to playback in microseconds
172#           (default 10000)
173#
174# Since: 4.0
175##
176{ 'struct': 'AudiodevDsoundOptions',
177  'data': {
178    '*in':      'AudiodevPerDirectionOptions',
179    '*out':     'AudiodevPerDirectionOptions',
180    '*latency': 'uint32' } }
181
182##
183# @AudiodevJackPerDirectionOptions:
184#
185# Options of the JACK backend that are used for both playback and
186# recording.
187#
188# @server-name: select from among several possible concurrent server instances
189#               (default: environment variable $JACK_DEFAULT_SERVER if set, else "default")
190#
191# @client-name: the client name to use. The server will modify this name to
192#               create a unique variant, if needed unless @exact-name is true (default: the
193#               guest's name)
194#
195# @connect-ports: if set, a regular expression of JACK client port name(s) to
196#                 monitor for and automatically connect to
197#
198# @start-server: start a jack server process if one is not already present
199#                (default: false)
200#
201# @exact-name: use the exact name requested otherwise JACK automatically
202#              generates a unique one, if needed (default: false)
203#
204# Since: 5.1
205##
206{ 'struct': 'AudiodevJackPerDirectionOptions',
207  'base': 'AudiodevPerDirectionOptions',
208  'data': {
209    '*server-name':   'str',
210    '*client-name':   'str',
211    '*connect-ports': 'str',
212    '*start-server':  'bool',
213    '*exact-name':    'bool' } }
214
215##
216# @AudiodevJackOptions:
217#
218# Options of the JACK audio backend.
219#
220# @in: options of the capture stream
221#
222# @out: options of the playback stream
223#
224# Since: 5.1
225##
226{ 'struct': 'AudiodevJackOptions',
227  'data': {
228    '*in':  'AudiodevJackPerDirectionOptions',
229    '*out': 'AudiodevJackPerDirectionOptions' } }
230
231##
232# @AudiodevOssPerDirectionOptions:
233#
234# Options of the OSS backend that are used for both playback and
235# recording.
236#
237# @dev: file name of the OSS device (default '/dev/dsp')
238#
239# @buffer-count: number of buffers
240#
241# @try-poll: attempt to use poll mode, falling back to non-polling
242#            access on failure (default true)
243#
244# Since: 4.0
245##
246{ 'struct': 'AudiodevOssPerDirectionOptions',
247  'base': 'AudiodevPerDirectionOptions',
248  'data': {
249    '*dev':          'str',
250    '*buffer-count': 'uint32',
251    '*try-poll':     'bool' } }
252
253##
254# @AudiodevOssOptions:
255#
256# Options of the OSS audio backend.
257#
258# @in: options of the capture stream
259#
260# @out: options of the playback stream
261#
262# @try-mmap: try using memory-mapped access, falling back to
263#            non-memory-mapped access on failure (default true)
264#
265# @exclusive: open device in exclusive mode (vmix won't work)
266#             (default false)
267#
268# @dsp-policy: set the timing policy of the device (between 0 and 10,
269#              where smaller number means smaller latency but higher
270#              CPU usage) or -1 to use fragment mode (option ignored
271#              on some platforms) (default 5)
272#
273# Since: 4.0
274##
275{ 'struct': 'AudiodevOssOptions',
276  'data': {
277    '*in':         'AudiodevOssPerDirectionOptions',
278    '*out':        'AudiodevOssPerDirectionOptions',
279    '*try-mmap':   'bool',
280    '*exclusive':  'bool',
281    '*dsp-policy': 'uint32' } }
282
283##
284# @AudiodevPaPerDirectionOptions:
285#
286# Options of the Pulseaudio backend that are used for both playback and
287# recording.
288#
289# @name: name of the sink/source to use
290#
291# @stream-name: name of the PulseAudio stream created by qemu.  Can be
292#               used to identify the stream in PulseAudio when you
293#               create multiple PulseAudio devices or run multiple qemu
294#               instances (default: audiodev's id, since 4.2)
295#
296# @latency: latency you want PulseAudio to achieve in microseconds
297#           (default 15000)
298#
299# Since: 4.0
300##
301{ 'struct': 'AudiodevPaPerDirectionOptions',
302  'base': 'AudiodevPerDirectionOptions',
303  'data': {
304    '*name': 'str',
305    '*stream-name': 'str',
306    '*latency': 'uint32' } }
307
308##
309# @AudiodevPaOptions:
310#
311# Options of the PulseAudio audio backend.
312#
313# @in: options of the capture stream
314#
315# @out: options of the playback stream
316#
317# @server: PulseAudio server address (default: let PulseAudio choose)
318#
319# Since: 4.0
320##
321{ 'struct': 'AudiodevPaOptions',
322  'data': {
323    '*in':     'AudiodevPaPerDirectionOptions',
324    '*out':    'AudiodevPaPerDirectionOptions',
325    '*server': 'str' } }
326
327##
328# @AudiodevSdlPerDirectionOptions:
329#
330# Options of the SDL audio backend that are used for both playback and
331# recording.
332#
333# @buffer-count: number of buffers (default 4)
334#
335# Since: 6.0
336##
337{ 'struct': 'AudiodevSdlPerDirectionOptions',
338  'base': 'AudiodevPerDirectionOptions',
339  'data': {
340    '*buffer-count': 'uint32' } }
341
342##
343# @AudiodevSdlOptions:
344#
345# Options of the SDL audio backend.
346#
347# @in: options of the recording stream
348#
349# @out: options of the playback stream
350#
351# Since: 6.0
352##
353{ 'struct': 'AudiodevSdlOptions',
354  'data': {
355    '*in':  'AudiodevSdlPerDirectionOptions',
356    '*out': 'AudiodevSdlPerDirectionOptions' } }
357
358##
359# @AudiodevWavOptions:
360#
361# Options of the wav audio backend.
362#
363# @in: options of the capture stream
364#
365# @out: options of the playback stream
366#
367# @path: name of the wav file to record (default 'qemu.wav')
368#
369# Since: 4.0
370##
371{ 'struct': 'AudiodevWavOptions',
372  'data': {
373    '*in':   'AudiodevPerDirectionOptions',
374    '*out':  'AudiodevPerDirectionOptions',
375    '*path': 'str' } }
376
377##
378# @AudioFormat:
379#
380# An enumeration of possible audio formats.
381#
382# @u8: unsigned 8 bit integer
383#
384# @s8: signed 8 bit integer
385#
386# @u16: unsigned 16 bit integer
387#
388# @s16: signed 16 bit integer
389#
390# @u32: unsigned 32 bit integer
391#
392# @s32: signed 32 bit integer
393#
394# @f32: single precision floating-point (since 5.0)
395#
396# Since: 4.0
397##
398{ 'enum': 'AudioFormat',
399  'data': [ 'u8', 's8', 'u16', 's16', 'u32', 's32', 'f32' ] }
400
401##
402# @AudiodevDriver:
403#
404# An enumeration of possible audio backend drivers.
405#
406# @jack: JACK audio backend (since 5.1)
407#
408# Since: 4.0
409##
410{ 'enum': 'AudiodevDriver',
411  'data': [ 'none', 'alsa', 'coreaudio', 'dbus', 'dsound', 'jack', 'oss', 'pa',
412            'sdl', 'sndio', 'spice', 'wav' ] }
413
414##
415# @Audiodev:
416#
417# Options of an audio backend.
418#
419# @id: identifier of the backend
420#
421# @driver: the backend driver to use
422#
423# @timer-period: timer period (in microseconds, 0: use lowest possible)
424#
425# Since: 4.0
426##
427{ 'union': 'Audiodev',
428  'base': {
429    'id':            'str',
430    'driver':        'AudiodevDriver',
431    '*timer-period': 'uint32' },
432  'discriminator': 'driver',
433  'data': {
434    'none':      'AudiodevGenericOptions',
435    'alsa':      'AudiodevAlsaOptions',
436    'coreaudio': 'AudiodevCoreaudioOptions',
437    'dbus':      'AudiodevGenericOptions',
438    'dsound':    'AudiodevDsoundOptions',
439    'jack':      'AudiodevJackOptions',
440    'oss':       'AudiodevOssOptions',
441    'pa':        'AudiodevPaOptions',
442    'sdl':       'AudiodevSdlOptions',
443    'sndio':     'AudiodevSndioOptions',
444    'spice':     'AudiodevGenericOptions',
445    'wav':       'AudiodevWavOptions' } }
446