audio: introduce -audiodev

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJch1vTAAoJEEy22O7T6HE4KL8QAI7VfMK8ZKTx/9Su46RL1A0G
 xNYhapdkhK2DEMd7JDY+eg8I8VQEwWroEjphCxLdx3p84Gr44gwgj3T24iRlXugq
 hJEgtBR548bBBdGd6KRihS8ZOro1T2gXol/TRq9z/TEF2LU6AVy52riZ/iydEd2U
 /ibkISR/vLdOnQ1Mj4YpchCZHx1yvMjSOhF/Cw2kXUm8C0jEuj3ws/BfdZQ8DxDG
 ayzS7JwSGOedsoFj+yfWX/YjCiocaXSLux9kyACzhHSJcA/5hw5srbXyhe4JrgdY
 BEqaUa23KiulgFt5fXnprktq+BQba/a4Tbx+YZFaNvX4HXqVccnCNN+VMkV4CvBN
 Y6UwijfaePVaQFP4kP+vpvqdPoJHNGikPlX8j3Q7ofL5+/c7Qk9yChNyB8lpfOIe
 KBNNsIIJO2GVU0IVNuqIGldWZYQw2y8ojpNSntg5lyFIrwZ+ipDFuxD9weZibVgc
 pa4VfPNKW4lOWrDX0PLv5eTNWOLamY3T1wY6pQCOtHgzlChRa28pMWkB7VkzTTQW
 gzipigqpVzmd3l1m2uI7LOovZa326IrGRC1/Yb4a41Gz58p9a1U2sYTijhPlAaeq
 VDMafPTAIJYpg0MW5Uxh1eB05WzNafPfEznjMJ/Z84J4P/oGFxlOGcL99sAbrxpl
 cQWWZlBGINQhxZ1PtvJc
 =7YpW
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/audio-20190312-pull-request' into staging

audio: introduce -audiodev

# gpg: Signature made Tue 12 Mar 2019 07:12:19 GMT
# gpg:                using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/audio-20190312-pull-request:
  audio: -audiodev command line option: cleanup
  wavaudio: port to -audiodev config
  spiceaudio: port to -audiodev config
  sdlaudio: port to -audiodev config
  paaudio: port to -audiodev config
  ossaudio: port to -audiodev config
  noaudio: port to -audiodev config
  dsoundaudio: port to -audiodev config
  coreaudio: port to -audiodev config
  alsaaudio: port to -audiodev config
  audio: -audiodev command line option basic implementation
  audio: -audiodev command line option: documentation
  audio: use qapi AudioFormat instead of audfmt_e
  qapi: qapi for audio backends

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

# Conflicts:
#	qemu-deprecated.texi
This commit is contained in:
Peter Maydell 2019-03-12 16:45:13 +00:00
commit cfc3fef6b4
40 changed files with 1835 additions and 1287 deletions

View file

@ -416,14 +416,244 @@ The default is @code{en-us}.
ETEXI
HXCOMM Deprecated by -audiodev
DEF("audio-help", 0, QEMU_OPTION_audio_help,
"-audio-help print list of audio drivers and their options\n",
"-audio-help show -audiodev equivalent of the currently specified audio settings\n",
QEMU_ARCH_ALL)
STEXI
@item -audio-help
@findex -audio-help
Will show the audio subsystem help: list of drivers, tunable
parameters.
Will show the -audiodev equivalent of the currently specified
(deprecated) environment variables.
ETEXI
DEF("audiodev", HAS_ARG, QEMU_OPTION_audiodev,
"-audiodev [driver=]driver,id=id[,prop[=value][,...]]\n"
" specifies the audio backend to use\n"
" id= identifier of the backend\n"
" timer-period= timer period in microseconds\n"
" in|out.fixed-settings= use fixed settings for host audio\n"
" in|out.frequency= frequency to use with fixed settings\n"
" in|out.channels= number of channels to use with fixed settings\n"
" in|out.format= sample format to use with fixed settings\n"
" valid values: s8, s16, s32, u8, u16, u32\n"
" in|out.voices= number of voices to use\n"
" in|out.buffer-len= length of buffer in microseconds\n"
"-audiodev none,id=id,[,prop[=value][,...]]\n"
" dummy driver that discards all output\n"
#ifdef CONFIG_AUDIO_ALSA
"-audiodev alsa,id=id[,prop[=value][,...]]\n"
" in|out.dev= name of the audio device to use\n"
" in|out.period-len= length of period in microseconds\n"
" in|out.try-poll= attempt to use poll mode\n"
" threshold= threshold (in microseconds) when playback starts\n"
#endif
#ifdef CONFIG_AUDIO_COREAUDIO
"-audiodev coreaudio,id=id[,prop[=value][,...]]\n"
" in|out.buffer-count= number of buffers\n"
#endif
#ifdef CONFIG_AUDIO_DSOUND
"-audiodev dsound,id=id[,prop[=value][,...]]\n"
" latency= add extra latency to playback in microseconds\n"
#endif
#ifdef CONFIG_AUDIO_OSS
"-audiodev oss,id=id[,prop[=value][,...]]\n"
" in|out.dev= path of the audio device to use\n"
" in|out.buffer-count= number of buffers\n"
" in|out.try-poll= attempt to use poll mode\n"
" try-mmap= try using memory mapped access\n"
" exclusive= open device in exclusive mode\n"
" dsp-policy= set timing policy (0..10), -1 to use fragment mode\n"
#endif
#ifdef CONFIG_AUDIO_PA
"-audiodev pa,id=id[,prop[=value][,...]]\n"
" server= PulseAudio server address\n"
" in|out.name= source/sink device name\n"
#endif
#ifdef CONFIG_AUDIO_SDL
"-audiodev sdl,id=id[,prop[=value][,...]]\n"
#endif
#ifdef CONFIG_SPICE
"-audiodev spice,id=id[,prop[=value][,...]]\n"
#endif
"-audiodev wav,id=id[,prop[=value][,...]]\n"
" path= path of wav file to record\n",
QEMU_ARCH_ALL)
STEXI
@item -audiodev [driver=]@var{driver},id=@var{id}[,@var{prop}[=@var{value}][,...]]
@findex -audiodev
Adds a new audio backend @var{driver} identified by @var{id}. There are
global and driver specific properties. Some values can be set
differently for input and output, they're marked with @code{in|out.}.
You can set the input's property with @code{in.@var{prop}} and the
output's property with @code{out.@var{prop}}. For example:
@example
-audiodev alsa,id=example,in.frequency=44110,out.frequency=8000
-audiodev alsa,id=example,out.channels=1 # leaves in.channels unspecified
@end example
Valid global options are:
@table @option
@item id=@var{identifier}
Identifies the audio backend.
@item timer-period=@var{period}
Sets the timer @var{period} used by the audio subsystem in microseconds.
Default is 10000 (10 ms).
@item in|out.fixed-settings=on|off
Use fixed settings for host audio. When off, it will change based on
how the guest opens the sound card. In this case you must not specify
@var{frequency}, @var{channels} or @var{format}. Default is on.
@item in|out.frequency=@var{frequency}
Specify the @var{frequency} to use when using @var{fixed-settings}.
Default is 44100Hz.
@item in|out.channels=@var{channels}
Specify the number of @var{channels} to use when using
@var{fixed-settings}. Default is 2 (stereo).
@item in|out.format=@var{format}
Specify the sample @var{format} to use when using @var{fixed-settings}.
Valid values are: @code{s8}, @code{s16}, @code{s32}, @code{u8},
@code{u16}, @code{u32}. Default is @code{s16}.
@item in|out.voices=@var{voices}
Specify the number of @var{voices} to use. Default is 1.
@item in|out.buffer=@var{usecs}
Sets the size of the buffer in microseconds.
@end table
@item -audiodev none,id=@var{id}[,@var{prop}[=@var{value}][,...]]
Creates a dummy backend that discards all outputs. This backend has no
backend specific properties.
@item -audiodev alsa,id=@var{id}[,@var{prop}[=@var{value}][,...]]
Creates backend using the ALSA. This backend is only available on
Linux.
ALSA specific options are:
@table @option
@item in|out.dev=@var{device}
Specify the ALSA @var{device} to use for input and/or output. Default
is @code{default}.
@item in|out.period-len=@var{usecs}
Sets the period length in microseconds.
@item in|out.try-poll=on|off
Attempt to use poll mode with the device. Default is on.
@item threshold=@var{threshold}
Threshold (in microseconds) when playback starts. Default is 0.
@end table
@item -audiodev coreaudio,id=@var{id}[,@var{prop}[=@var{value}][,...]]
Creates a backend using Apple's Core Audio. This backend is only
available on Mac OS and only supports playback.
Core Audio specific options are:
@table @option
@item in|out.buffer-count=@var{count}
Sets the @var{count} of the buffers.
@end table
@item -audiodev dsound,id=@var{id}[,@var{prop}[=@var{value}][,...]]
Creates a backend using Microsoft's DirectSound. This backend is only
available on Windows and only supports playback.
DirectSound specific options are:
@table @option
@item latency=@var{usecs}
Add extra @var{usecs} microseconds latency to playback. Default is
10000 (10 ms).
@end table
@item -audiodev oss,id=@var{id}[,@var{prop}[=@var{value}][,...]]
Creates a backend using OSS. This backend is available on most
Unix-like systems.
OSS specific options are:
@table @option
@item in|out.dev=@var{device}
Specify the file name of the OSS @var{device} to use. Default is
@code{/dev/dsp}.
@item in|out.buffer-count=@var{count}
Sets the @var{count} of the buffers.
@item in|out.try-poll=on|of
Attempt to use poll mode with the device. Default is on.
@item try-mmap=on|off
Try using memory mapped device access. Default is off.
@item exclusive=on|off
Open the device in exclusive mode (vmix won't work in this case).
Default is off.
@item dsp-policy=@var{policy}
Sets the timing policy (between 0 and 10, where smaller number means
smaller latency but higher CPU usage). Use -1 to use buffer sizes
specified by @code{buffer} and @code{buffer-count}. This option is
ignored if you do not have OSS 4. Default is 5.
@end table
@item -audiodev pa,id=@var{id}[,@var{prop}[=@var{value}][,...]]
Creates a backend using PulseAudio. This backend is available on most
systems.
PulseAudio specific options are:
@table @option
@item server=@var{server}
Sets the PulseAudio @var{server} to connect to.
@item in|out.name=@var{sink}
Use the specified source/sink for recording/playback.
@end table
@item -audiodev sdl,id=@var{id}[,@var{prop}[=@var{value}][,...]]
Creates a backend using SDL. This backend is available on most systems,
but you should use your platform's native backend if possible. This
backend has no backend specific properties.
@item -audiodev spice,id=@var{id}[,@var{prop}[=@var{value}][,...]]
Creates a backend that sends audio through SPICE. This backend requires
@code{-spice} and automatically selected in that case, so usually you
can ignore this option. This backend has no backend specific
properties.
@item -audiodev wav,id=@var{id}[,@var{prop}[=@var{value}][,...]]
Creates a backend that writes audio to a WAV file.
Backend specific options are:
@table @option
@item path=@var{path}
Write recorded audio into the specified file. Default is
@code{qemu.wav}.
@end table
ETEXI
DEF("soundhw", HAS_ARG, QEMU_OPTION_soundhw,