Merge tag 'v9.0.0-rc3'
[qemu/ar7.git] / qapi / audio.json
blob519697c0cd845aac7cb9f198b968122c99d676c3
1 # -*- mode: python -*-
2 # vim: filetype=python
4 # Copyright (C) 2015-2019 Zoltán Kővágó <DirtY.iCE.hu@gmail.com>
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.
9 ##
10 # = Audio
14 # @AudiodevPerDirectionOptions:
16 # General audio backend options that are used for both playback and
17 # recording.
19 # @mixing-engine: use QEMU's mixing engine to mix all streams inside
20 #     QEMU and convert audio formats when not supported by the
21 #     backend.  When set to off, fixed-settings must be also off
22 #     (default on, since 4.2)
24 # @fixed-settings: use fixed settings for host input/output.  When
25 #     off, frequency, channels and format must not be specified
26 #     (default true)
28 # @frequency: frequency to use when using fixed settings (default
29 #     44100)
31 # @channels: number of channels when using fixed settings (default 2)
33 # @voices: number of voices to use (default 1)
35 # @format: sample format to use when using fixed settings (default
36 #     s16)
38 # @buffer-length: the buffer length in microseconds
40 # Since: 4.0
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' } }
53 # @AudiodevGenericOptions:
55 # Generic driver-specific options.
57 # @in: options of the capture stream
59 # @out: options of the playback stream
61 # Since: 4.0
63 { 'struct': 'AudiodevGenericOptions',
64   'data': {
65     '*in':  'AudiodevPerDirectionOptions',
66     '*out': 'AudiodevPerDirectionOptions' } }
69 # @AudiodevAlsaPerDirectionOptions:
71 # Options of the ALSA backend that are used for both playback and
72 # recording.
74 # @dev: the name of the ALSA device to use (default 'default')
76 # @period-length: the period length in microseconds
78 # @try-poll: attempt to use poll mode, falling back to non-polling
79 #     access on failure (default true)
81 # Since: 4.0
83 { 'struct': 'AudiodevAlsaPerDirectionOptions',
84   'base': 'AudiodevPerDirectionOptions',
85   'data': {
86     '*dev':           'str',
87     '*period-length': 'uint32',
88     '*try-poll':      'bool' } }
91 # @AudiodevAlsaOptions:
93 # Options of the ALSA audio backend.
95 # @in: options of the capture stream
97 # @out: options of the playback stream
99 # @threshold: set the threshold (in microseconds) when playback starts
101 # Since: 4.0
103 { 'struct': 'AudiodevAlsaOptions',
104   'data': {
105     '*in':        'AudiodevAlsaPerDirectionOptions',
106     '*out':       'AudiodevAlsaPerDirectionOptions',
107     '*threshold': 'uint32' } }
110 # @AudiodevSndioOptions:
112 # Options of the sndio audio backend.
114 # @in: options of the capture stream
116 # @out: options of the playback stream
118 # @dev: the name of the sndio device to use (default 'default')
120 # @latency: play buffer size (in microseconds)
122 # Since: 7.2
124 { 'struct': 'AudiodevSndioOptions',
125   'data': {
126     '*in':        'AudiodevPerDirectionOptions',
127     '*out':       'AudiodevPerDirectionOptions',
128     '*dev':       'str',
129     '*latency':   'uint32'} }
132 # @AudiodevCoreaudioPerDirectionOptions:
134 # Options of the Core Audio backend that are used for both playback
135 # and recording.
137 # @buffer-count: number of buffers
139 # Since: 4.0
141 { 'struct': 'AudiodevCoreaudioPerDirectionOptions',
142   'base': 'AudiodevPerDirectionOptions',
143   'data': {
144     '*buffer-count': 'uint32' } }
147 # @AudiodevCoreaudioOptions:
149 # Options of the coreaudio audio backend.
151 # @in: options of the capture stream
153 # @out: options of the playback stream
155 # Since: 4.0
157 { 'struct': 'AudiodevCoreaudioOptions',
158   'data': {
159     '*in':  'AudiodevCoreaudioPerDirectionOptions',
160     '*out': 'AudiodevCoreaudioPerDirectionOptions' } }
163 # @AudiodevDsoundOptions:
165 # Options of the DirectSound audio backend.
167 # @in: options of the capture stream
169 # @out: options of the playback stream
171 # @latency: add extra latency to playback in microseconds (default
172 #     10000)
174 # Since: 4.0
176 { 'struct': 'AudiodevDsoundOptions',
177   'data': {
178     '*in':      'AudiodevPerDirectionOptions',
179     '*out':     'AudiodevPerDirectionOptions',
180     '*latency': 'uint32' } }
183 # @AudiodevJackPerDirectionOptions:
185 # Options of the JACK backend that are used for both playback and
186 # recording.
188 # @server-name: select from among several possible concurrent server
189 #     instances (default: environment variable $JACK_DEFAULT_SERVER if
190 #     set, else "default")
192 # @client-name: the client name to use.  The server will modify this
193 #     name to create a unique variant, if needed unless @exact-name is
194 #     true (default: the guest's name)
196 # @connect-ports: if set, a regular expression of JACK client port
197 #     name(s) to monitor for and automatically connect to
199 # @start-server: start a jack server process if one is not already
200 #     present (default: false)
202 # @exact-name: use the exact name requested otherwise JACK
203 #     automatically generates a unique one, if needed (default: false)
205 # Since: 5.1
207 { 'struct': 'AudiodevJackPerDirectionOptions',
208   'base': 'AudiodevPerDirectionOptions',
209   'data': {
210     '*server-name':   'str',
211     '*client-name':   'str',
212     '*connect-ports': 'str',
213     '*start-server':  'bool',
214     '*exact-name':    'bool' } }
217 # @AudiodevJackOptions:
219 # Options of the JACK audio backend.
221 # @in: options of the capture stream
223 # @out: options of the playback stream
225 # Since: 5.1
227 { 'struct': 'AudiodevJackOptions',
228   'data': {
229     '*in':  'AudiodevJackPerDirectionOptions',
230     '*out': 'AudiodevJackPerDirectionOptions' } }
233 # @AudiodevOssPerDirectionOptions:
235 # Options of the OSS backend that are used for both playback and
236 # recording.
238 # @dev: file name of the OSS device (default '/dev/dsp')
240 # @buffer-count: number of buffers
242 # @try-poll: attempt to use poll mode, falling back to non-polling
243 #     access on failure (default true)
245 # Since: 4.0
247 { 'struct': 'AudiodevOssPerDirectionOptions',
248   'base': 'AudiodevPerDirectionOptions',
249   'data': {
250     '*dev':          'str',
251     '*buffer-count': 'uint32',
252     '*try-poll':     'bool' } }
255 # @AudiodevOssOptions:
257 # Options of the OSS audio backend.
259 # @in: options of the capture stream
261 # @out: options of the playback stream
263 # @try-mmap: try using memory-mapped access, falling back to
264 #     non-memory-mapped access on failure (default true)
266 # @exclusive: open device in exclusive mode (vmix won't work) (default
267 #     false)
269 # @dsp-policy: set the timing policy of the device (between 0 and 10,
270 #     where smaller number means smaller latency but higher CPU usage)
271 #     or -1 to use fragment mode (option ignored on some platforms)
272 #     (default 5)
274 # Since: 4.0
276 { 'struct': 'AudiodevOssOptions',
277   'data': {
278     '*in':         'AudiodevOssPerDirectionOptions',
279     '*out':        'AudiodevOssPerDirectionOptions',
280     '*try-mmap':   'bool',
281     '*exclusive':  'bool',
282     '*dsp-policy': 'uint32' } }
285 # @AudiodevPaPerDirectionOptions:
287 # Options of the Pulseaudio backend that are used for both playback
288 # and recording.
290 # @name: name of the sink/source to use
292 # @stream-name: name of the PulseAudio stream created by qemu.  Can be
293 #     used to identify the stream in PulseAudio when you create
294 #     multiple PulseAudio devices or run multiple qemu instances
295 #     (default: audiodev's id, since 4.2)
297 # @latency: latency you want PulseAudio to achieve in microseconds
298 #     (default 15000)
300 # Since: 4.0
302 { 'struct': 'AudiodevPaPerDirectionOptions',
303   'base': 'AudiodevPerDirectionOptions',
304   'data': {
305     '*name': 'str',
306     '*stream-name': 'str',
307     '*latency': 'uint32' } }
310 # @AudiodevPaOptions:
312 # Options of the PulseAudio audio backend.
314 # @in: options of the capture stream
316 # @out: options of the playback stream
318 # @server: PulseAudio server address (default: let PulseAudio choose)
320 # Since: 4.0
322 { 'struct': 'AudiodevPaOptions',
323   'data': {
324     '*in':     'AudiodevPaPerDirectionOptions',
325     '*out':    'AudiodevPaPerDirectionOptions',
326     '*server': 'str' } }
329 # @AudiodevPipewirePerDirectionOptions:
331 # Options of the PipeWire backend that are used for both playback and
332 # recording.
334 # @name: name of the sink/source to use
336 # @stream-name: name of the PipeWire stream created by qemu.  Can be
337 #     used to identify the stream in PipeWire when you create multiple
338 #     PipeWire devices or run multiple qemu instances (default:
339 #     audiodev's id)
341 # @latency: latency you want PipeWire to achieve in microseconds
342 #     (default 46000)
344 # Since: 8.1
346 { 'struct': 'AudiodevPipewirePerDirectionOptions',
347   'base': 'AudiodevPerDirectionOptions',
348   'data': {
349     '*name': 'str',
350     '*stream-name': 'str',
351     '*latency': 'uint32' } }
354 # @AudiodevPipewireOptions:
356 # Options of the PipeWire audio backend.
358 # @in: options of the capture stream
360 # @out: options of the playback stream
362 # Since: 8.1
364 { 'struct': 'AudiodevPipewireOptions',
365   'data': {
366     '*in':     'AudiodevPipewirePerDirectionOptions',
367     '*out':    'AudiodevPipewirePerDirectionOptions' } }
370 # @AudiodevSdlPerDirectionOptions:
372 # Options of the SDL audio backend that are used for both playback and
373 # recording.
375 # @buffer-count: number of buffers (default 4)
377 # Since: 6.0
379 { 'struct': 'AudiodevSdlPerDirectionOptions',
380   'base': 'AudiodevPerDirectionOptions',
381   'data': {
382     '*buffer-count': 'uint32' } }
385 # @AudiodevSdlOptions:
387 # Options of the SDL audio backend.
389 # @in: options of the recording stream
391 # @out: options of the playback stream
393 # Since: 6.0
395 { 'struct': 'AudiodevSdlOptions',
396   'data': {
397     '*in':  'AudiodevSdlPerDirectionOptions',
398     '*out': 'AudiodevSdlPerDirectionOptions' } }
401 # @AudiodevWavOptions:
403 # Options of the wav audio backend.
405 # @in: options of the capture stream
407 # @out: options of the playback stream
409 # @path: name of the wav file to record (default 'qemu.wav')
411 # Since: 4.0
413 { 'struct': 'AudiodevWavOptions',
414   'data': {
415     '*in':   'AudiodevPerDirectionOptions',
416     '*out':  'AudiodevPerDirectionOptions',
417     '*path': 'str' } }
420 # @AudioFormat:
422 # An enumeration of possible audio formats.
424 # @u8: unsigned 8 bit integer
426 # @s8: signed 8 bit integer
428 # @u16: unsigned 16 bit integer
430 # @s16: signed 16 bit integer
432 # @u32: unsigned 32 bit integer
434 # @s32: signed 32 bit integer
436 # @f32: single precision floating-point (since 5.0)
438 # Since: 4.0
440 { 'enum': 'AudioFormat',
441   'data': [ 'u8', 's8', 'u16', 's16', 'u32', 's32', 'f32' ] }
444 # @AudiodevDriver:
446 # An enumeration of possible audio backend drivers.
448 # @jack: JACK audio backend (since 5.1)
450 # Since: 4.0
452 { 'enum': 'AudiodevDriver',
453   'data': [ 'none',
454             { 'name': 'alsa', 'if': 'CONFIG_AUDIO_ALSA' },
455             { 'name': 'coreaudio', 'if': 'CONFIG_AUDIO_COREAUDIO' },
456             { 'name': 'dbus', 'if': 'CONFIG_DBUS_DISPLAY' },
457             { 'name': 'dsound', 'if': 'CONFIG_AUDIO_DSOUND' },
458             { 'name': 'jack', 'if': 'CONFIG_AUDIO_JACK' },
459             { 'name': 'oss', 'if': 'CONFIG_AUDIO_OSS' },
460             { 'name': 'pa', 'if': 'CONFIG_AUDIO_PA' },
461             { 'name': 'pipewire', 'if': 'CONFIG_AUDIO_PIPEWIRE' },
462             { 'name': 'sdl', 'if': 'CONFIG_AUDIO_SDL' },
463             { 'name': 'sndio', 'if': 'CONFIG_AUDIO_SNDIO' },
464             { 'name': 'spice', 'if': 'CONFIG_SPICE' },
465             'wav' ] }
468 # @Audiodev:
470 # Options of an audio backend.
472 # @id: identifier of the backend
474 # @driver: the backend driver to use
476 # @timer-period: timer period (in microseconds, 0: use lowest
477 #     possible)
479 # Since: 4.0
481 { 'union': 'Audiodev',
482   'base': {
483     'id':            'str',
484     'driver':        'AudiodevDriver',
485     '*timer-period': 'uint32' },
486   'discriminator': 'driver',
487   'data': {
488     'none':      'AudiodevGenericOptions',
489     'alsa':      { 'type': 'AudiodevAlsaOptions',
490                    'if': 'CONFIG_AUDIO_ALSA' },
491     'coreaudio': { 'type': 'AudiodevCoreaudioOptions',
492                    'if': 'CONFIG_AUDIO_COREAUDIO' },
493     'dbus':      { 'type': 'AudiodevGenericOptions',
494                    'if': 'CONFIG_DBUS_DISPLAY' },
495     'dsound':    { 'type': 'AudiodevDsoundOptions',
496                    'if': 'CONFIG_AUDIO_DSOUND' },
497     'jack':      { 'type': 'AudiodevJackOptions',
498                    'if': 'CONFIG_AUDIO_JACK' },
499     'oss':       { 'type': 'AudiodevOssOptions',
500                    'if': 'CONFIG_AUDIO_OSS' },
501     'pa':        { 'type': 'AudiodevPaOptions',
502                    'if': 'CONFIG_AUDIO_PA' },
503     'pipewire':  { 'type': 'AudiodevPipewireOptions',
504                    'if': 'CONFIG_AUDIO_PIPEWIRE' },
505     'sdl':       { 'type': 'AudiodevSdlOptions',
506                    'if': 'CONFIG_AUDIO_SDL' },
507     'sndio':     { 'type': 'AudiodevSndioOptions',
508                    'if': 'CONFIG_AUDIO_SNDIO' },
509     'spice':     { 'type': 'AudiodevGenericOptions',
510                    'if': 'CONFIG_SPICE' },
511     'wav':       'AudiodevWavOptions' } }
514 # @query-audiodevs:
516 # Returns information about audiodev configuration
518 # Returns: array of @Audiodev
520 # Since: 8.0
522 { 'command': 'query-audiodevs',
523   'returns': ['Audiodev'] }