Audio patches
v6 cover Audio patches
Hi,
Here's an updated version of my audio patches. Changes from v5:
* small qapi fixes
* fixed a bug in audio_create_pdos [1]
Regards,
Zoltan
[1]: https://lists.nongnu.org/archive/html/qemu-devel/2019-02/msg06842.html
Kővágó, Zoltán (14):
qapi: qapi for audio backends
audio: use qapi AudioFormat instead of audfmt_e
audio: -audiodev command line option: documentation
audio: -audiodev command line option basic implementation
alsaaudio: port to -audiodev config
coreaudio: port to -audiodev config
dsoundaudio: port to -audiodev config
noaudio: port to -audiodev config
ossaudio: port to -audiodev config
paaudio: port to -audiodev config
sdlaudio: port to -audiodev config
spiceaudio: port to -audiodev config
wavaudio: port to -audiodev config
audio: -audiodev command line option: cleanup
qemu-deprecated.texi | 7 + qapi/audio.json | 304 ++++++++++++++ qapi/qapi-schema.json | 1 + audio/audio.h | 30 +- audio/audio_int.h | 37 +- audio/audio_template.h | 42 +- audio/dsound_template.h | 6 +- audio/alsaaudio.c | 368 ++++++---------- audio/audio.c | 859 +++++++++++++------------------------- audio/audio_legacy.c | 544 ++++++++++++++++++++++++ audio/audio_win_int.c | 18 +- audio/coreaudio.c | 51 +-- audio/dsoundaudio.c | 61 +-- audio/noaudio.c | 3 +- audio/ossaudio.c | 191 +++------ audio/paaudio.c | 111 ++--- audio/sdlaudio.c | 50 +-- audio/spiceaudio.c | 11 +- audio/wavaudio.c | 75 +--- audio/wavcapture.c | 2 +- hw/arm/omap2.c | 2 +- hw/audio/ac97.c | 2 +- hw/audio/adlib.c | 2 +- hw/audio/cs4231a.c | 6 +- hw/audio/es1370.c | 4 +- hw/audio/gus.c | 2 +- hw/audio/hda-codec.c | 18 +- hw/audio/lm4549.c | 6 +- hw/audio/milkymist-ac97.c | 2 +- hw/audio/pcspk.c | 2 +- hw/audio/sb16.c | 14 +- hw/audio/wm8750.c | 6 +- hw/display/xlnx_dp.c | 2 +- hw/input/tsc210x.c | 2 +- hw/usb/dev-audio.c | 2 +- ui/vnc.c | 26 +- vl.c | 7 +- audio/Makefile.objs | 2 +- qapi/Makefile.objs | 6 +- qemu-options.hx | 236 ++++++++++- 40 files changed, 1834 insertions(+), 1286 deletions(-) create mode 100644 qapi/audio.json create mode 100644 audio/audio_legacy.c
Signature · 1 line
2.20.1
PATCH v6 1/14 qapi: qapi for audio backends
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)
---
Notes:
Changes from v5:
* documentation fixes
* renamed buffer-len to buffer-length and period-len to period-length
Changes from v4:
* documentation fixes
* renamed pa's source/sink to pa-in/pa-out
* per-direction options changed per Markus Armbruster's comments
Changes from v2:
* update copyright, version numbers
* remove #optional
* per-direction options are now optional (needed for qobject_object_visitor_new_str)
* removed unnecessary AudiodevNoOptions
* changed integers to unsigned
qapi/audio.json | 304 ++++++++++++++++++++++++++++++++++++++++++ qapi/qapi-schema.json | 1 + qapi/Makefile.objs | 6 +- 3 files changed, 308 insertions(+), 3 deletions(-) create mode 100644 qapi/audio.json
qapi/audio.json new file +304 -0
@@ -0,0 +1,304 @@ +# -*- mode: python -*- +# +# Copyright (C) 2015-2019 Zoltán Kővágó <[email protected]> +# +# This work is licensed under the terms of the GNU GPL, version 2 or later. +# See the COPYING file in the top-level directory. + +## +# @AudiodevPerDirectionOptions: +# +# General audio backend options that are used for both playback and +# recording. +# +# @fixed-settings: use fixed settings for host input/output. When off, +# frequency, channels and format must not be +# specified (default true) +# +# @frequency: frequency to use when using fixed settings +# (default 44100) +# +# @channels: number of channels when using fixed settings (default 2) +# +# @voices: number of voices to use (default 1) +# +# @format: sample format to use when using fixed settings +# (default s16) +# +# @buffer-length: the buffer length in microseconds +# +# Since: 4.0 +## +{ 'struct': 'AudiodevPerDirectionOptions', + 'data': { + '*fixed-settings': 'bool', + '*frequency': 'uint32', + '*channels': 'uint32', + '*voices': 'uint32', + '*format': 'AudioFormat', + '*buffer-length': 'uint32' } } + +## +# @AudiodevGenericOptions: +# +# Generic driver-specific options. +# +# @in: options of the capture stream +# +# @out: options of the playback stream +# +# Since: 4.0 +## +{ 'struct': 'AudiodevGenericOptions', + 'data': { + '*in': 'AudiodevPerDirectionOptions', + '*out': 'AudiodevPerDirectionOptions' } } + +## +# @AudiodevAlsaPerDirectionOptions: +# +# Options of the ALSA backend that are used for both playback and +# recording. +# +# @dev: the name of the ALSA device to use (default 'default') +# +# @period-length: the period length in microseconds +# +# @try-poll: attempt to use poll mode, falling back to non-polling +# access on failure (default true) +# +# Since: 4.0 +## +{ 'struct': 'AudiodevAlsaPerDirectionOptions', + 'base': 'AudiodevPerDirectionOptions', + 'data': { + '*dev': 'str', + '*period-length': 'uint32', + '*try-poll': 'bool' } } + +## +# @AudiodevAlsaOptions: +# +# Options of the ALSA audio backend. +# +# @in: options of the capture stream +# +# @out: options of the playback stream +# +# @threshold: set the threshold (in microseconds) when playback starts +# +# Since: 4.0 +## +{ 'struct': 'AudiodevAlsaOptions', + 'data': { + '*in': 'AudiodevAlsaPerDirectionOptions', + '*out': 'AudiodevAlsaPerDirectionOptions', + '*threshold': 'uint32' } } + +## +# @AudiodevCoreaudioPerDirectionOptions: +# +# Options of the Core Audio backend that are used for both playback and +# recording. +# +# @buffer-count: number of buffers +# +# Since: 4.0 +## +{ 'struct': 'AudiodevCoreaudioPerDirectionOptions', + 'base': 'AudiodevPerDirectionOptions', + 'data': { + '*buffer-count': 'uint32' } } + +## +# @AudiodevCoreaudioOptions: +# +# Options of the coreaudio audio backend. +# +# @in: options of the capture stream +# +# @out: options of the playback stream +# +# Since: 4.0 +## +{ 'struct': 'AudiodevCoreaudioOptions', + 'data': { + '*in': 'AudiodevCoreaudioPerDirectionOptions', + '*out': 'AudiodevCoreaudioPerDirectionOptions' } } + +## +# @AudiodevDsoundOptions: +# +# Options of the DirectSound audio backend. +# +# @in: options of the capture stream +# +# @out: options of the playback stream +# +# @latency: add extra latency to playback in microseconds +# (default 10000) +# +# Since: 4.0 +## +{ 'struct': 'AudiodevDsoundOptions', + 'data': { + '*in': 'AudiodevPerDirectionOptions', + '*out': 'AudiodevPerDirectionOptions', + '*latency': 'uint32' } } + +## +# @AudiodevOssPerDirectionOptions: +# +# Options of the OSS backend that are used for both playback and +# recording. +# +# @dev: file name of the OSS device (default '/dev/dsp') +# +# @buffer-count: number of buffers +# +# @try-poll: attempt to use poll mode, falling back to non-polling +# access on failure (default true) +# +# Since: 4.0 +## +{ 'struct': 'AudiodevOssPerDirectionOptions', + 'base': 'AudiodevPerDirectionOptions', + 'data': { + '*dev': 'str', + '*buffer-count': 'uint32', + '*try-poll': 'bool' } } + +## +# @AudiodevOssOptions: +# +# Options of the OSS audio backend. +# +# @in: options of the capture stream +# +# @out: options of the playback stream +# +# @try-mmap: try using memory-mapped access, falling back to +# non-memory-mapped access on failure (default true) +# +# @exclusive: open device in exclusive mode (vmix won't work) +# (default false) +# +# @dsp-policy: 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: 4.0 +## +{ 'struct': 'AudiodevOssOptions', + 'data': { + '*in': 'AudiodevOssPerDirectionOptions', + '*out': 'AudiodevOssPerDirectionOptions', + '*try-mmap': 'bool', + '*exclusive': 'bool', + '*dsp-policy': 'uint32' } } + +## +# @AudiodevPaPerDirectionOptions: +# +# Options of the Pulseaudio backend that are used for both playback and +# recording. +# +# @name: name of the sink/source to use +# +# Since: 4.0 +## +{ 'struct': 'AudiodevPaPerDirectionOptions', + 'base': 'AudiodevPerDirectionOptions', + 'data': { + '*name': 'str' } } + +## +# @AudiodevPaOptions: +# +# Options of the PulseAudio audio backend. +# +# @in: options of the capture stream +# +# @out: options of the playback stream +# +# @server: PulseAudio server address (default: let PulseAudio choose) +# +# Since: 4.0 +## +{ 'struct': 'AudiodevPaOptions', + 'data': { + '*in': 'AudiodevPaPerDirectionOptions', + '*out': 'AudiodevPaPerDirectionOptions', + '*server': 'str' } } + +## +# @AudiodevWavOptions: +# +# Options of the wav audio backend. +# +# @in: options of the capture stream +# +# @out: options of the playback stream +# +# @path: name of the wav file to record (default 'qemu.wav') +# +# Since: 4.0 +## +{ 'struct': 'AudiodevWavOptions', + 'data': { + '*in': 'AudiodevPerDirectionOptions', + '*out': 'AudiodevPerDirectionOptions', + '*path': 'str' } } + + +## +# @AudioFormat: +# +# An enumeration of possible audio formats. +# +# Since: 4.0 +## +{ 'enum': 'AudioFormat', + 'data': [ 'u8', 's8', 'u16', 's16', 'u32', 's32' ] } + +## +# @AudiodevDriver: +# +# An enumeration of possible audio backend drivers. +# +# Since: 4.0 +## +{ 'enum': 'AudiodevDriver', + 'data': [ 'none', 'alsa', 'coreaudio', 'dsound', 'oss', 'pa', 'sdl', + 'spice', 'wav' ] } + +## +# @Audiodev: +# +# Options of an audio backend. +# +# @id: identifier of the backend +# +# @driver: the backend driver to use +# +# @timer-period: timer period (in microseconds, 0: use lowest possible) +# +# Since: 4.0 +## +{ 'union': 'Audiodev', + 'base': { + 'id': 'str', + 'driver': 'AudiodevDriver', + '*timer-period': 'uint32' }, + 'discriminator': 'driver', + 'data': { + 'none': 'AudiodevGenericOptions', + 'alsa': 'AudiodevAlsaOptions', + 'coreaudio': 'AudiodevCoreaudioOptions', + 'dsound': 'AudiodevDsoundOptions', + 'oss': 'AudiodevOssOptions', + 'pa': 'AudiodevPaOptions', + 'sdl': 'AudiodevGenericOptions', + 'spice': 'AudiodevGenericOptions', + 'wav': 'AudiodevWavOptions' } }
qapi/qapi-schema.json +1 -0
@@ -99,3 +99,4 @@ { 'include': 'introspect.json' } { 'include': 'misc.json' } { 'include': 'target.json' } +{ 'include': 'audio.json' }
qapi/Makefile.objs +3 -3
@@ -5,9 +5,9 @@ util-obj-y += opts-visitor.o qapi-clone-visitor.o util-obj-y += qmp-event.o util-obj-y += qapi-util.o -QAPI_COMMON_MODULES = authz block-core block char common crypto introspect -QAPI_COMMON_MODULES += job migration misc net rdma rocker run-state -QAPI_COMMON_MODULES += sockets tpm trace transaction ui +QAPI_COMMON_MODULES = audio authz block-core block char common crypto +QAPI_COMMON_MODULES += introspect job migration misc net rdma rocker +QAPI_COMMON_MODULES += run-state sockets tpm trace transaction ui QAPI_TARGET_MODULES = target QAPI_MODULES = $(QAPI_COMMON_MODULES) $(QAPI_TARGET_MODULES)
Signature · 1 line
2.20.1
Re: [Qemu-devel] [PATCH v6 01/14] qapi: qapi for audio backends
Quoted 76 lines · Zoltán
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:
* useinandoutinstead ofADCandDAC, 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 <[email protected]>Reviewed-by Markus Armbruster <[email protected]>---
Notes:
Changes from v5:* documentation fixes
* renamed buffer-len to buffer-length and period-len to period-lengthChanges from v4:
* documentation fixes
* renamed pa's source/sink to pa-in/pa-out
* per-direction options changed per Markus Armbruster's commentsChanges from v2:
* update copyright, version numbers
* remove #optional
* per-direction options are now optional (needed forqobject_object_visitor_new_str)
* removed unnecessary AudiodevNoOptions
* changed integers to unsignedqapi/audio.json | 304 ++++++++++++++++++++++++++++++++++++++++++ qapi/qapi-schema.json | 1 + qapi/Makefile.objs | 6 +- 3 files changed, 308 insertions(+), 3 deletions(-) create mode 100644 qapi/audio.jsonqapi/audio.json new file +18
-0@@ -0,0 +1,304 @@ +# -*- mode: python -*- +# +# Copyright (C) 2015-2019 Zoltán Kővágó <[email protected]> +# +# This work is licensed under the terms of the GNU GPL, version 2 or later. +# See the COPYING file in the top-level directory. + +## +# @AudiodevPerDirectionOptions: +# +# General audio backend options that are used for both playback and +# recording. +# +# @fixed-settings: use fixed settings for host input/output. When off, +# frequency, channels and format must not be +# specified (default true) +# +# @frequency: frequency to use when using fixed settings
qapi/audio.json line 28
Quoted 10 lines
qapi/audio.json new file +10
-0+# (default 44100) +# +# @channels: number of channels when using fixed settings (default 2) +# +# @voices: number of voices to use (default 1) +# +# @format: sample format to use when using fixed settings +# (default s16) +# +# @buffer-length: the buffer length in microseconds
The name buffer-length suggests bytes rather than microseconds. That's why I suggested @buffer-capacity. Matter of taste, up to you and Gerd.
qapi/audio.json line 39
Quoted 11 lines
qapi/audio.json new file +11
-0+# +# Since: 4.0 +## +{ 'struct': 'AudiodevPerDirectionOptions', + 'data': { + '*fixed-settings': 'bool', + '*frequency': 'uint32', + '*channels': 'uint32', + '*voices': 'uint32', + '*format': 'AudioFormat', + '*buffer-length': 'uint32' } }
[...]
Regardless:
Re: [Qemu-devel] [PATCH v6 01/14] qapi: qapi for audio backends
Quoted 83 lines · Markus Armbruster
Quoted 81 lines · Zoltán
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:
* useinandoutinstead ofADCandDAC, 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 <[email protected]>Reviewed-by Markus Armbruster <[email protected]>---
Notes:
Changes from v5:* documentation fixes
* renamed buffer-len to buffer-length and period-len to period-lengthChanges from v4:
* documentation fixes
* renamed pa's source/sink to pa-in/pa-out
* per-direction options changed per Markus Armbruster's commentsChanges from v2:
* update copyright, version numbers
* remove #optional
* per-direction options are now optional (needed forqobject_object_visitor_new_str)
* removed unnecessary AudiodevNoOptions
* changed integers to unsignedqapi/audio.json | 304 ++++++++++++++++++++++++++++++++++++++++++ qapi/qapi-schema.json | 1 + qapi/Makefile.objs | 6 +- 3 files changed, 308 insertions(+), 3 deletions(-) create mode 100644 qapi/audio.jsonqapi/audio.json new file +23
-0@@ -0,0 +1,304 @@ +# -*- mode: python -*- +# +# Copyright (C) 2015-2019 Zoltán Kővágó <[email protected]> +# +# This work is licensed under the terms of the GNU GPL, version 2 or later. +# See the COPYING file in the top-level directory. + +## +# @AudiodevPerDirectionOptions: +# +# General audio backend options that are used for both playback and +# recording. +# +# @fixed-settings: use fixed settings for host input/output. When off, +# frequency, channels and format must not be +# specified (default true) +# +# @frequency: frequency to use when using fixed settings +# (default 44100) +# +# @channels: number of channels when using fixed settings (default 2) +# +# @voices: number of voices to use (default 1)
Quoted 8 lines
qapi/audio.json line 28
Quoted 5 lines
qapi/audio.json new file +5
-0+# +# @format: sample format to use when using fixed settings +# (default s16) +# +# @buffer-length: the buffer length in microsecondsThe name buffer-length suggests bytes rather than microseconds. That's why I suggested @buffer-capacity. Matter of taste, up to you and Gerd.
@period-length has the same issue. For me @buffer-capacity and @period-capacity feels a bit weird. I'm not 100% familiar with qapi conventions, but for me 'size' is what's usually in bytes, and 'length' can be something else (number of characters in a string, length of a sound file, ...).
Quoted 14 lines
Quoted 12 lines
qapi/audio.json new file +11
-0+# +# Since: 4.0 +## +{ 'struct': 'AudiodevPerDirectionOptions', + 'data': { + '*fixed-settings': 'bool', + '*frequency': 'uint32', + '*channels': 'uint32', + '*voices': 'uint32', + '*format': 'AudioFormat', + '*buffer-length': 'uint32' } }[...]
Quoted 3 lines
Regardless:
Reviewed-by Markus Armbruster <[email protected]>
Regards,
Zoltan
PATCH v6 2/14 audio: use qapi AudioFormat instead of audfmt_e
In reply to Kővágó, ZoltánI had to include an enum for audio sampling formats into qapi, but that meant duplicating the audfmt_e enum. This patch replaces audfmt_e and associated values with the qapi generated AudioFormat enum.
This patch is mostly a search-and-replace, except for switches where the qapi generated AUDIO_FORMAT_MAX caused problems.
--- audio/audio.h | 12 +---- audio/alsaaudio.c | 53 +++++++++++---------- audio/audio.c | 97 +++++++++++++++++++++------------------ audio/audio_win_int.c | 18 ++++---- audio/ossaudio.c | 30 ++++++------ audio/paaudio.c | 28 +++++------ audio/sdlaudio.c | 26 +++++------ audio/spiceaudio.c | 4 +- audio/wavaudio.c | 17 ++++--- audio/wavcapture.c | 2 +- hw/arm/omap2.c | 2 +- hw/audio/ac97.c | 2 +- hw/audio/adlib.c | 2 +- hw/audio/cs4231a.c | 6 +-- hw/audio/es1370.c | 4 +- hw/audio/gus.c | 2 +- hw/audio/hda-codec.c | 18 ++++---- hw/audio/lm4549.c | 6 +-- hw/audio/milkymist-ac97.c | 2 +- hw/audio/pcspk.c | 2 +- hw/audio/sb16.c | 14 +++--- hw/audio/wm8750.c | 6 +-- hw/display/xlnx_dp.c | 2 +- hw/input/tsc210x.c | 2 +- hw/usb/dev-audio.c | 2 +- ui/vnc.c | 26 +++++------ 26 files changed, 196 insertions(+), 189 deletions(-)
audio/audio.h +2 -10
@@ -26,18 +26,10 @@#define QEMU_AUDIO_H #include "qemu/queue.h" +#include "qapi/qapi-types-audio.h" typedef void (*audio_callback_fn ) (void *opaque,int avail); -typedef enum { -AUD_FMT_U8 , -AUD_FMT_S8 , -AUD_FMT_U16 , -AUD_FMT_S16 , -AUD_FMT_U32 , -AUD_FMT_S32 -}audfmt_e ; -#ifdef HOST_WORDS_BIGENDIAN #define AUDIO_HOST_ENDIANNESS 1#else
@@ -47,7 +39,7 @@ typedef enum {struct audsettings {int freq;int nchannels; -audfmt_e fmt; +AudioFormat fmt;int endianness; };
audio/alsaaudio.c +28 -25
149 lines not on this page · raw message
audio/audio.c +53 -44
230 lines not on this page · raw message
audio/audio_win_int.c +9 -9
@@ -24,20 +24,20 @@ int waveformat_from_audio_settings (WAVEFORMATEX *wfx, wfx->cbSize =0 ;switch (as->fmt) { -case AUD_FMT_S8 : -case AUD_FMT_U8 : +case AUDIO_FORMAT_S8 : +case AUDIO_FORMAT_U8 : wfx->wBitsPerSample =8 ;break ; -case AUD_FMT_S16 : -case AUD_FMT_U16 : +case AUDIO_FORMAT_S16 : +case AUDIO_FORMAT_U16 : wfx->wBitsPerSample =16 ; wfx->nAvgBytesPerSec <<=1 ; wfx->nBlockAlign <<=1 ;break ; -case AUD_FMT_S32 : -case AUD_FMT_U32 : +case AUDIO_FORMAT_S32 : +case AUDIO_FORMAT_U32 : wfx->wBitsPerSample =32 ; wfx->nAvgBytesPerSec <<=2 ; wfx->nBlockAlign <<=2 ;
@@ -85,15 +85,15 @@ int waveformat_to_audio_settings (WAVEFORMATEX *wfx,switch (wfx->wBitsPerSample) {case 8 : - as->fmt =AUD_FMT_U8 ; + as->fmt =AUDIO_FORMAT_U8 ;break ;case 16 : - as->fmt =AUD_FMT_S16 ; + as->fmt =AUDIO_FORMAT_S16 ;break ;case 32 : - as->fmt =AUD_FMT_S32 ; + as->fmt =AUDIO_FORMAT_S32 ;break ;default :
audio/ossaudio.c +15 -15
@@ -70,7 +70,7 @@ typedef struct OSSVoiceIn {struct oss_params {int freq; -audfmt_e fmt; +AudioFormat fmt;int nchannels;int nfrags;int fragsize;
@@ -148,16 +148,16 @@ static int oss_write (SWVoiceOut *sw, void *buf, int len)return audio_pcm_sw_write (sw, buf, len); } -static int aud_to_ossfmt (audfmt_e fmt,int endianness) +static int aud_to_ossfmt (AudioFormat fmt,int endianness) {switch (fmt) { -case AUD_FMT_S8 : +case AUDIO_FORMAT_S8 :return AFMT_S8 ; -case AUD_FMT_U8 : +case AUDIO_FORMAT_U8 :return AFMT_U8 ; -case AUD_FMT_S16 : +case AUDIO_FORMAT_S16 :if (endianness) {return AFMT_S16_BE ; }
@@ -165,7 +165,7 @@ static int aud_to_ossfmt (audfmt_e fmt, int endianness)return AFMT_S16_LE ; } -case AUD_FMT_U16 : +case AUDIO_FORMAT_U16 :if (endianness) {return AFMT_U16_BE ; }
@@ -182,37 +182,37 @@ static int aud_to_ossfmt (audfmt_e fmt, int endianness) } } -static int oss_to_audfmt (int ossfmt,audfmt_e *fmt,int *endianness) +static int oss_to_audfmt (int ossfmt,AudioFormat *fmt,int *endianness) {switch (ossfmt) {case AFMT_S8 : *endianness =0 ; - *fmt =AUD_FMT_S8 ; + *fmt =AUDIO_FORMAT_S8 ;break ;case AFMT_U8 : *endianness =0 ; - *fmt =AUD_FMT_U8 ; + *fmt =AUDIO_FORMAT_U8 ;break ;case AFMT_S16_LE : *endianness =0 ; - *fmt =AUD_FMT_S16 ; + *fmt =AUDIO_FORMAT_S16 ;break ;case AFMT_U16_LE : *endianness =0 ; - *fmt =AUD_FMT_U16 ; + *fmt =AUDIO_FORMAT_U16 ;break ;case AFMT_S16_BE : *endianness =1 ; - *fmt =AUD_FMT_S16 ; + *fmt =AUDIO_FORMAT_S16 ;break ;case AFMT_U16_BE : *endianness =1 ; - *fmt =AUD_FMT_U16 ; + *fmt =AUDIO_FORMAT_U16 ;break ;default :
@@ -500,7 +500,7 @@ static int oss_init_out(HWVoiceOut *hw, struct audsettings *as,int endianness;int err;int fd; -audfmt_e effective_fmt; +AudioFormat effective_fmt;struct audsettings obt_as;OSSConf *conf = drv_opaque;
@@ -667,7 +667,7 @@ static int oss_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque)int endianness;int err;int fd; -audfmt_e effective_fmt; +AudioFormat effective_fmt;struct audsettings obt_as;OSSConf *conf = drv_opaque;
audio/paaudio.c +14 -14
@@ -385,21 +385,21 @@ static int qpa_read (SWVoiceIn *sw, void *buf, int len)return audio_pcm_sw_read (sw, buf, len); } -static pa_sample_format_t audfmt_to_pa (audfmt_e afmt,int endianness) +static pa_sample_format_t audfmt_to_pa (AudioFormat afmt,int endianness) {int format;switch (afmt) { -case AUD_FMT_S8 : -case AUD_FMT_U8 : +case AUDIO_FORMAT_S8 : +case AUDIO_FORMAT_U8 : format =PA_SAMPLE_U8 ;break ; -case AUD_FMT_S16 : -case AUD_FMT_U16 : +case AUDIO_FORMAT_S16 : +case AUDIO_FORMAT_U16 : format = endianness ?PA_SAMPLE_S16BE :PA_SAMPLE_S16LE ;break ; -case AUD_FMT_S32 : -case AUD_FMT_U32 : +case AUDIO_FORMAT_S32 : +case AUDIO_FORMAT_U32 : format = endianness ?PA_SAMPLE_S32BE :PA_SAMPLE_S32LE ;break ;default :
@@ -410,26 +410,26 @@ static pa_sample_format_t audfmt_to_pa (audfmt_e afmt, int endianness)return format; } -static audfmt_e pa_to_audfmt (pa_sample_format_t fmt,int *endianness) +static AudioFormat pa_to_audfmt (pa_sample_format_t fmt,int *endianness) {switch (fmt) {case PA_SAMPLE_U8 : -return AUD_FMT_U8 ; +return AUDIO_FORMAT_U8 ;case PA_SAMPLE_S16BE : *endianness =1 ; -return AUD_FMT_S16 ; +return AUDIO_FORMAT_S16 ;case PA_SAMPLE_S16LE : *endianness =0 ; -return AUD_FMT_S16 ; +return AUDIO_FORMAT_S16 ;case PA_SAMPLE_S32BE : *endianness =1 ; -return AUD_FMT_S32 ; +return AUDIO_FORMAT_S32 ;case PA_SAMPLE_S32LE : *endianness =0 ; -return AUD_FMT_S32 ; +return AUDIO_FORMAT_S32 ;default :dolog ("Internal logic error: Bad pa_sample_format %d\n" , fmt); -return AUD_FMT_U8 ; +return AUDIO_FORMAT_U8 ; } }
audio/sdlaudio.c +13 -13
@@ -68,19 +68,19 @@ static void GCC_FMT_ATTR (1, 2) sdl_logerr (const char *fmt, ...)AUD_log (AUDIO_CAP ,"Reason: %s\n" ,SDL_GetError ()); } -static int aud_to_sdlfmt (audfmt_e fmt) +static int aud_to_sdlfmt (AudioFormat fmt) {switch (fmt) { -case AUD_FMT_S8 : +case AUDIO_FORMAT_S8 :return AUDIO_S8 ; -case AUD_FMT_U8 : +case AUDIO_FORMAT_U8 :return AUDIO_U8 ; -case AUD_FMT_S16 : +case AUDIO_FORMAT_S16 :return AUDIO_S16LSB ; -case AUD_FMT_U16 : +case AUDIO_FORMAT_U16 :return AUDIO_U16LSB ;default :
@@ -92,37 +92,37 @@ static int aud_to_sdlfmt (audfmt_e fmt) } } -static int sdl_to_audfmt (int sdlfmt,audfmt_e *fmt,int *endianness) +static int sdl_to_audfmt (int sdlfmt,AudioFormat *fmt,int *endianness) {switch (sdlfmt) {case AUDIO_S8 : *endianness =0 ; - *fmt =AUD_FMT_S8 ; + *fmt =AUDIO_FORMAT_S8 ;break ;case AUDIO_U8 : *endianness =0 ; - *fmt =AUD_FMT_U8 ; + *fmt =AUDIO_FORMAT_U8 ;break ;case AUDIO_S16LSB : *endianness =0 ; - *fmt =AUD_FMT_S16 ; + *fmt =AUDIO_FORMAT_S16 ;break ;case AUDIO_U16LSB : *endianness =0 ; - *fmt =AUD_FMT_U16 ; + *fmt =AUDIO_FORMAT_U16 ;break ;case AUDIO_S16MSB : *endianness =1 ; - *fmt =AUD_FMT_S16 ; + *fmt =AUDIO_FORMAT_S16 ;break ;case AUDIO_U16MSB : *endianness =1 ; - *fmt =AUD_FMT_U16 ; + *fmt =AUDIO_FORMAT_U16 ;break ;default :
@@ -265,7 +265,7 @@ static int sdl_init_out(HWVoiceOut *hw, struct audsettings *as,SDL_AudioSpec req, obt;int endianness;int err; -audfmt_e effective_fmt; +AudioFormat effective_fmt;struct audsettings obt_as; req.freq = as->freq;
audio/spiceaudio.c +2 -2
@@ -130,7 +130,7 @@ static int line_out_init(HWVoiceOut *hw, struct audsettings *as, settings.freq =SPICE_INTERFACE_PLAYBACK_FREQ ;#endif settings.nchannels =SPICE_INTERFACE_PLAYBACK_CHAN ; - settings.fmt =AUD_FMT_S16 ; + settings.fmt =AUDIO_FORMAT_S16 ; settings.endianness =AUDIO_HOST_ENDIANNESS ;audio_pcm_init_info (&hw->info, &settings);
@@ -258,7 +258,7 @@ static int line_in_init(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque) settings.freq =SPICE_INTERFACE_RECORD_FREQ ;#endif settings.nchannels =SPICE_INTERFACE_RECORD_CHAN ; - settings.fmt =AUD_FMT_S16 ; + settings.fmt =AUDIO_FORMAT_S16 ; settings.endianness =AUDIO_HOST_ENDIANNESS ;audio_pcm_init_info (&hw->info, &settings);
audio/wavaudio.c +10 -7
@@ -117,20 +117,23 @@ static int wav_init_out(HWVoiceOut *hw, struct audsettings *as, stereo = wav_as.nchannels ==2 ;switch (wav_as.fmt) { -case AUD_FMT_S8 : -case AUD_FMT_U8 : +case AUDIO_FORMAT_S8 : +case AUDIO_FORMAT_U8 : bits16 =0 ;break ; -case AUD_FMT_S16 : -case AUD_FMT_U16 : +case AUDIO_FORMAT_S16 : +case AUDIO_FORMAT_U16 : bits16 =1 ;break ; -case AUD_FMT_S32 : -case AUD_FMT_U32 : +case AUDIO_FORMAT_S32 : +case AUDIO_FORMAT_U32 :dolog ("WAVE files can not handle 32bit formats\n" );return -1 ; + +default : +abort (); } hdr[34 ] = bits16 ?0x10 :0x08 ;
@@ -225,7 +228,7 @@ static int wav_ctl_out (HWVoiceOut *hw, int cmd, ...)static WAVConf glob_conf = { .settings.freq =44100 , .settings.nchannels =2 , - .settings.fmt =AUD_FMT_S16 , + .settings.fmt =AUDIO_FORMAT_S16 , .wav_path ="qemu.wav" };
audio/wavcapture.c +1 -1
@@ -136,7 +136,7 @@ int wav_start_capture (CaptureState *s, const char *path, int freq, as.freq = freq; as.nchannels =1 << stereo; - as.fmt = bits16 ?AUD_FMT_S16 :AUD_FMT_U8 ; + as.fmt = bits16 ?AUDIO_FORMAT_S16 :AUDIO_FORMAT_U8 ; as.endianness =0 ; ops.notify = wav_notify;
hw/arm/omap2.c +1 -1
@@ -273,7 +273,7 @@ static void omap_eac_format_update(struct omap_eac_s *s)* does I2S specify it? */ /* All register writes are 16 bits so we we store 16-bit samples * in the buffers regardless of AGCFR[B8_16] value. */ - fmt.fmt =AUD_FMT_U16 ; + fmt.fmt =AUDIO_FORMAT_U16 ; s->codec.in_voice =AUD_open_in (&s->codec.card, s->codec.in_voice,"eac.codec.in" , s, omap_eac_in_cb, &fmt);
hw/audio/ac97.c +1 -1
@@ -365,7 +365,7 @@ static void open_voice (AC97LinkState *s, int index, int freq) as.freq = freq; as.nchannels =2 ; - as.fmt =AUD_FMT_S16 ; + as.fmt =AUDIO_FORMAT_S16 ; as.endianness =0 ;if (freq >0 ) {
hw/audio/adlib.c +1 -1
@@ -269,7 +269,7 @@ static void adlib_realizefn (DeviceState *dev, Error **errp) as.freq = s->freq; as.nchannels =SHIFT ; - as.fmt =AUD_FMT_S16 ; + as.fmt =AUDIO_FORMAT_S16 ; as.endianness =AUDIO_HOST_ENDIANNESS ;AUD_register_card ("adlib" , &s->card);
hw/audio/cs4231a.c +3 -3
@@ -288,7 +288,7 @@ static void cs_reset_voices (CSState *s, uint32_t val)switch ((val >>5 ) & ((s->dregs[MODE_And_ID] &MODE2 ) ?7 :3 )) {case 0 : - as.fmt =AUD_FMT_U8 ; + as.fmt =AUDIO_FORMAT_U8 ; s->shift = as.nchannels ==2 ;break ;
@@ -298,7 +298,7 @@ static void cs_reset_voices (CSState *s, uint32_t val)case 3 : s->tab = ALawDecompressTable; x_law: - as.fmt =AUD_FMT_S16 ; + as.fmt =AUDIO_FORMAT_S16 ; as.endianness =AUDIO_HOST_ENDIANNESS ; s->shift = as.nchannels ==2 ;break ;
@@ -307,7 +307,7 @@ static void cs_reset_voices (CSState *s, uint32_t val) as.endianness =1 ;/* fall through */ case 2 : - as.fmt =AUD_FMT_S16 ; + as.fmt =AUDIO_FORMAT_S16 ; s->shift = as.nchannels;break ;
hw/audio/es1370.c +2 -2
@@ -414,14 +414,14 @@ static void es1370_update_voices (ES1370State *s, uint32_t ctl, uint32_t sctl) i, new_freq,1 << (new_fmt &1 ), - (new_fmt &2 ) ?AUD_FMT_S16 :AUD_FMT_U8 , + (new_fmt &2 ) ?AUDIO_FORMAT_S16 :AUDIO_FORMAT_U8 , d->shift);if (new_freq) {struct audsettings as; as.freq = new_freq; as.nchannels =1 << (new_fmt &1 ); - as.fmt = (new_fmt &2 ) ?AUD_FMT_S16 :AUD_FMT_U8 ; + as.fmt = (new_fmt &2 ) ?AUDIO_FORMAT_S16 :AUDIO_FORMAT_U8 ; as.endianness =0 ;if (i ==ADC_CHANNEL ) {
hw/audio/gus.c +1 -1
@@ -251,7 +251,7 @@ static void gus_realizefn (DeviceState *dev, Error **errp) as.freq = s->freq; as.nchannels =2 ; - as.fmt =AUD_FMT_S16 ; + as.fmt =AUDIO_FORMAT_S16 ; as.endianness =GUS_ENDIANNESS ; s->voice = AUD_open_out (
hw/audio/hda-codec.c +9 -9
@@ -99,9 +99,9 @@ static void hda_codec_parse_fmt(uint32_t format, struct audsettings *as) }switch (format &AC_FMT_BITS_MASK ) { -case AC_FMT_BITS_8 : as->fmt =AUD_FMT_S8 ;break ; -case AC_FMT_BITS_16 : as->fmt =AUD_FMT_S16 ;break ; -case AC_FMT_BITS_32 : as->fmt =AUD_FMT_S32 ;break ; +case AC_FMT_BITS_8 : as->fmt =AUDIO_FORMAT_S8 ;break ; +case AC_FMT_BITS_16 : as->fmt =AUDIO_FORMAT_S16 ;break ; +case AC_FMT_BITS_32 : as->fmt =AUDIO_FORMAT_S32 ;break ; } as->nchannels = ((format &AC_FMT_CHAN_MASK ) >>AC_FMT_CHAN_SHIFT ) +1 ;
@@ -134,12 +134,12 @@ static void hda_codec_parse_fmt(uint32_t format, struct audsettings *as)/* -------------------------------------------------------------------------- */ static const char *fmt2name[] = { - [AUD_FMT_U8 ] ="PCM-U8" , - [AUD_FMT_S8 ] ="PCM-S8" , - [AUD_FMT_U16 ] ="PCM-U16" , - [AUD_FMT_S16 ] ="PCM-S16" , - [AUD_FMT_U32 ] ="PCM-U32" , - [AUD_FMT_S32 ] ="PCM-S32" , + [AUDIO_FORMAT_U8 ] ="PCM-U8" , + [AUDIO_FORMAT_S8 ] ="PCM-S8" , + [AUDIO_FORMAT_U16 ] ="PCM-U16" , + [AUDIO_FORMAT_S16 ] ="PCM-S16" , + [AUDIO_FORMAT_U32 ] ="PCM-U32" , + [AUDIO_FORMAT_S32 ] ="PCM-S32" , };typedef struct HDAAudioState HDAAudioState ;
hw/audio/lm4549.c +3 -3
@@ -185,7 +185,7 @@ void lm4549_write(lm4549_state *s,struct audsettings as; as.freq = value; as.nchannels =2 ; - as.fmt =AUD_FMT_S16 ; + as.fmt =AUDIO_FORMAT_S16 ; as.endianness =0 ; s->voice = AUD_open_out(
@@ -255,7 +255,7 @@ static int lm4549_post_load(void *opaque, int version_id)struct audsettings as; as.freq = freq; as.nchannels =2 ; - as.fmt =AUD_FMT_S16 ; + as.fmt =AUDIO_FORMAT_S16 ; as.endianness =0 ; s->voice = AUD_open_out(
@@ -292,7 +292,7 @@ void lm4549_init(lm4549_state *s, lm4549_callback data_req_cb, void* opaque)/* Open a default voice */ as.freq =48000 ; as.nchannels =2 ; - as.fmt =AUD_FMT_S16 ; + as.fmt =AUDIO_FORMAT_S16 ; as.endianness =0 ; s->voice = AUD_open_out(
hw/audio/milkymist-ac97.c +1 -1
@@ -308,7 +308,7 @@ static void milkymist_ac97_realize(DeviceState *dev, Error **errp) as.freq =48000 ; as.nchannels =2 ; - as.fmt =AUD_FMT_S16 ; + as.fmt =AUDIO_FORMAT_S16 ; as.endianness =1 ; s->voice_in = AUD_open_in(&s->card, s->voice_in,
hw/audio/pcspk.c +1 -1
@@ -162,7 +162,7 @@ static void pcspk_initfn(Object *obj)static void pcspk_realizefn (DeviceState *dev,Error **errp) { -struct audsettings as = {PCSPK_SAMPLE_RATE ,1 ,AUD_FMT_U8 ,0 }; +struct audsettings as = {PCSPK_SAMPLE_RATE ,1 ,AUDIO_FORMAT_U8 ,0 };ISADevice *isadev =ISA_DEVICE (dev);PCSpkState *s =PC_SPEAKER (dev);
hw/audio/sb16.c +7 -7
@@ -66,7 +66,7 @@ typedef struct SB16State {int fmt_stereo;int fmt_signed;int fmt_bits; -audfmt_e fmt; +AudioFormat fmt;int dma_auto;int block_size;int fifo;
@@ -224,7 +224,7 @@ static void continue_dma8 (SB16State *s)static void dma_cmd8 (SB16State *s,int mask,int dma_len) { - s->fmt =AUD_FMT_U8 ; + s->fmt =AUDIO_FORMAT_U8 ; s->use_hdma =0 ; s->fmt_bits =8 ; s->fmt_signed =0 ;
@@ -319,18 +319,18 @@ static void dma_cmd (SB16State *s, uint8_t cmd, uint8_t d0, int dma_len)if (16 == s->fmt_bits) {if (s->fmt_signed) { - s->fmt =AUD_FMT_S16 ; + s->fmt =AUDIO_FORMAT_S16 ; }else { - s->fmt =AUD_FMT_U16 ; + s->fmt =AUDIO_FORMAT_U16 ; } }else {if (s->fmt_signed) { - s->fmt =AUD_FMT_S8 ; + s->fmt =AUDIO_FORMAT_S8 ; }else { - s->fmt =AUD_FMT_U8 ; + s->fmt =AUDIO_FORMAT_U8 ; } }
@@ -852,7 +852,7 @@ static void legacy_reset (SB16State *s) as.freq = s->freq; as.nchannels =1 ; - as.fmt =AUD_FMT_U8 ; + as.fmt =AUDIO_FORMAT_U8 ; as.endianness =0 ; s->voice = AUD_open_out (
hw/audio/wm8750.c +3 -3
@@ -201,7 +201,7 @@ static void wm8750_set_format(WM8750State *s) in_fmt.endianness =0 ; in_fmt.nchannels =2 ; in_fmt.freq = s->adc_hz; - in_fmt.fmt =AUD_FMT_S16 ; + in_fmt.fmt =AUDIO_FORMAT_S16 ; s->adc_voice[0 ] =AUD_open_in (&s->card, s->adc_voice[0 ],CODEC ".input1" , s, wm8750_audio_in_cb, &in_fmt);
@@ -214,7 +214,7 @@ static void wm8750_set_format(WM8750State *s) out_fmt.endianness =0 ; out_fmt.nchannels =2 ; out_fmt.freq = s->dac_hz; - out_fmt.fmt =AUD_FMT_S16 ; + out_fmt.fmt =AUDIO_FORMAT_S16 ; s->dac_voice[0 ] =AUD_open_out (&s->card, s->dac_voice[0 ],CODEC ".speaker" , s, wm8750_audio_out_cb, &out_fmt);
@@ -681,7 +681,7 @@ uint32_t wm8750_adc_dat(void *opaque)if (s->idx_in >=sizeof (s->data_in)) {wm8750_in_load (s);if (s->idx_in >=sizeof (s->data_in)) { -return 0x80008000 ;/* silence in AUD_FMT_S16 sample format */ +return 0x80008000 ;/* silence in AUDIO_FORMAT_S16 sample format */ } }
hw/display/xlnx_dp.c +1 -1
@@ -1260,7 +1260,7 @@ static void xlnx_dp_realize(DeviceState *dev, Error **errp) as.freq =44100 ; as.nchannels =2 ; - as.fmt =AUD_FMT_S16 ; + as.fmt =AUDIO_FORMAT_S16 ; as.endianness =0 ;AUD_register_card ("xlnx_dp.audio" , &s->aud_card);
hw/input/tsc210x.c +1 -1
@@ -318,7 +318,7 @@ static void tsc2102_audio_output_update(TSC210xState *s) fmt.endianness =0 ; fmt.nchannels =2 ; fmt.freq = s->codec.tx_rate; - fmt.fmt =AUD_FMT_S16 ; + fmt.fmt =AUDIO_FORMAT_S16 ; s->dac_voice[0 ] =AUD_open_out (&s->card, s->dac_voice[0 ],"tsc2102.sink" , s, (void *) tsc210x_audio_out_cb, &fmt);
hw/usb/dev-audio.c +1 -1
@@ -650,7 +650,7 @@ static void usb_audio_realize(USBDevice *dev, Error **errp) s->out.vol[1 ] =240 ;/* 0 dB */ s->out.as.freq =USBAUDIO_SAMPLE_RATE ; s->out.as.nchannels =2 ; - s->out.as.fmt =AUD_FMT_S16 ; + s->out.as.fmt =AUDIO_FORMAT_S16 ; s->out.as.endianness =0 ;streambuf_init (&s->out.buf, s->buffer);
ui/vnc.c +13 -13
@@ -1013,16 +1013,16 @@ static void vnc_update_throttle_offset(VncState *vs)int bps;switch (vs->as.fmt) {default : -case AUD_FMT_U8 : -case AUD_FMT_S8 : +case AUDIO_FORMAT_U8 : +case AUDIO_FORMAT_S8 : bps =1 ;break ; -case AUD_FMT_U16 : -case AUD_FMT_S16 : +case AUDIO_FORMAT_U16 : +case AUDIO_FORMAT_S16 : bps =2 ;break ; -case AUD_FMT_U32 : -case AUD_FMT_S32 : +case AUDIO_FORMAT_U32 : +case AUDIO_FORMAT_S32 : bps =4 ;break ; }
@@ -2369,12 +2369,12 @@ static int protocol_client_msg(VncState *vs, uint8_t *data, size_t len)if (len ==4 )return 10 ;switch (read_u8 (data,4 )) { -case 0 : vs->as.fmt =AUD_FMT_U8 ;break ; -case 1 : vs->as.fmt =AUD_FMT_S8 ;break ; -case 2 : vs->as.fmt =AUD_FMT_U16 ;break ; -case 3 : vs->as.fmt =AUD_FMT_S16 ;break ; -case 4 : vs->as.fmt =AUD_FMT_U32 ;break ; -case 5 : vs->as.fmt =AUD_FMT_S32 ;break ; +case 0 : vs->as.fmt =AUDIO_FORMAT_U8 ;break ; +case 1 : vs->as.fmt =AUDIO_FORMAT_S8 ;break ; +case 2 : vs->as.fmt =AUDIO_FORMAT_U16 ;break ; +case 3 : vs->as.fmt =AUDIO_FORMAT_S16 ;break ; +case 4 : vs->as.fmt =AUDIO_FORMAT_U32 ;break ; +case 5 : vs->as.fmt =AUDIO_FORMAT_S32 ;break ;default :VNC_DEBUG ("Invalid audio format %d\n" ,read_u8 (data,4 ));vnc_client_error (vs);
@@ -3105,7 +3105,7 @@ static void vnc_connect(VncDisplay *vd, QIOChannelSocket *sioc, vs->as.freq =44100 ; vs->as.nchannels =2 ; - vs->as.fmt =AUD_FMT_S16 ; + vs->as.fmt =AUDIO_FORMAT_S16 ; vs->as.endianness =0 ;qemu_mutex_init (&vs->output_mutex);
Signature · 1 line
2.20.1
PATCH v6 3/14 audio: -audiodev command line option: documentation
In reply to Kővágó, ZoltánThis patch adds documentation of an -audiodev command line option, that deprecates the old QEMU_* environment variables for audio backend configuration. It's syntax is similar to existing options (-netdev, -device, etc):
-audiodev driver_name,property=value,...
Although now it's possible to specify multiple -audiodev options on command line, multiple audio backends are not supported yet.
---
Notes:
Changes from v4:
* deprecated QEMU_AUDIO_ env vars
* updated to reflect qapi changes
* added info to qemu-deprecated.texi
qemu-deprecated.texi | 7 ++ qemu-options.hx | 236 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 240 insertions(+), 3 deletions(-)
qemu-deprecated.texi +7 -0
@@ -60,6 +60,13 @@ Support for invalid topologies will be removed, the user must ensure topologies described with -smp include all possible cpus, i.e. @math{@var{sockets} * @var{cores} * @var{threads} = @var{maxcpus}}. +@subsection QEMU_AUDIO_ environment variables and -audio-help (since 4.0) + +The ``-audiodev'' argument is now the preferred way to specify audio +backend settings instead of environment variables. To ease migration to +the new format, the ``-audiodev-help'' option can be used to convert +the current values of the environment variables to ``-audiodev'' options. + @section QEMU Machine Protocol (QMP) commands @subsection block-dirty-bitmap-add "autoload" parameter (since 2.12.0)
qemu-options.hx +233 -3
247 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v6 4/14 audio: -audiodev command line option basic implementation
In reply to Kővágó, ZoltánAudio drivers now get an Audiodev * as config paramters, instead of the global audio_option structs. There is some code in audio/audio_legacy.c that converts the old environment variables to audiodev options (this way backends do not have to worry about legacy options). It also contains a replacement of -audio-help, which prints out the equivalent -audiodev based config of the currently specified environment variables.
Note that backends are not updated and still rely on environment variables.
Also note that (due to moving try-poll from global to backend specific option) currently ALSA and OSS will always try poll mode, regardless of environment variables or -audiodev options.
--- audio/audio.h | 18 +- audio/audio_int.h | 20 +- audio/audio_template.h | 42 ++- audio/alsaaudio.c | 2 +- audio/audio.c | 630 ++++++++++++++++++----------------------- audio/audio_legacy.c | 293 +++++++++++++++++++ audio/coreaudio.c | 2 +- audio/dsoundaudio.c | 2 +- audio/noaudio.c | 2 +- audio/ossaudio.c | 2 +- audio/paaudio.c | 2 +- audio/sdlaudio.c | 2 +- audio/spiceaudio.c | 2 +- audio/wavaudio.c | 2 +- vl.c | 7 +- audio/Makefile.objs | 2 +- 16 files changed, 650 insertions(+), 380 deletions(-) create mode 100644 audio/audio_legacy.c
audio/audio.h +15 -3
@@ -36,12 +36,21 @@ typedef void (*audio_callback_fn) (void *opaque, int avail);#define AUDIO_HOST_ENDIANNESS 0#endif -struct audsettings { +typedef struct audsettings {int freq;int nchannels;AudioFormat fmt;int endianness; -}; +}audsettings ; + +audsettings audiodev_to_audsettings (AudiodevPerDirectionOptions *pdo); +int audioformat_bytes_per_sample (AudioFormat fmt); +int audio_buffer_frames (AudiodevPerDirectionOptions *pdo, +audsettings *as,int def_usecs); +int audio_buffer_samples (AudiodevPerDirectionOptions *pdo, +audsettings *as,int def_usecs); +int audio_buffer_bytes (AudiodevPerDirectionOptions *pdo, +audsettings *as,int def_usecs); typedef enum { AUD_CNOTIFY_ENABLE,
@@ -81,7 +90,6 @@ typedef struct QEMUAudioTimeStamp { void AUD_vlog (const char *cap, const char *fmt, va_list ap) GCC_FMT_ATTR(2, 0); void AUD_log (const char *cap, const char *fmt, ...) GCC_FMT_ATTR(2, 3); -void AUD_help (void );void AUD_register_card (const char *name,QEMUSoundCard *card);void AUD_remove_card (QEMUSoundCard *card); CaptureVoiceOut *AUD_add_capture (
@@ -163,4 +171,8 @@ void audio_sample_to_uint64(void *samples, int pos,void audio_sample_from_uint64 (void *samples,int pos,uint64_t left,uint64_t right); +void audio_parse_option (const char *opt); +void audio_init_audiodevs (void ); +void audio_legacy_help (void ); +#endif /* QEMU_AUDIO_H */
audio/audio_int.h +19 -1
@@ -146,7 +146,7 @@ struct audio_driver {const char *name;const char *descr;struct audio_option *options; -void *(*init) (void ); +void *(*init) (Audiodev *);void (*fini) (void *);struct audio_pcm_ops *pcm_ops;int can_be_default;
@@ -193,6 +193,7 @@ struct SWVoiceCap { typedef struct AudioState { struct audio_driver *drv; + Audiodev *dev; void *drv_opaque; QEMUTimer *ts;
@@ -203,10 +204,13 @@ typedef struct AudioState {int nb_hw_voices_out;int nb_hw_voices_in;int vm_running; +int64_t period_ticks; } AudioState;extern const struct mixeng_volume nominal_volume; +extern const char *audio_prio_list[]; +void audio_driver_register (audio_driver *drv);audio_driver *audio_driver_lookup (const char *name);
@@ -248,4 +252,18 @@ static inline int audio_ring_dist (int dst, int src, int len)#define AUDIO_STRINGIFY_ (n) #n#define AUDIO_STRINGIFY (n) AUDIO_STRINGIFY_(n) +typedef struct AudiodevListEntry { +Audiodev *dev; +QSIMPLEQ_ENTRY (AudiodevListEntry) next; +}AudiodevListEntry ; + +typedef QSIMPLEQ_HEAD(, AudiodevListEntry) AudiodevListHead; +AudiodevListHead audio_handle_legacy_opts (void ); + +void audio_free_audiodev_list (AudiodevListHead *head); + +void audio_create_pdos (Audiodev *dev); +AudiodevPerDirectionOptions *audio_get_pdo_in (Audiodev *dev); +AudiodevPerDirectionOptions *audio_get_pdo_out (Audiodev *dev); +#endif /* QEMU_AUDIO_INT_H */
audio/audio_template.h +38 -4
71 lines not on this page · raw message
audio/alsaaudio.c +1 -1
@@ -1125,7 +1125,7 @@ static ALSAConf glob_conf = { .pcm_name_in = "default", }; -static void *alsa_audio_init (void ) +static void *alsa_audio_init (Audiodev *dev) {ALSAConf *conf =g_malloc (sizeof (ALSAConf)); *conf = glob_conf;
audio/audio.c +269 -361
800 lines not on this page · raw message
audio/audio_legacy.c new file +293 -0
293 lines not on this page · raw message
audio/coreaudio.c +1 -1
@@ -685,7 +685,7 @@ static CoreaudioConf glob_conf = { .nbuffers = 4, }; -static void *coreaudio_audio_init (void ) +static void *coreaudio_audio_init (Audiodev *dev) {CoreaudioConf *conf =g_malloc (sizeof (CoreaudioConf)); *conf = glob_conf;
audio/dsoundaudio.c +1 -1
@@ -783,7 +783,7 @@ static void dsound_audio_fini (void *opaque)g_free (s); } -static void *dsound_audio_init (void ) +static void *dsound_audio_init (Audiodev *dev) {int err;HRESULT hr;
audio/noaudio.c +1 -1
@@ -136,7 +136,7 @@ static int no_ctl_in (HWVoiceIn *hw, int cmd, ...)return 0 ; } -static void *no_audio_init (void ) +static void *no_audio_init (Audiodev *dev) {return &no_audio_init; }
audio/ossaudio.c +1 -1
@@ -842,7 +842,7 @@ static OSSConf glob_conf = { .policy = 5 }; -static void *oss_audio_init (void ) +static void *oss_audio_init (Audiodev *dev) {OSSConf *conf =g_malloc (sizeof (OSSConf)); *conf = glob_conf;
audio/paaudio.c +1 -1
@@ -812,7 +812,7 @@ static PAConf glob_conf = { .samples = 4096, }; -static void *qpa_audio_init (void ) +static void *qpa_audio_init (Audiodev *dev) {if (glob_conf.server ==NULL ) {char pidfile[64 ];
audio/sdlaudio.c +1 -1
@@ -315,7 +315,7 @@ static int sdl_ctl_out (HWVoiceOut *hw, int cmd, ...)return 0 ; } -static void *sdl_audio_init (void ) +static void *sdl_audio_init (Audiodev *dev) {SDLAudioState *s = &glob_sdl;if (s->driver_created) {
audio/spiceaudio.c +1 -1
@@ -77,7 +77,7 @@ static const SpiceRecordInterface record_sif = { .base.minor_version = SPICE_INTERFACE_RECORD_MINOR, }; -static void *spice_audio_init (void ) +static void *spice_audio_init (Audiodev *dev) {if (!using_spice) {return NULL ;
audio/wavaudio.c +1 -1
@@ -232,7 +232,7 @@ static WAVConf glob_conf = { .wav_path = "qemu.wav" }; -static void *wav_audio_init (void ) +static void *wav_audio_init (Audiodev *dev) {WAVConf *conf =g_malloc (sizeof (WAVConf)); *conf = glob_conf;
vl.c +6 -1
@@ -3253,9 +3253,12 @@ int main(int argc, char **argv, char **envp)add_device_config (DEV_BT , optarg);break ;case QEMU_OPTION_audio_help: -AUD_help (); +audio_legacy_help ();exit (0 );break ; +case QEMU_OPTION_audiodev: +audio_parse_option (optarg); +break ;case QEMU_OPTION_soundhw:select_soundhw (optarg);break ;
@@ -4447,6 +4450,8 @@ int main(int argc, char **argv, char **envp)/* do monitor/qmp handling at preconfig state if requested */ main_loop (); +audio_init_audiodevs (); +/* from here on runstate is RUN_STATE_PRELAUNCH */ machine_run_board_init (current_machine);
audio/Makefile.objs +1 -1
@@ -1,4 +1,4 @@ -common-obj-y = audio.o noaudio.o wavaudio.o mixeng.o +common-obj-y = audio.o audio_legacy.o noaudio.o wavaudio.o mixeng.o common-obj-$(CONFIG_SPICE) += spiceaudio.o common-obj-$(CONFIG_AUDIO_COREAUDIO) += coreaudio.o common-obj-$(CONFIG_AUDIO_DSOUND) += dsoundaudio.o
Signature · 1 line
2.20.1
PATCH v6 5/14 alsaaudio: port to -audiodev config
In reply to Kővágó, Zoltán--- audio/alsaaudio.c | 329 +++++++++++++------------------------------ audio/audio_legacy.c | 84 ++++++++++- 2 files changed, 181 insertions(+), 232 deletions(-)
audio/alsaaudio.c +98 -231
@@ -33,28 +33,9 @@#define AUDIO_CAP "alsa"#include "audio_int.h" -typedef struct ALSAConf { -int size_in_usec_in; -int size_in_usec_out; -const char *pcm_name_in; -const char *pcm_name_out; -unsigned int buffer_size_in; -unsigned int period_size_in; -unsigned int buffer_size_out; -unsigned int period_size_out; -unsigned int threshold; - -int buffer_size_in_overridden; -int period_size_in_overridden; - -int buffer_size_out_overridden; -int period_size_out_overridden; -}ALSAConf ; -struct pollhlp {snd_pcm_t *handle;struct pollfd *pfds; -ALSAConf *conf;int count;int mask; };
@@ -66,6 +47,7 @@ typedef struct ALSAVoiceOut {void *pcm_buf;snd_pcm_t *handle;struct pollhlp pollhlp; +Audiodev *dev; } ALSAVoiceOut; typedef struct ALSAVoiceIn {
@@ -73,16 +55,13 @@ typedef struct ALSAVoiceIn {snd_pcm_t *handle;void *pcm_buf;struct pollhlp pollhlp; +Audiodev *dev; } ALSAVoiceIn;struct alsa_params_req {int freq;snd_pcm_format_t fmt;int nchannels; -int size_in_usec; -int override_mask; -unsigned int buffer_size; -unsigned int period_size; };struct alsa_params_obt {
@@ -408,17 +387,18 @@ static int alsa_to_audfmt (snd_pcm_format_t alsafmt, AudioFormat *fmt,static void alsa_dump_info (struct alsa_params_req *req,struct alsa_params_obt *obt, -snd_pcm_format_t obtfmt) +snd_pcm_format_t obtfmt, +AudiodevAlsaPerDirectionOptions *apdo) { -dolog ("parameter | requested value | obtained value\n" ); -dolog ("format | %10d | %10d\n" , req->fmt, obtfmt); -dolog ("channels | %10d | %10d\n" , - req->nchannels, obt->nchannels); -dolog ("frequency | %10d | %10d\n" , req->freq, obt->freq); -dolog ("============================================\n" ); -dolog ("requested: buffer size %d period size %d\n" , - req->buffer_size, req->period_size); -dolog ("obtained: samples %ld\n" , obt->samples); +dolog ("parameter | requested value | obtained value\n" ); +dolog ("format | %10d | %10d\n" , req->fmt, obtfmt); +dolog ("channels | %10d | %10d\n" , + req->nchannels, obt->nchannels); +dolog ("frequency | %10d | %10d\n" , req->freq, obt->freq); +dolog ("============================================\n" ); +dolog ("requested: buffer len %" PRId32" period len %" PRId32"\n" , + apdo->buffer_length, apdo->period_length); +dolog ("obtained: samples %ld\n" , obt->samples); }static void alsa_set_threshold (snd_pcm_t *handle,snd_pcm_uframes_t threshold)
@@ -451,23 +431,23 @@ static void alsa_set_threshold (snd_pcm_t *handle, snd_pcm_uframes_t threshold) } } -static int alsa_open (int in,struct alsa_params_req *req, -struct alsa_params_obt *obt,snd_pcm_t **handlep, -ALSAConf *conf) +static int alsa_open (bool in,struct alsa_params_req *req, +struct alsa_params_obt *obt,snd_pcm_t **handlep, +Audiodev *dev) { +AudiodevAlsaOptions *aopts = &dev->u.alsa; +AudiodevAlsaPerDirectionOptions *apdo = in ? aopts->in : aopts->out;snd_pcm_t *handle;snd_pcm_hw_params_t *hw_params;int err; -int size_in_usec;unsigned int freq, nchannels; -const char *pcm_name = in ? conf->pcm_name_in : conf->pcm_name_out; +const char *pcm_name = apdo->has_dev ? apdo->dev :"default" ;snd_pcm_uframes_t obt_buffer_size;const char *typ = in ?"ADC" :"DAC" ;snd_pcm_format_t obtfmt; freq = req->freq; nchannels = req->nchannels; - size_in_usec = req->size_in_usec;snd_pcm_hw_params_alloca (&hw_params);
@@ -527,79 +507,42 @@ static int alsa_open (int in, struct alsa_params_req *req, goto err; } -if (req->buffer_size) { -unsigned long obt; +if (apdo->buffer_length) { +int dir =0 ; +unsigned int btime = apdo->buffer_length; -if (size_in_usec) { -int dir =0 ; -unsigned int btime = req->buffer_size; + err =snd_pcm_hw_params_set_buffer_time_near ( + handle, hw_params, &btime, &dir); - err =snd_pcm_hw_params_set_buffer_time_near ( - handle, - hw_params, - &btime, - &dir - ); - obt = btime; - } -else { -snd_pcm_uframes_t bsize = req->buffer_size; - - err =snd_pcm_hw_params_set_buffer_size_near ( - handle, - hw_params, - &bsize - ); - obt = bsize; - }if (err <0 ) { -alsa_logerr2 (err, typ,"Failed to set buffer %s to %d\n" , - size_in_usec ?"time" :"size" , req->buffer_size); +alsa_logerr2 (err, typ,"Failed to set buffer time to %" PRId32"\n" , + apdo->buffer_length); goto err; } -if ((req->override_mask &2 ) && (obt - req->buffer_size)) -dolog ("Requested buffer %s %u was rejected, using %lu\n" , - size_in_usec ?"time" :"size" , req->buffer_size, obt); +if (apdo->has_buffer_length && btime != apdo->buffer_length) { +dolog ("Requested buffer time %" PRId32 +" was rejected, using %u\n" , apdo->buffer_length, btime); + } } -if (req->period_size) { -unsigned long obt; +if (apdo->period_length) { +int dir =0 ; +unsigned int ptime = apdo->period_length; -if (size_in_usec) { -int dir =0 ; -unsigned int ptime = req->period_size; - - err =snd_pcm_hw_params_set_period_time_near ( - handle, - hw_params, - &ptime, - &dir - ); - obt = ptime; - } -else { -int dir =0 ; -snd_pcm_uframes_t psize = req->period_size; - - err =snd_pcm_hw_params_set_period_size_near ( - handle, - hw_params, - &psize, - &dir - ); - obt = psize; - } + err =snd_pcm_hw_params_set_period_time_near (handle, hw_params, &ptime, + &dir);if (err <0 ) { -alsa_logerr2 (err, typ,"Failed to set period %s to %d\n" , - size_in_usec ?"time" :"size" , req->period_size); +alsa_logerr2 (err, typ,"Failed to set period time to %" PRId32"\n" , + apdo->period_length); goto err; } -if (((req->override_mask &1 ) && (obt - req->period_size))) -dolog ("Requested period %s %u was rejected, using %lu\n" , - size_in_usec ?"time" :"size" , req->period_size, obt); +if (apdo->has_period_length && ptime != apdo->period_length) { +dolog ("Requested period time %" PRId32" was rejected, using %d\n" , + apdo->period_length, ptime); + } } err =snd_pcm_hw_params (handle, hw_params);
@@ -631,33 +574,12 @@ static int alsa_open (int in, struct alsa_params_req *req, goto err; } -if (!in && conf->threshold) { -snd_pcm_uframes_t threshold; -int bytes_per_sec; - - bytes_per_sec = freq << (nchannels ==2 ); - -switch (obt->fmt) { -case AUDIO_FORMAT_S8 : -case AUDIO_FORMAT_U8 : -break ; - -case AUDIO_FORMAT_S16 : -case AUDIO_FORMAT_U16 : - bytes_per_sec <<=1 ; -break ; - -case AUDIO_FORMAT_S32 : -case AUDIO_FORMAT_U32 : - bytes_per_sec <<=2 ; -break ; - -default : -abort (); - } - - threshold = (conf->threshold * bytes_per_sec) /1000 ; -alsa_set_threshold (handle, threshold); +if (!in && aopts->has_threshold && aopts->threshold) { +struct audsettings as = { .freq = freq }; +alsa_set_threshold ( + handle, +audio_buffer_frames (qapi_AudiodevAlsaPerDirectionOptions_base (apdo), + &as, aopts->threshold)); } obt->nchannels = nchannels;
@@ -670,11 +592,11 @@ static int alsa_open (int in, struct alsa_params_req *req, obt->nchannels != req->nchannels || obt->freq != req->freq) {dolog ("Audio parameters for %s\n" , typ); -alsa_dump_info (req, obt, obtfmt); +alsa_dump_info (req, obt, obtfmt, apdo); }#ifdef DEBUG -alsa_dump_info (req, obt, obtfmt); +alsa_dump_info (req, obt, obtfmt, pdo);#endif return 0 ;
@@ -800,19 +722,13 @@ static int alsa_init_out(HWVoiceOut *hw, struct audsettings *as,struct alsa_params_obt obt;snd_pcm_t *handle;struct audsettings obt_as; -ALSAConf *conf = drv_opaque; +Audiodev *dev = drv_opaque; req.fmt =aud_to_alsafmt (as->fmt, as->endianness); req.freq = as->freq; req.nchannels = as->nchannels; - req.period_size = conf->period_size_out; - req.buffer_size = conf->buffer_size_out; - req.size_in_usec = conf->size_in_usec_out; - req.override_mask = - (conf->period_size_out_overridden ?1 :0 ) | - (conf->buffer_size_out_overridden ?2 :0 ); -if (alsa_open (0 , &req, &obt, &handle, conf)) { +if (alsa_open (0 , &req, &obt, &handle, dev)) {return -1 ; }
@@ -833,7 +749,7 @@ static int alsa_init_out(HWVoiceOut *hw, struct audsettings *as, } alsa->handle = handle; - alsa->pollhlp.conf = conf; + alsa->dev = dev;return 0 ; }
@@ -873,16 +789,12 @@ static int alsa_voice_ctl (snd_pcm_t *handle, const char *typ, int ctl)static int alsa_ctl_out (HWVoiceOut *hw,int cmd, ...) {ALSAVoiceOut *alsa = (ALSAVoiceOut *) hw; +AudiodevAlsaPerDirectionOptions *apdo = alsa->dev->u.alsa.out;switch (cmd) {case VOICE_ENABLE : { -va_list ap; -int poll_mode; - -va_start (ap, cmd); - poll_mode =va_arg (ap, int); -va_end (ap); +bool poll_mode = apdo->try_poll;ldebug ("enabling voice\n" );if (poll_mode &&alsa_poll_out (hw)) {
@@ -911,19 +823,13 @@ static int alsa_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque)struct alsa_params_obt obt;snd_pcm_t *handle;struct audsettings obt_as; -ALSAConf *conf = drv_opaque; +Audiodev *dev = drv_opaque; req.fmt =aud_to_alsafmt (as->fmt, as->endianness); req.freq = as->freq; req.nchannels = as->nchannels; - req.period_size = conf->period_size_in; - req.buffer_size = conf->buffer_size_in; - req.size_in_usec = conf->size_in_usec_in; - req.override_mask = - (conf->period_size_in_overridden ?1 :0 ) | - (conf->buffer_size_in_overridden ?2 :0 ); -if (alsa_open (1 , &req, &obt, &handle, conf)) { +if (alsa_open (1 , &req, &obt, &handle, dev)) {return -1 ; }
@@ -944,7 +850,7 @@ static int alsa_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque) } alsa->handle = handle; - alsa->pollhlp.conf = conf; + alsa->dev = dev;return 0 ; }
@@ -1086,16 +992,12 @@ static int alsa_read (SWVoiceIn *sw, void *buf, int size)static int alsa_ctl_in (HWVoiceIn *hw,int cmd, ...) {ALSAVoiceIn *alsa = (ALSAVoiceIn *) hw; +AudiodevAlsaPerDirectionOptions *apdo = alsa->dev->u.alsa.in;switch (cmd) {case VOICE_ENABLE : { -va_list ap; -int poll_mode; - -va_start (ap, cmd); - poll_mode =va_arg (ap, int); -va_end (ap); +bool poll_mode = apdo->try_poll;ldebug ("enabling voice\n" );if (poll_mode &&alsa_poll_in (hw)) {
@@ -1118,88 +1020,54 @@ static int alsa_ctl_in (HWVoiceIn *hw, int cmd, ...)return -1 ; } -static ALSAConf glob_conf = { - .buffer_size_out =4096 , - .period_size_out =1024 , - .pcm_name_out ="default" , - .pcm_name_in ="default" , -}; +static void alsa_init_per_direction (AudiodevAlsaPerDirectionOptions *apdo) +{ +if (!apdo->has_try_poll) { + apdo->try_poll = true; + apdo->has_try_poll = true; + } +}static void *alsa_audio_init (Audiodev *dev) { -ALSAConf *conf =g_malloc (sizeof (ALSAConf)); - *conf = glob_conf; -return conf; +AudiodevAlsaOptions *aopts; +assert (dev->driver ==AUDIODEV_DRIVER_ALSA ); + + aopts = &dev->u.alsa; +alsa_init_per_direction (aopts->in); +alsa_init_per_direction (aopts->out); + +/* +* need to define them, as otherwise alsa produces no sound +* doesn't set has_* so alsa_open can identify it wasn't set by the user +*/ +if (!dev->u.alsa.out->has_period_length) { +/* 1024 frames assuming 44100Hz */ + dev->u.alsa.out->period_length =1024 *1000000 /44100 ; + } +if (!dev->u.alsa.out->has_buffer_length) { +/* 4096 frames assuming 44100Hz */ + dev->u.alsa.out->buffer_length =4096ll *1000000 /44100 ; + } + +/* +* OptsVisitor sets unspecified optional fields to zero, but do not depend +* on it... +*/ +if (!dev->u.alsa.in->has_period_length) { + dev->u.alsa.in->period_length =0 ; + } +if (!dev->u.alsa.in->has_buffer_length) { + dev->u.alsa.in->buffer_length =0 ; + } + +return dev; }static void alsa_audio_fini (void *opaque) { -g_free (opaque); } -static struct audio_option alsa_options[] = { - { - .name ="DAC_SIZE_IN_USEC" , - .tag =AUD_OPT_BOOL , - .valp = &glob_conf.size_in_usec_out, - .descr ="DAC period/buffer size in microseconds (otherwise in frames)" - }, - { - .name ="DAC_PERIOD_SIZE" , - .tag =AUD_OPT_INT , - .valp = &glob_conf.period_size_out, - .descr ="DAC period size (0 to go with system default)" , - .overriddenp = &glob_conf.period_size_out_overridden - }, - { - .name ="DAC_BUFFER_SIZE" , - .tag =AUD_OPT_INT , - .valp = &glob_conf.buffer_size_out, - .descr ="DAC buffer size (0 to go with system default)" , - .overriddenp = &glob_conf.buffer_size_out_overridden - }, - { - .name ="ADC_SIZE_IN_USEC" , - .tag =AUD_OPT_BOOL , - .valp = &glob_conf.size_in_usec_in, - .descr = -"ADC period/buffer size in microseconds (otherwise in frames)" - }, - { - .name ="ADC_PERIOD_SIZE" , - .tag =AUD_OPT_INT , - .valp = &glob_conf.period_size_in, - .descr ="ADC period size (0 to go with system default)" , - .overriddenp = &glob_conf.period_size_in_overridden - }, - { - .name ="ADC_BUFFER_SIZE" , - .tag =AUD_OPT_INT , - .valp = &glob_conf.buffer_size_in, - .descr ="ADC buffer size (0 to go with system default)" , - .overriddenp = &glob_conf.buffer_size_in_overridden - }, - { - .name ="THRESHOLD" , - .tag =AUD_OPT_INT , - .valp = &glob_conf.threshold, - .descr ="(undocumented)" - }, - { - .name ="DAC_DEV" , - .tag =AUD_OPT_STR , - .valp = &glob_conf.pcm_name_out, - .descr ="DAC device name (for instance dmix)" - }, - { - .name ="ADC_DEV" , - .tag =AUD_OPT_STR , - .valp = &glob_conf.pcm_name_in, - .descr ="ADC device name" - }, - {/* End of list */ } -}; -static struct audio_pcm_ops alsa_pcm_ops = { .init_out = alsa_init_out, .fini_out = alsa_fini_out,
@@ -1217,7 +1085,6 @@ static struct audio_pcm_ops alsa_pcm_ops = {static struct audio_driver alsa_audio_driver = { .name ="alsa" , .descr ="ALSA http://www.alsa-project.org" , - .options = alsa_options, .init = alsa_audio_init, .fini = alsa_audio_fini, .pcm_ops = &alsa_pcm_ops,
audio/audio_legacy.c +83 -1
103 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v6 6/14 coreaudio: port to -audiodev config
In reply to Kővágó, Zoltán--- audio/audio_legacy.c | 28 +++++++++++++++++++++++++ audio/coreaudio.c | 49 ++++++++++---------------------------------- 2 files changed, 39 insertions(+), 38 deletions(-)
audio/audio_legacy.c +28 -0
@@ -109,6 +109,17 @@ static uint32_t frames_to_usecs(uint32_t frames,return (frames *1000000 + freq /2 ) / freq; } + +static void get_frames_to_usecs (const char *env,uint32_t *dst,bool *has_dst, +AudiodevPerDirectionOptions *pdo) +{ +const char *val =getenv (env); +if (val) { + *dst =frames_to_usecs (toui32 (val), pdo); + *has_dst = true; + } +} +/* backend specific functions */ /* ALSA */ static void handle_alsa_per_direction(
@@ -156,6 +167,19 @@ static void handle_alsa(Audiodev *dev) &aopt->threshold, &aopt->has_threshold); } +/* coreaudio */ +static void handle_coreaudio (Audiodev *dev) +{ +get_frames_to_usecs ( +"QEMU_COREAUDIO_BUFFER_SIZE" , + &dev->u.coreaudio.out->buffer_length, + &dev->u.coreaudio.out->has_buffer_length, +qapi_AudiodevCoreaudioPerDirectionOptions_base (dev->u.coreaudio.out)); +get_int ("QEMU_COREAUDIO_BUFFER_COUNT" , + &dev->u.coreaudio.out->buffer_count, + &dev->u.coreaudio.out->has_buffer_count); +} +/* general */ static void handle_per_direction (AudiodevPerDirectionOptions *pdo,const char *prefix)
@@ -201,6 +225,10 @@ static AudiodevListEntry *legacy_opt(const char *drvname)handle_alsa (e->dev);break ; +case AUDIODEV_DRIVER_COREAUDIO : +handle_coreaudio (e->dev); +break ; +default :break ; }
audio/coreaudio.c +11 -38
99 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v6 7/14 dsoundaudio: port to -audiodev config
In reply to Kővágó, Zoltán--- audio/dsound_template.h | 6 ++--- audio/audio_legacy.c | 43 ++++++++++++++++++++++++++++++ audio/dsoundaudio.c | 59 ++++++++++++----------------------------- 3 files changed, 63 insertions(+), 45 deletions(-)
audio/dsound_template.h +3 -3
@@ -167,17 +167,18 @@ static int dsound_init_out(HWVoiceOut *hw, struct audsettings *as,dsound *s = drv_opaque;WAVEFORMATEX wfx;struct audsettings obt_as; -DSoundConf *conf = &s->conf;#ifdef DSBTYPE_IN const char *typ ="ADC" ;DSoundVoiceIn *ds = (DSoundVoiceIn *) hw;DSCBUFFERDESC bd;DSCBCAPS bc; +AudiodevPerDirectionOptions *pdo = s->dev->u.dsound.in;#else const char *typ ="DAC" ;DSoundVoiceOut *ds = (DSoundVoiceOut *) hw;DSBUFFERDESC bd;DSBCAPS bc; +AudiodevPerDirectionOptions *pdo = s->dev->u.dsound.out;#endif if (!s->FIELD2) {
@@ -193,8 +194,8 @@ static int dsound_init_out(HWVoiceOut *hw, struct audsettings *as,memset (&bd,0 ,sizeof (bd)); bd.dwSize =sizeof (bd); bd.lpwfxFormat = &wfx; + bd.dwBufferBytes =audio_buffer_bytes (pdo, as,92880 );#ifdef DSBTYPE_IN - bd.dwBufferBytes = conf->bufsize_in; hr = IDirectSoundCapture_CreateCaptureBuffer ( s->dsound_capture, &bd,
@@ -203,7 +204,6 @@ static int dsound_init_out(HWVoiceOut *hw, struct audsettings *as, );#else bd.dwFlags =DSBCAPS_STICKYFOCUS |DSBCAPS_GETCURRENTPOSITION2 ; - bd.dwBufferBytes = conf->bufsize_out; hr = IDirectSound_CreateSoundBuffer ( s->dsound, &bd,
audio/audio_legacy.c +43 -0
61 lines not on this page · raw message
audio/dsoundaudio.c +17 -42
125 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v6 8/14 noaudio: port to -audiodev config
In reply to Kővágó, Zoltán--- audio/noaudio.c | 1 - 1 file changed, 1 deletion(-)
audio/noaudio.c +0 -1
@@ -163,7 +163,6 @@ static struct audio_pcm_ops no_pcm_ops = {static struct audio_driver no_audio_driver = { .name ="none" , .descr ="Timer based audio emulation" , - .options =NULL , .init = no_audio_init, .fini = no_audio_fini, .pcm_ops = &no_pcm_ops,
Signature · 1 line
2.20.1
PATCH v6 9/14 ossaudio: port to -audiodev config
In reply to Kővágó, Zoltán--- audio/audio_legacy.c | 32 +++++++++ audio/ossaudio.c | 161 ++++++++++++++----------------------------- 2 files changed, 83 insertions(+), 110 deletions(-)
audio/audio_legacy.c +32 -0
@@ -219,6 +219,34 @@ static void handle_dsound(Audiodev *dev) dev->u.dsound.in); } +/* OSS */ +static void handle_oss_per_direction ( +AudiodevOssPerDirectionOptions *opdo,const char *try_poll_env, +const char *dev_env) +{ +get_bool (try_poll_env, &opdo->try_poll, &opdo->has_try_poll); +get_str (dev_env, &opdo->dev, &opdo->has_dev); + +get_bytes_to_usecs ("QEMU_OSS_FRAGSIZE" , + &opdo->buffer_length, &opdo->has_buffer_length, +qapi_AudiodevOssPerDirectionOptions_base (opdo)); +get_int ("QEMU_OSS_NFRAGS" , &opdo->buffer_count, + &opdo->has_buffer_count); +} + +static void handle_oss (Audiodev *dev) +{ +AudiodevOssOptions *oopt = &dev->u.oss; +handle_oss_per_direction (oopt->in,"QEMU_AUDIO_ADC_TRY_POLL" , +"QEMU_OSS_ADC_DEV" ); +handle_oss_per_direction (oopt->out,"QEMU_AUDIO_DAC_TRY_POLL" , +"QEMU_OSS_DAC_DEV" ); + +get_bool ("QEMU_OSS_MMAP" , &oopt->try_mmap, &oopt->has_try_mmap); +get_bool ("QEMU_OSS_EXCLUSIVE" , &oopt->exclusive, &oopt->has_exclusive); +get_int ("QEMU_OSS_POLICY" , &oopt->dsp_policy, &oopt->has_dsp_policy); +} +/* general */ static void handle_per_direction (AudiodevPerDirectionOptions *pdo,const char *prefix)
@@ -272,6 +300,10 @@ static AudiodevListEntry *legacy_opt(const char *drvname)handle_dsound (e->dev);break ; +case AUDIODEV_DRIVER_OSS : +handle_oss (e->dev); +break ; +default :break ; }
audio/ossaudio.c +51 -110
304 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v6 10/14 paaudio: port to -audiodev config
In reply to Kővágó, Zoltán--- audio/audio_legacy.c | 38 +++++++++++++++++++++ audio/paaudio.c | 81 ++++++++++++++++---------------------------- 2 files changed, 67 insertions(+), 52 deletions(-)
audio/audio_legacy.c +38 -0
@@ -127,6 +127,16 @@ static uint32_t samples_to_usecs(uint32_t samples,return frames_to_usecs (samples / channels, pdo); } +static void get_samples_to_usecs (const char *env,uint32_t *dst,bool *has_dst, +AudiodevPerDirectionOptions *pdo) +{ +const char *val =getenv (env); +if (val) { + *dst =samples_to_usecs (toui32 (val), pdo); + *has_dst = true; + } +} +static uint32_t bytes_to_usecs (uint32_t bytes,AudiodevPerDirectionOptions *pdo) {AudioFormat fmt = pdo->has_format ? pdo->format :AUDIO_FORMAT_S16 ;
@@ -247,6 +257,30 @@ static void handle_oss(Audiodev *dev)get_int ("QEMU_OSS_POLICY" , &oopt->dsp_policy, &oopt->has_dsp_policy); } +/* pulseaudio */ +static void handle_pa_per_direction ( +AudiodevPaPerDirectionOptions *ppdo,const char *env) +{ +get_str (env, &ppdo->name, &ppdo->has_name); +} + +static void handle_pa (Audiodev *dev) +{ +handle_pa_per_direction (dev->u.pa.in,"QEMU_PA_SOURCE" ); +handle_pa_per_direction (dev->u.pa.out,"QEMU_PA_SINK" ); + +get_samples_to_usecs ( +"QEMU_PA_SAMPLES" , &dev->u.pa.in->buffer_length, + &dev->u.pa.in->has_buffer_length, +qapi_AudiodevPaPerDirectionOptions_base (dev->u.pa.in)); +get_samples_to_usecs ( +"QEMU_PA_SAMPLES" , &dev->u.pa.out->buffer_length, + &dev->u.pa.out->has_buffer_length, +qapi_AudiodevPaPerDirectionOptions_base (dev->u.pa.out)); + +get_str ("QEMU_PA_SERVER" , &dev->u.pa.server, &dev->u.pa.has_server); +} +/* general */ static void handle_per_direction (AudiodevPerDirectionOptions *pdo,const char *prefix)
@@ -304,6 +338,10 @@ static AudiodevListEntry *legacy_opt(const char *drvname)handle_oss (e->dev);break ; +case AUDIODEV_DRIVER_PA : +handle_pa (e->dev); +break ; +default :break ; }
audio/paaudio.c +29 -52
191 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v6 11/14 sdlaudio: port to -audiodev config
In reply to Kővágó, Zoltán--- audio/audio_legacy.c | 12 ++++++++++++ audio/sdlaudio.c | 22 ++++------------------ 2 files changed, 16 insertions(+), 18 deletions(-)
audio/audio_legacy.c +12 -0
@@ -281,6 +281,14 @@ static void handle_pa(Audiodev *dev)get_str ("QEMU_PA_SERVER" , &dev->u.pa.server, &dev->u.pa.has_server); } +/* SDL */ +static void handle_sdl (Audiodev *dev) +{ +/* SDL is output only */ +get_samples_to_usecs ("QEMU_SDL_SAMPLES" , &dev->u.sdl.out->buffer_length, + &dev->u.sdl.out->has_buffer_length, dev->u.sdl.out); +} +/* general */ static void handle_per_direction (AudiodevPerDirectionOptions *pdo,const char *prefix)
@@ -342,6 +350,10 @@ static AudiodevListEntry *legacy_opt(const char *drvname)handle_pa (e->dev);break ; +case AUDIODEV_DRIVER_SDL : +handle_sdl (e->dev); +break ; +default :break ; }
audio/sdlaudio.c +4 -18
@@ -44,16 +44,11 @@ typedef struct SDLVoiceOut {int decr; } SDLVoiceOut; -static struct { -int nb_samples; -} conf = { - .nb_samples =1024 -}; -static struct SDLAudioState {int exit;int initialized;bool driver_created; +Audiodev *dev; } glob_sdl;typedef struct SDLAudioState SDLAudioState ;
@@ -271,7 +266,7 @@ static int sdl_init_out(HWVoiceOut *hw, struct audsettings *as, req.freq = as->freq; req.format =aud_to_sdlfmt (as->fmt); req.channels = as->nchannels; - req.samples = conf.nb_samples; + req.samples =audio_buffer_samples (s->dev->u.sdl.out, as,11610 ); req.callback = sdl_callback; req.userdata = sdl;
@@ -329,6 +324,7 @@ static void *sdl_audio_init(Audiodev *dev) } s->driver_created = true; + s->dev = dev;return s; }
@@ -338,18 +334,9 @@ static void sdl_audio_fini (void *opaque)sdl_close (s);SDL_QuitSubSystem (SDL_INIT_AUDIO ); s->driver_created = false; + s->dev =NULL ; } -static struct audio_option sdl_options[] = { - { - .name ="SAMPLES" , - .tag =AUD_OPT_INT , - .valp = &conf.nb_samples, - .descr ="Size of SDL buffer in samples" - }, - {/* End of list */ } -}; -static struct audio_pcm_ops sdl_pcm_ops = { .init_out = sdl_init_out, .fini_out = sdl_fini_out,
@@ -361,7 +348,6 @@ static struct audio_pcm_ops sdl_pcm_ops = {static struct audio_driver sdl_audio_driver = { .name ="sdl" , .descr ="SDL http://www.libsdl.org" , - .options = sdl_options, .init = sdl_audio_init, .fini = sdl_audio_fini, .pcm_ops = &sdl_pcm_ops,
Signature · 1 line
2.20.1
PATCH v6 12/14 spiceaudio: port to -audiodev config
In reply to Kővágó, Zoltán--- audio/spiceaudio.c | 5 ----- 1 file changed, 5 deletions(-)
audio/spiceaudio.c +0 -5
@@ -373,10 +373,6 @@ static int line_in_ctl (HWVoiceIn *hw, int cmd, ...)return 0 ; } -static struct audio_option audio_options[] = { - {/* end of list */ }, -}; -static struct audio_pcm_ops audio_callbacks = { .init_out = line_out_init, .fini_out = line_out_fini,
@@ -394,7 +390,6 @@ static struct audio_pcm_ops audio_callbacks = {static struct audio_driver spice_audio_driver = { .name ="spice" , .descr ="spice audio driver" , - .options = audio_options, .init = spice_audio_init, .fini = spice_audio_fini, .pcm_ops = &audio_callbacks,
Signature · 1 line
2.20.1
PATCH v6 13/14 wavaudio: port to -audiodev config
In reply to Kővágó, Zoltán--- audio/audio_legacy.c | 16 ++++++++++++ audio/wavaudio.c | 58 +++++++------------------------------------- 2 files changed, 25 insertions(+), 49 deletions(-)
audio/audio_legacy.c +16 -0
@@ -289,6 +289,18 @@ static void handle_sdl(Audiodev *dev) &dev->u.sdl.out->has_buffer_length, dev->u.sdl.out); } +/* wav */ +static void handle_wav (Audiodev *dev) +{ +get_int ("QEMU_WAV_FREQUENCY" , + &dev->u.wav.out->frequency, &dev->u.wav.out->has_frequency); +get_fmt ("QEMU_WAV_FORMAT" , &dev->u.wav.out->format, + &dev->u.wav.out->has_format); +get_int ("QEMU_WAV_DAC_FIXED_CHANNELS" , + &dev->u.wav.out->channels, &dev->u.wav.out->has_channels); +get_str ("QEMU_WAV_PATH" , &dev->u.wav.path, &dev->u.wav.has_path); +} +/* general */ static void handle_per_direction (AudiodevPerDirectionOptions *pdo,const char *prefix)
@@ -354,6 +366,10 @@ static AudiodevListEntry *legacy_opt(const char *drvname)handle_sdl (e->dev);break ; +case AUDIODEV_DRIVER_WAV : +handle_wav (e->dev); +break ; +default :break ; }
audio/wavaudio.c +9 -49
105 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v6 14/14 audio: -audiodev command line option: cleanup
In reply to Kővágó, ZoltánRemove no longer needed code.
--- audio/audio_int.h | 17 ----- audio/audio.c | 186 +--------------------------------------------- 2 files changed, 4 insertions(+), 199 deletions(-)
audio/audio_int.h +0 -17
@@ -33,22 +33,6 @@struct audio_pcm_ops ; -typedef enum { -AUD_OPT_INT , -AUD_OPT_FMT , -AUD_OPT_STR , -AUD_OPT_BOOL -}audio_option_tag_e ; - -struct audio_option { -const char *name; -audio_option_tag_e tag; -void *valp; -const char *descr; -int *overriddenp; -int overridden; -}; -struct audio_callback {void *opaque;audio_callback_fn fn;
@@ -145,7 +129,6 @@ typedef struct audio_driver audio_driver;struct audio_driver {const char *name;const char *descr; -struct audio_option *options;void *(*init) (Audiodev *);void (*fini) (void *);struct audio_pcm_ops *pcm_ops;
audio/audio.c +4 -182
225 lines not on this page · raw message
Signature · 1 line
2.20.1
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PATCH v6 00/14] Audio patches
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'77a2fc41d3 audio: -audiodev command line option: cleanup a08295d4a4 wavaudio: port to -audiodev config2b8db3b1b8 spiceaudio: port to -audiodev config b13a98214e sdlaudio: port to -audiodev configf32d4ec566 paaudio: port to -audiodev config60ef81ebee ossaudio: port to -audiodev config9361aaae4c noaudio: port to -audiodev config956b77bf8d dsoundaudio: port to -audiodev config fd47b30266 coreaudio: port to -audiodev configb2e94202ed alsaaudio: port to -audiodev config92e91a2161 audio: -audiodev command line option basic implementation 7597a04f3e audio: -audiodev command line option: documentation 9df02ffc44 audio: use qapi AudioFormat instead of audfmt_e 454e5ebb1c qapi: qapi for audio backends
=== OUTPUT BEGIN ===
1/14 Checking commit 454e5ebb1c11 (qapi: qapi for audio backends)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #51:
new file mode 100644
total: 0 errors, 1 warnings, 320 lines checked
Patch 1/14 has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
2/14 Checking commit 9df02ffc443d (audio: use qapi AudioFormat instead of audfmt_e)
ERROR: space prohibited between function name and open parenthesis '(' #36: FILE: audio/alsaaudio.c:297:
+static snd_pcm_format_t aud_to_alsafmt (AudioFormat fmt, int endianness)
ERROR: space prohibited between function name and open parenthesis '(' #84: FILE: audio/alsaaudio.c:347:
+static int alsa_to_audfmt (snd_pcm_format_t alsafmt, AudioFormat *fmt,
ERROR: space prohibited between function name and open parenthesis '(' #205: FILE: audio/audio.c:260:
+static const char *audio_audfmt_to_string (AudioFormat fmt)
ERROR: space prohibited between function name and open parenthesis '(' #241: FILE: audio/audio.c:289:
+static AudioFormat audio_string_to_audfmt (const char *s, AudioFormat defval,
ERROR: space prohibited between function name and open parenthesis '(' #282: FILE: audio/audio.c:324:
+static AudioFormat audio_get_conf_fmt (const char *envname,
ERROR: space prohibited between function name and open parenthesis '(' #523: FILE: audio/ossaudio.c:151:
+static int aud_to_ossfmt (AudioFormat fmt, int endianness)
ERROR: space prohibited between function name and open parenthesis '(' #553: FILE: audio/ossaudio.c:185:
+static int oss_to_audfmt (int ossfmt, AudioFormat *fmt, int *endianness)
ERROR: space prohibited between function name and open parenthesis '(' #620: FILE: audio/paaudio.c:388:
+static pa_sample_format_t audfmt_to_pa (AudioFormat afmt, int endianness)
ERROR: space prohibited between function name and open parenthesis '(' #649: FILE: audio/paaudio.c:413:
+static AudioFormat pa_to_audfmt (pa_sample_format_t fmt, int *endianness)
ERROR: space prohibited between function name and open parenthesis '(' #687: FILE: audio/sdlaudio.c:71:
+static int aud_to_sdlfmt (AudioFormat fmt)
ERROR: trailing statements should be on next line
#954: FILE: hw/audio/hda-codec.c:102:
+ case AC_FMT_BITS_8: as->fmt = AUDIO_FORMAT_S8; break;
ERROR: trailing statements should be on next line
#955: FILE: hw/audio/hda-codec.c:103:
+ case AC_FMT_BITS_16: as->fmt = AUDIO_FORMAT_S16; break;
ERROR: trailing statements should be on next line
#956: FILE: hw/audio/hda-codec.c:104:
+ case AC_FMT_BITS_32: as->fmt = AUDIO_FORMAT_S32; break;
ERROR: space prohibited after that open square bracket '[' #970: FILE: hw/audio/hda-codec.c:137:
+ [ AUDIO_FORMAT_U8 ] = "PCM-U8",
ERROR: space prohibited before that close square bracket ']' #970: FILE: hw/audio/hda-codec.c:137:
+ [ AUDIO_FORMAT_U8 ] = "PCM-U8",
ERROR: space prohibited after that open square bracket '[' #971: FILE: hw/audio/hda-codec.c:138:
+ [ AUDIO_FORMAT_S8 ] = "PCM-S8",
ERROR: space prohibited before that close square bracket ']' #971: FILE: hw/audio/hda-codec.c:138:
+ [ AUDIO_FORMAT_S8 ] = "PCM-S8",
ERROR: space prohibited after that open square bracket '[' #972: FILE: hw/audio/hda-codec.c:139:
+ [ AUDIO_FORMAT_U16 ] = "PCM-U16",
ERROR: space prohibited before that close square bracket ']' #972: FILE: hw/audio/hda-codec.c:139:
+ [ AUDIO_FORMAT_U16 ] = "PCM-U16",
ERROR: space prohibited after that open square bracket '[' #973: FILE: hw/audio/hda-codec.c:140:
+ [ AUDIO_FORMAT_S16 ] = "PCM-S16",
ERROR: space prohibited before that close square bracket ']' #973: FILE: hw/audio/hda-codec.c:140:
+ [ AUDIO_FORMAT_S16 ] = "PCM-S16",
ERROR: space prohibited after that open square bracket '[' #974: FILE: hw/audio/hda-codec.c:141:
+ [ AUDIO_FORMAT_U32 ] = "PCM-U32",
ERROR: space prohibited before that close square bracket ']' #974: FILE: hw/audio/hda-codec.c:141:
+ [ AUDIO_FORMAT_U32 ] = "PCM-U32",
ERROR: space prohibited after that open square bracket '[' #975: FILE: hw/audio/hda-codec.c:142:
+ [ AUDIO_FORMAT_S32 ] = "PCM-S32",
ERROR: space prohibited before that close square bracket ']' #975: FILE: hw/audio/hda-codec.c:142:
+ [ AUDIO_FORMAT_S32 ] = "PCM-S32",
ERROR: trailing statements should be on next line
#1197: FILE: ui/vnc.c:2372:
+ case 0: vs->as.fmt = AUDIO_FORMAT_U8; break;
ERROR: trailing statements should be on next line
#1198: FILE: ui/vnc.c:2373:
+ case 1: vs->as.fmt = AUDIO_FORMAT_S8; break;
ERROR: trailing statements should be on next line
#1199: FILE: ui/vnc.c:2374:
+ case 2: vs->as.fmt = AUDIO_FORMAT_U16; break;
ERROR: trailing statements should be on next line
#1200: FILE: ui/vnc.c:2375:
+ case 3: vs->as.fmt = AUDIO_FORMAT_S16; break;
ERROR: trailing statements should be on next line
#1201: FILE: ui/vnc.c:2376:
+ case 4: vs->as.fmt = AUDIO_FORMAT_U32; break;
ERROR: trailing statements should be on next line
#1202: FILE: ui/vnc.c:2377:
+ case 5: vs->as.fmt = AUDIO_FORMAT_S32; break;
total: 31 errors, 0 warnings, 1028 lines checked
Patch 2/14 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
3/14 Checking commit 7597a04f3e28 (audio: -audiodev command line option: documentation) 4/14 Checking commit 92e91a2161ed (audio: -audiodev command line option basic implementation)
ERROR: Macros with multiple statements should be enclosed in a do - while loop #703: FILE: audio/audio.c:1822:
+#define CASE(DRIVER, driver, pdo_name) \
+ case AUDIODEV_DRIVER_##DRIVER: \
+ if (!dev->u.driver.has_in) { \
+ dev->u.driver.in = g_malloc0( \
+ sizeof(Audiodev##pdo_name##PerDirectionOptions)); \
+ dev->u.driver.has_in = true; \
+ } \
+ if (!dev->u.driver.has_out) { \
+ dev->u.driver.out = g_malloc0( \
+ sizeof(AudiodevAlsaPerDirectionOptions)); \
+ dev->u.driver.has_out = true; \
+ } \+ break
ERROR: externs should be avoided in .c files
#715: FILE: audio/audio.c:1834:
+ break
ERROR: space prohibited before that close parenthesis ')' #717: FILE: audio/audio.c:1836:
+ CASE(NONE, none, );
ERROR: space prohibited before that close parenthesis ')' #720: FILE: audio/audio.c:1839:
+ CASE(DSOUND, dsound, );
ERROR: space prohibited before that close parenthesis ')' #723: FILE: audio/audio.c:1842:
+ CASE(SDL, sdl, );
ERROR: space prohibited before that close parenthesis ')' #724: FILE: audio/audio.c:1843:
+ CASE(SPICE, spice, );
ERROR: space prohibited before that close parenthesis ')' #725: FILE: audio/audio.c:1844:
+ CASE(WAV, wav, );
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #970:
new file mode 100644
total: 7 errors, 1 warnings, 1346 lines checked
Patch 4/14 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
5/14 Checking commit b2e94202edce (alsaaudio: port to -audiodev config) 6/14 Checking commit fd47b30266b0 (coreaudio: port to -audiodev config) 7/14 Checking commit 956b77bf8deb (dsoundaudio: port to -audiodev config) 8/14 Checking commit 9361aaae4c0c (noaudio: port to -audiodev config) 9/14 Checking commit 60ef81ebee86 (ossaudio: port to -audiodev config) 10/14 Checking commit f32d4ec5660e (paaudio: port to -audiodev config) 11/14 Checking commit b13a98214e5d (sdlaudio: port to -audiodev config) 12/14 Checking commit 2b8db3b1b8a0 (spiceaudio: port to -audiodev config) 13/14 Checking commit a08295d4a4c6 (wavaudio: port to -audiodev config) 14/14 Checking commit 77a2fc41d3b9 (audio: -audiodev command line option: cleanup) === OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]