* [Qemu-devel] [PATCH v2 0/4] Use C99 struct initializers in audio/*
@ 2009-07-28 8:56 Juan Quintela
2009-07-28 8:56 ` [Qemu-devel] [PATCH 1/4] Use proper struct initializers and remove INIT_FIELD() macro Juan Quintela
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Juan Quintela @ 2009-07-28 8:56 UTC (permalink / raw)
To: qemu-devel; +Cc: aliguori
Hi
Cleanup all audio/* using C99 struct initializers, remove INIT_FIELD() once there.
v2:
- changed vertical alignment of '=' signs, as requested by malc
Later, Juan.
Juan Quintela (4):
Use proper struct initializers and remove INIT_FIELD() macro
use C99 initializers for audio_pcm_ops
Use C99 initializers for audio_option
use C99 initializers for all audio/*
audio/alsaaudio.c | 141 ++++++++++++++++++++++++++++------------------
audio/audio.c | 109 ++++++++++++++++++++++--------------
audio/audio_int.h | 2 -
audio/coreaudio.c | 57 ++++++++++---------
audio/dsoundaudio.c | 139 ++++++++++++++++++++++++++++------------------
audio/esdaudio.c | 87 ++++++++++++++++-------------
audio/fmodaudio.c | 154 ++++++++++++++++++++++++++++++++------------------
audio/noaudio.c | 44 +++++++-------
audio/ossaudio.c | 99 ++++++++++++++++++++------------
audio/paaudio.c | 94 +++++++++++++++++--------------
audio/sdlaudio.c | 51 ++++++++---------
audio/wavaudio.c | 83 ++++++++++++++-------------
12 files changed, 617 insertions(+), 443 deletions(-)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH 1/4] Use proper struct initializers and remove INIT_FIELD() macro
2009-07-28 8:56 [Qemu-devel] [PATCH v2 0/4] Use C99 struct initializers in audio/* Juan Quintela
@ 2009-07-28 8:56 ` Juan Quintela
2009-07-28 8:56 ` [Qemu-devel] [PATCH 2/4] use C99 initializers for audio_pcm_ops Juan Quintela
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Juan Quintela @ 2009-07-28 8:56 UTC (permalink / raw)
To: qemu-devel; +Cc: aliguori
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
audio/alsaaudio.c | 22 +++++++++++-----------
audio/audio_int.h | 2 --
audio/coreaudio.c | 23 +++++++++++------------
audio/dsoundaudio.c | 23 +++++++++++------------
audio/esdaudio.c | 23 +++++++++++------------
audio/fmodaudio.c | 22 +++++++++++-----------
audio/noaudio.c | 22 +++++++++++-----------
audio/ossaudio.c | 22 +++++++++++-----------
audio/paaudio.c | 22 +++++++++++-----------
audio/sdlaudio.c | 22 +++++++++++-----------
audio/wavaudio.c | 23 +++++++++++------------
11 files changed, 110 insertions(+), 116 deletions(-)
diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c
index d0b7cd0..694c484 100644
--- a/audio/alsaaudio.c
+++ b/audio/alsaaudio.c
@@ -938,15 +938,15 @@ static struct audio_pcm_ops alsa_pcm_ops = {
};
struct audio_driver alsa_audio_driver = {
- INIT_FIELD (name = ) "alsa",
- INIT_FIELD (descr = ) "ALSA http://www.alsa-project.org",
- INIT_FIELD (options = ) alsa_options,
- INIT_FIELD (init = ) alsa_audio_init,
- INIT_FIELD (fini = ) alsa_audio_fini,
- INIT_FIELD (pcm_ops = ) &alsa_pcm_ops,
- INIT_FIELD (can_be_default = ) 1,
- INIT_FIELD (max_voices_out = ) INT_MAX,
- INIT_FIELD (max_voices_in = ) INT_MAX,
- INIT_FIELD (voice_size_out = ) sizeof (ALSAVoiceOut),
- INIT_FIELD (voice_size_in = ) sizeof (ALSAVoiceIn)
+ .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,
+ .can_be_default = 1,
+ .max_voices_out = INT_MAX,
+ .max_voices_in = INT_MAX,
+ .voice_size_out = sizeof (ALSAVoiceOut),
+ .voice_size_in = sizeof (ALSAVoiceIn)
};
diff --git a/audio/audio_int.h b/audio/audio_int.h
index 0abed38..f3cd0be 100644
--- a/audio/audio_int.h
+++ b/audio/audio_int.h
@@ -232,11 +232,9 @@ static inline int audio_ring_dist (int dst, int src, int len)
#if defined __GNUC__
#define GCC_ATTR __attribute__ ((__unused__, __format__ (__printf__, 1, 2)))
-#define INIT_FIELD(f) . f
#define GCC_FMT_ATTR(n, m) __attribute__ ((__format__ (__printf__, n, m)))
#else
#define GCC_ATTR /**/
-#define INIT_FIELD(f) /**/
#define GCC_FMT_ATTR(n, m)
#endif
diff --git a/audio/coreaudio.c b/audio/coreaudio.c
index 9671429..c46b357 100644
--- a/audio/coreaudio.c
+++ b/audio/coreaudio.c
@@ -535,16 +535,15 @@ static struct audio_pcm_ops coreaudio_pcm_ops = {
};
struct audio_driver coreaudio_audio_driver = {
- INIT_FIELD (name = ) "coreaudio",
- INIT_FIELD (descr = )
- "CoreAudio http://developer.apple.com/audio/coreaudio.html",
- INIT_FIELD (options = ) coreaudio_options,
- INIT_FIELD (init = ) coreaudio_audio_init,
- INIT_FIELD (fini = ) coreaudio_audio_fini,
- INIT_FIELD (pcm_ops = ) &coreaudio_pcm_ops,
- INIT_FIELD (can_be_default = ) 1,
- INIT_FIELD (max_voices_out = ) 1,
- INIT_FIELD (max_voices_in = ) 0,
- INIT_FIELD (voice_size_out = ) sizeof (coreaudioVoiceOut),
- INIT_FIELD (voice_size_in = ) 0
+ .name = "coreaudio",
+ .descr = "CoreAudio http://developer.apple.com/audio/coreaudio.html",
+ .options = coreaudio_options,
+ .init = coreaudio_audio_init,
+ .fini = coreaudio_audio_fini,
+ .pcm_ops = &coreaudio_pcm_ops,
+ .can_be_default = 1,
+ .max_voices_out = 1,
+ .max_voices_in = 0,
+ .voice_size_out = sizeof (coreaudioVoiceOut),
+ .voice_size_in = 0
};
diff --git a/audio/dsoundaudio.c b/audio/dsoundaudio.c
index a78c856..7c08790 100644
--- a/audio/dsoundaudio.c
+++ b/audio/dsoundaudio.c
@@ -1073,16 +1073,15 @@ static struct audio_pcm_ops dsound_pcm_ops = {
};
struct audio_driver dsound_audio_driver = {
- INIT_FIELD (name = ) "dsound",
- INIT_FIELD (descr = )
- "DirectSound http://wikipedia.org/wiki/DirectSound",
- INIT_FIELD (options = ) dsound_options,
- INIT_FIELD (init = ) dsound_audio_init,
- INIT_FIELD (fini = ) dsound_audio_fini,
- INIT_FIELD (pcm_ops = ) &dsound_pcm_ops,
- INIT_FIELD (can_be_default = ) 1,
- INIT_FIELD (max_voices_out = ) INT_MAX,
- INIT_FIELD (max_voices_in = ) 1,
- INIT_FIELD (voice_size_out = ) sizeof (DSoundVoiceOut),
- INIT_FIELD (voice_size_in = ) sizeof (DSoundVoiceIn)
+ .name = "dsound",
+ .descr = "DirectSound http://wikipedia.org/wiki/DirectSound",
+ .options = dsound_options,
+ .init = dsound_audio_init,
+ .fini = dsound_audio_fini,
+ .pcm_ops = &dsound_pcm_ops,
+ .can_be_default = 1,
+ .max_voices_out = INT_MAX,
+ .max_voices_in = 1,
+ .voice_size_out = sizeof (DSoundVoiceOut),
+ .oice_size_in = sizeof (DSoundVoiceIn)
};
diff --git a/audio/esdaudio.c b/audio/esdaudio.c
index 0102c5a..ff6725e 100644
--- a/audio/esdaudio.c
+++ b/audio/esdaudio.c
@@ -581,16 +581,15 @@ static struct audio_pcm_ops qesd_pcm_ops = {
};
struct audio_driver esd_audio_driver = {
- INIT_FIELD (name = ) "esd",
- INIT_FIELD (descr = )
- "http://en.wikipedia.org/wiki/Esound",
- INIT_FIELD (options = ) qesd_options,
- INIT_FIELD (init = ) qesd_audio_init,
- INIT_FIELD (fini = ) qesd_audio_fini,
- INIT_FIELD (pcm_ops = ) &qesd_pcm_ops,
- INIT_FIELD (can_be_default = ) 0,
- INIT_FIELD (max_voices_out = ) INT_MAX,
- INIT_FIELD (max_voices_in = ) INT_MAX,
- INIT_FIELD (voice_size_out = ) sizeof (ESDVoiceOut),
- INIT_FIELD (voice_size_in = ) sizeof (ESDVoiceIn)
+ .name = "esd",
+ .descr = "http://en.wikipedia.org/wiki/Esound",
+ .options = qesd_options,
+ .init = qesd_audio_init,
+ .fini = qesd_audio_fini,
+ .pcm_ops = &qesd_pcm_ops,
+ .can_be_default = 0,
+ .max_voices_out = INT_MAX,
+ .max_voices_in = INT_MAX,
+ .voice_size_out = sizeof (ESDVoiceOut),
+ .voice_size_in = sizeof (ESDVoiceIn)
};
diff --git a/audio/fmodaudio.c b/audio/fmodaudio.c
index 0becd3b..8259551 100644
--- a/audio/fmodaudio.c
+++ b/audio/fmodaudio.c
@@ -672,15 +672,15 @@ static struct audio_pcm_ops fmod_pcm_ops = {
};
struct audio_driver fmod_audio_driver = {
- INIT_FIELD (name = ) "fmod",
- INIT_FIELD (descr = ) "FMOD 3.xx http://www.fmod.org",
- INIT_FIELD (options = ) fmod_options,
- INIT_FIELD (init = ) fmod_audio_init,
- INIT_FIELD (fini = ) fmod_audio_fini,
- INIT_FIELD (pcm_ops = ) &fmod_pcm_ops,
- INIT_FIELD (can_be_default = ) 1,
- INIT_FIELD (max_voices_out = ) INT_MAX,
- INIT_FIELD (max_voices_in = ) INT_MAX,
- INIT_FIELD (voice_size_out = ) sizeof (FMODVoiceOut),
- INIT_FIELD (voice_size_in = ) sizeof (FMODVoiceIn)
+ .name = "fmod",
+ .descr = "FMOD 3.xx http://www.fmod.org",
+ .options = fmod_options,
+ .init = fmod_audio_init,
+ .fini = fmod_audio_fini,
+ .pcm_ops = &fmod_pcm_ops,
+ .can_be_default = 1,
+ .max_voices_out = INT_MAX,
+ .max_voices_in = INT_MAX,
+ .voice_size_out = sizeof (FMODVoiceOut),
+ .voice_size_in = sizeof (FMODVoiceIn)
};
diff --git a/audio/noaudio.c b/audio/noaudio.c
index 9432413..1a7529a 100644
--- a/audio/noaudio.c
+++ b/audio/noaudio.c
@@ -160,15 +160,15 @@ static struct audio_pcm_ops no_pcm_ops = {
};
struct audio_driver no_audio_driver = {
- INIT_FIELD (name = ) "none",
- INIT_FIELD (descr = ) "Timer based audio emulation",
- INIT_FIELD (options = ) NULL,
- INIT_FIELD (init = ) no_audio_init,
- INIT_FIELD (fini = ) no_audio_fini,
- INIT_FIELD (pcm_ops = ) &no_pcm_ops,
- INIT_FIELD (can_be_default = ) 1,
- INIT_FIELD (max_voices_out = ) INT_MAX,
- INIT_FIELD (max_voices_in = ) INT_MAX,
- INIT_FIELD (voice_size_out = ) sizeof (NoVoiceOut),
- INIT_FIELD (voice_size_in = ) sizeof (NoVoiceIn)
+ .name = "none",
+ .descr = "Timer based audio emulation",
+ .options = NULL,
+ .init = no_audio_init,
+ .fini = no_audio_fini,
+ .pcm_ops = &no_pcm_ops,
+ .can_be_default = 1,
+ .max_voices_out = INT_MAX,
+ .max_voices_in = INT_MAX,
+ .voice_size_out = sizeof (NoVoiceOut),
+ .voice_size_in = sizeof (NoVoiceIn)
};
diff --git a/audio/ossaudio.c b/audio/ossaudio.c
index 0236c2e..11b834a 100644
--- a/audio/ossaudio.c
+++ b/audio/ossaudio.c
@@ -766,15 +766,15 @@ static struct audio_pcm_ops oss_pcm_ops = {
};
struct audio_driver oss_audio_driver = {
- INIT_FIELD (name = ) "oss",
- INIT_FIELD (descr = ) "OSS http://www.opensound.com",
- INIT_FIELD (options = ) oss_options,
- INIT_FIELD (init = ) oss_audio_init,
- INIT_FIELD (fini = ) oss_audio_fini,
- INIT_FIELD (pcm_ops = ) &oss_pcm_ops,
- INIT_FIELD (can_be_default = ) 1,
- INIT_FIELD (max_voices_out = ) INT_MAX,
- INIT_FIELD (max_voices_in = ) INT_MAX,
- INIT_FIELD (voice_size_out = ) sizeof (OSSVoiceOut),
- INIT_FIELD (voice_size_in = ) sizeof (OSSVoiceIn)
+ .name = "oss",
+ .descr = "OSS http://www.opensound.com",
+ .options = oss_options,
+ .init = oss_audio_init,
+ .fini = oss_audio_fini,
+ .pcm_ops = &oss_pcm_ops,
+ .can_be_default = 1,
+ .max_voices_out = INT_MAX,
+ .max_voices_in = INT_MAX,
+ .voice_size_out = sizeof (OSSVoiceOut),
+ .voice_size_in = sizeof (OSSVoiceIn)
};
diff --git a/audio/paaudio.c b/audio/paaudio.c
index a50fccc..0b469cf 100644
--- a/audio/paaudio.c
+++ b/audio/paaudio.c
@@ -501,15 +501,15 @@ static struct audio_pcm_ops qpa_pcm_ops = {
};
struct audio_driver pa_audio_driver = {
- INIT_FIELD (name = ) "pa",
- INIT_FIELD (descr = ) "http://www.pulseaudio.org/",
- INIT_FIELD (options = ) qpa_options,
- INIT_FIELD (init = ) qpa_audio_init,
- INIT_FIELD (fini = ) qpa_audio_fini,
- INIT_FIELD (pcm_ops = ) &qpa_pcm_ops,
- INIT_FIELD (can_be_default = ) 0,
- INIT_FIELD (max_voices_out = ) INT_MAX,
- INIT_FIELD (max_voices_in = ) INT_MAX,
- INIT_FIELD (voice_size_out = ) sizeof (PAVoiceOut),
- INIT_FIELD (voice_size_in = ) sizeof (PAVoiceIn)
+ .name = "pa",
+ .descr = "http://www.pulseaudio.org/",
+ .options = qpa_options,
+ .init = qpa_audio_init,
+ .fini = qpa_audio_fini,
+ .pcm_ops = &qpa_pcm_ops,
+ .can_be_default = 0,
+ .max_voices_out = INT_MAX,
+ .max_voices_in = INT_MAX,
+ .voice_size_out = sizeof (PAVoiceOut),
+ .voice_size_in = sizeof (PAVoiceIn)
};
diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c
index 5d6fc24..d47ed2e 100644
--- a/audio/sdlaudio.c
+++ b/audio/sdlaudio.c
@@ -440,15 +440,15 @@ static struct audio_pcm_ops sdl_pcm_ops = {
};
struct audio_driver sdl_audio_driver = {
- INIT_FIELD (name = ) "sdl",
- INIT_FIELD (descr = ) "SDL http://www.libsdl.org",
- INIT_FIELD (options = ) sdl_options,
- INIT_FIELD (init = ) sdl_audio_init,
- INIT_FIELD (fini = ) sdl_audio_fini,
- INIT_FIELD (pcm_ops = ) &sdl_pcm_ops,
- INIT_FIELD (can_be_default = ) 1,
- INIT_FIELD (max_voices_out = ) 1,
- INIT_FIELD (max_voices_in = ) 0,
- INIT_FIELD (voice_size_out = ) sizeof (SDLVoiceOut),
- INIT_FIELD (voice_size_in = ) 0
+ .name = "sdl",
+ .descr = "SDL http://www.libsdl.org",
+ .options = sdl_options,
+ .init = sdl_audio_init,
+ .fini = sdl_audio_fini,
+ .pcm_ops = &sdl_pcm_ops,
+ .can_be_default = 1,
+ .max_voices_out = 1,
+ .max_voices_in = 0,
+ .voice_size_out = sizeof (SDLVoiceOut),
+ .voice_size_in = 0
};
diff --git a/audio/wavaudio.c b/audio/wavaudio.c
index e50dac2..96cc49d 100644
--- a/audio/wavaudio.c
+++ b/audio/wavaudio.c
@@ -248,16 +248,15 @@ static struct audio_pcm_ops wav_pcm_ops = {
};
struct audio_driver wav_audio_driver = {
- INIT_FIELD (name = ) "wav",
- INIT_FIELD (descr = )
- "WAV renderer http://wikipedia.org/wiki/WAV",
- INIT_FIELD (options = ) wav_options,
- INIT_FIELD (init = ) wav_audio_init,
- INIT_FIELD (fini = ) wav_audio_fini,
- INIT_FIELD (pcm_ops = ) &wav_pcm_ops,
- INIT_FIELD (can_be_default = ) 0,
- INIT_FIELD (max_voices_out = ) 1,
- INIT_FIELD (max_voices_in = ) 0,
- INIT_FIELD (voice_size_out = ) sizeof (WAVVoiceOut),
- INIT_FIELD (voice_size_in = ) 0
+ .name = "wav",
+ .descr = "WAV renderer http://wikipedia.org/wiki/WAV",
+ .options = wav_options,
+ .init = wav_audio_init,
+ .fini = wav_audio_fini,
+ .pcm_ops = &wav_pcm_ops,
+ .can_be_default = 0,
+ .max_voices_out = 1,
+ .max_voices_in = 0,
+ .voice_size_out = sizeof (WAVVoiceOut),
+ .voice_size_in = 0
};
--
1.6.2.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH 2/4] use C99 initializers for audio_pcm_ops
2009-07-28 8:56 [Qemu-devel] [PATCH v2 0/4] Use C99 struct initializers in audio/* Juan Quintela
2009-07-28 8:56 ` [Qemu-devel] [PATCH 1/4] Use proper struct initializers and remove INIT_FIELD() macro Juan Quintela
@ 2009-07-28 8:56 ` Juan Quintela
2009-07-28 8:56 ` [Qemu-devel] [PATCH 3/4] Use C99 initializers for audio_option Juan Quintela
2009-07-28 8:56 ` [Qemu-devel] [PATCH 4/4] use C99 initializers for all audio/* Juan Quintela
3 siblings, 0 replies; 5+ messages in thread
From: Juan Quintela @ 2009-07-28 8:56 UTC (permalink / raw)
To: qemu-devel; +Cc: aliguori
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
audio/alsaaudio.c | 22 +++++++++++-----------
audio/coreaudio.c | 16 +++++-----------
audio/dsoundaudio.c | 22 +++++++++++-----------
audio/esdaudio.c | 22 +++++++++++-----------
audio/fmodaudio.c | 22 +++++++++++-----------
audio/noaudio.c | 22 +++++++++++-----------
audio/ossaudio.c | 22 +++++++++++-----------
audio/paaudio.c | 21 +++++++++++----------
audio/sdlaudio.c | 16 +++++-----------
audio/wavaudio.c | 16 +++++-----------
10 files changed, 92 insertions(+), 109 deletions(-)
diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c
index 694c484..5794c59 100644
--- a/audio/alsaaudio.c
+++ b/audio/alsaaudio.c
@@ -924,17 +924,17 @@ static struct audio_option alsa_options[] = {
};
static struct audio_pcm_ops alsa_pcm_ops = {
- alsa_init_out,
- alsa_fini_out,
- alsa_run_out,
- alsa_write,
- alsa_ctl_out,
-
- alsa_init_in,
- alsa_fini_in,
- alsa_run_in,
- alsa_read,
- alsa_ctl_in
+ .init_out = alsa_init_out,
+ .fini_out = alsa_fini_out,
+ .run_out = alsa_run_out,
+ .write = alsa_write,
+ .ctl_out = alsa_ctl_out,
+
+ .init_in = alsa_init_in,
+ .fini_in = alsa_fini_in,
+ .run_in = alsa_run_in,
+ .read = alsa_read,
+ .ctl_in = alsa_ctl_in
};
struct audio_driver alsa_audio_driver = {
diff --git a/audio/coreaudio.c b/audio/coreaudio.c
index c46b357..9a9754d 100644
--- a/audio/coreaudio.c
+++ b/audio/coreaudio.c
@@ -521,17 +521,11 @@ static struct audio_option coreaudio_options[] = {
};
static struct audio_pcm_ops coreaudio_pcm_ops = {
- coreaudio_init_out,
- coreaudio_fini_out,
- coreaudio_run_out,
- coreaudio_write,
- coreaudio_ctl_out,
-
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
+ .init_out = coreaudio_init_out,
+ .fini_out = coreaudio_fini_out,
+ .run_out = coreaudio_run_out,
+ .write = coreaudio_write,
+ .ctl_out = coreaudio_ctl_out
};
struct audio_driver coreaudio_audio_driver = {
diff --git a/audio/dsoundaudio.c b/audio/dsoundaudio.c
index 7c08790..a8edfee 100644
--- a/audio/dsoundaudio.c
+++ b/audio/dsoundaudio.c
@@ -1059,17 +1059,17 @@ static struct audio_option dsound_options[] = {
};
static struct audio_pcm_ops dsound_pcm_ops = {
- dsound_init_out,
- dsound_fini_out,
- dsound_run_out,
- dsound_write,
- dsound_ctl_out,
-
- dsound_init_in,
- dsound_fini_in,
- dsound_run_in,
- dsound_read,
- dsound_ctl_in
+ .init_out = dsound_init_out,
+ .fini_out = dsound_fini_out,
+ .run_out = dsound_run_out,
+ .write = dsound_write,
+ .ctl_out = dsound_ctl_out,
+
+ .init_in = dsound_init_in,
+ .fini_in = dsound_fini_in,
+ .run_in = dsound_run_in,
+ .read = dsound_read,
+ .ctl_in = dsound_ctl_in
};
struct audio_driver dsound_audio_driver = {
diff --git a/audio/esdaudio.c b/audio/esdaudio.c
index ff6725e..29f4ffc 100644
--- a/audio/esdaudio.c
+++ b/audio/esdaudio.c
@@ -567,17 +567,17 @@ struct audio_option qesd_options[] = {
};
static struct audio_pcm_ops qesd_pcm_ops = {
- qesd_init_out,
- qesd_fini_out,
- qesd_run_out,
- qesd_write,
- qesd_ctl_out,
-
- qesd_init_in,
- qesd_fini_in,
- qesd_run_in,
- qesd_read,
- qesd_ctl_in,
+ .init_out = qesd_init_out,
+ .fini_out = qesd_fini_out,
+ .run_out = qesd_run_out,
+ .write = qesd_write,
+ .ctl_out = qesd_ctl_out,
+
+ .init_in = qesd_init_in,
+ .fini_in = qesd_fini_in,
+ .run_in = qesd_run_in,
+ .read = qesd_read,
+ .ctl_in = qesd_ctl_in,
};
struct audio_driver esd_audio_driver = {
diff --git a/audio/fmodaudio.c b/audio/fmodaudio.c
index 8259551..83a6454 100644
--- a/audio/fmodaudio.c
+++ b/audio/fmodaudio.c
@@ -658,17 +658,17 @@ static struct audio_option fmod_options[] = {
};
static struct audio_pcm_ops fmod_pcm_ops = {
- fmod_init_out,
- fmod_fini_out,
- fmod_run_out,
- fmod_write,
- fmod_ctl_out,
-
- fmod_init_in,
- fmod_fini_in,
- fmod_run_in,
- fmod_read,
- fmod_ctl_in
+ .init_out = fmod_init_out,
+ .fini_out = fmod_fini_out,
+ .run_out = fmod_run_out,
+ .write = fmod_write,
+ .ctl_out = fmod_ctl_out,
+
+ .init_in = fmod_init_in,
+ .fini_in = fmod_fini_in,
+ .run_in = fmod_run_in,
+ .read = fmod_read,
+ .ctl_in = fmod_ctl_in
};
struct audio_driver fmod_audio_driver = {
diff --git a/audio/noaudio.c b/audio/noaudio.c
index 1a7529a..40a1a2f 100644
--- a/audio/noaudio.c
+++ b/audio/noaudio.c
@@ -146,17 +146,17 @@ static void no_audio_fini (void *opaque)
}
static struct audio_pcm_ops no_pcm_ops = {
- no_init_out,
- no_fini_out,
- no_run_out,
- no_write,
- no_ctl_out,
-
- no_init_in,
- no_fini_in,
- no_run_in,
- no_read,
- no_ctl_in
+ .init_out = no_init_out,
+ .fini_out = no_fini_out,
+ .run_out = no_run_out,
+ .write = no_write,
+ .ctl_out = no_ctl_out,
+
+ .init_in = no_init_in,
+ .fini_in = no_fini_in,
+ .run_in = no_run_in,
+ .read = no_read,
+ .ctl_in = no_ctl_in
};
struct audio_driver no_audio_driver = {
diff --git a/audio/ossaudio.c b/audio/ossaudio.c
index 11b834a..27a7ea9 100644
--- a/audio/ossaudio.c
+++ b/audio/ossaudio.c
@@ -752,17 +752,17 @@ static struct audio_option oss_options[] = {
};
static struct audio_pcm_ops oss_pcm_ops = {
- oss_init_out,
- oss_fini_out,
- oss_run_out,
- oss_write,
- oss_ctl_out,
-
- oss_init_in,
- oss_fini_in,
- oss_run_in,
- oss_read,
- oss_ctl_in
+ .init_out = oss_init_out,
+ .fini_out = oss_fini_out,
+ .run_out = oss_run_out,
+ .write = oss_write,
+ .ctl_out = oss_ctl_out,
+
+ .init_in = oss_init_in,
+ .fini_in = oss_fini_in,
+ .run_in = oss_run_in,
+ .read = oss_read,
+ .ctl_in = oss_ctl_in
};
struct audio_driver oss_audio_driver = {
diff --git a/audio/paaudio.c b/audio/paaudio.c
index 0b469cf..43b3002 100644
--- a/audio/paaudio.c
+++ b/audio/paaudio.c
@@ -488,16 +488,17 @@ struct audio_option qpa_options[] = {
};
static struct audio_pcm_ops qpa_pcm_ops = {
- qpa_init_out,
- qpa_fini_out,
- qpa_run_out,
- qpa_write,
- qpa_ctl_out,
- qpa_init_in,
- qpa_fini_in,
- qpa_run_in,
- qpa_read,
- qpa_ctl_in
+ .init_out = qpa_init_out,
+ .fini_out = qpa_fini_out,
+ .run_out = qpa_run_out,
+ .write = qpa_write,
+ .ctl_out = qpa_ctl_out,
+
+ .init_in = qpa_init_in,
+ .fini_in = qpa_fini_in,
+ .run_in = qpa_run_in,
+ .read = qpa_read,
+ .ctl_in = qpa_ctl_in
};
struct audio_driver pa_audio_driver = {
diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c
index d47ed2e..051ea8e 100644
--- a/audio/sdlaudio.c
+++ b/audio/sdlaudio.c
@@ -426,17 +426,11 @@ static struct audio_option sdl_options[] = {
};
static struct audio_pcm_ops sdl_pcm_ops = {
- sdl_init_out,
- sdl_fini_out,
- sdl_run_out,
- sdl_write_out,
- sdl_ctl_out,
-
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
+ .init_out = sdl_init_out,
+ .fini_out = sdl_fini_out,
+ .run_out = sdl_run_out,
+ .write = sdl_write_out,
+ .ctl_out = sdl_ctl_out,
};
struct audio_driver sdl_audio_driver = {
diff --git a/audio/wavaudio.c b/audio/wavaudio.c
index 96cc49d..d5585e4 100644
--- a/audio/wavaudio.c
+++ b/audio/wavaudio.c
@@ -234,17 +234,11 @@ static struct audio_option wav_options[] = {
};
static struct audio_pcm_ops wav_pcm_ops = {
- wav_init_out,
- wav_fini_out,
- wav_run_out,
- wav_write_out,
- wav_ctl_out,
-
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
+ .init_out = wav_init_out,
+ .fini_out = wav_fini_out,
+ .run_out = wav_run_out,
+ .write = wav_write_out,
+ .ctl_out = wav_ctl_out,
};
struct audio_driver wav_audio_driver = {
--
1.6.2.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH 3/4] Use C99 initializers for audio_option
2009-07-28 8:56 [Qemu-devel] [PATCH v2 0/4] Use C99 struct initializers in audio/* Juan Quintela
2009-07-28 8:56 ` [Qemu-devel] [PATCH 1/4] Use proper struct initializers and remove INIT_FIELD() macro Juan Quintela
2009-07-28 8:56 ` [Qemu-devel] [PATCH 2/4] use C99 initializers for audio_pcm_ops Juan Quintela
@ 2009-07-28 8:56 ` Juan Quintela
2009-07-28 8:56 ` [Qemu-devel] [PATCH 4/4] use C99 initializers for all audio/* Juan Quintela
3 siblings, 0 replies; 5+ messages in thread
From: Juan Quintela @ 2009-07-28 8:56 UTC (permalink / raw)
To: qemu-devel; +Cc: aliguori
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
audio/alsaaudio.c | 88 ++++++++++++++++++++++++++--------------
audio/audio.c | 109 ++++++++++++++++++++++++++++++++-------------------
audio/coreaudio.c | 18 ++++++--
audio/dsoundaudio.c | 74 +++++++++++++++++++++++++----------
audio/esdaudio.c | 36 +++++++++++------
audio/fmodaudio.c | 47 +++++++++++++++-------
audio/ossaudio.c | 46 +++++++++++++++------
audio/paaudio.c | 44 +++++++++++++-------
audio/sdlaudio.c | 11 ++++-
audio/wavaudio.c | 35 +++++++++++------
10 files changed, 339 insertions(+), 169 deletions(-)
diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c
index 5794c59..818c6a5 100644
--- a/audio/alsaaudio.c
+++ b/audio/alsaaudio.c
@@ -890,37 +890,63 @@ static void alsa_audio_fini (void *opaque)
}
static struct audio_option alsa_options[] = {
- {"DAC_SIZE_IN_USEC", AUD_OPT_BOOL, &conf.size_in_usec_out,
- "DAC period/buffer size in microseconds (otherwise in frames)", NULL, 0},
- {"DAC_PERIOD_SIZE", AUD_OPT_INT, &conf.period_size_out,
- "DAC period size (0 to go with system default)",
- &conf.period_size_out_overridden, 0},
- {"DAC_BUFFER_SIZE", AUD_OPT_INT, &conf.buffer_size_out,
- "DAC buffer size (0 to go with system default)",
- &conf.buffer_size_out_overridden, 0},
-
- {"ADC_SIZE_IN_USEC", AUD_OPT_BOOL, &conf.size_in_usec_in,
- "ADC period/buffer size in microseconds (otherwise in frames)", NULL, 0},
- {"ADC_PERIOD_SIZE", AUD_OPT_INT, &conf.period_size_in,
- "ADC period size (0 to go with system default)",
- &conf.period_size_in_overridden, 0},
- {"ADC_BUFFER_SIZE", AUD_OPT_INT, &conf.buffer_size_in,
- "ADC buffer size (0 to go with system default)",
- &conf.buffer_size_in_overridden, 0},
-
- {"THRESHOLD", AUD_OPT_INT, &conf.threshold,
- "(undocumented)", NULL, 0},
-
- {"DAC_DEV", AUD_OPT_STR, &conf.pcm_name_out,
- "DAC device name (for instance dmix)", NULL, 0},
-
- {"ADC_DEV", AUD_OPT_STR, &conf.pcm_name_in,
- "ADC device name", NULL, 0},
-
- {"VERBOSE", AUD_OPT_BOOL, &conf.verbose,
- "Behave in a more verbose way", NULL, 0},
-
- {NULL, 0, NULL, NULL, NULL, 0}
+ {
+ .name = "DAC_SIZE_IN_USEC",
+ .tag = AUD_OPT_BOOL,
+ .valp = &conf.size_in_usec_out,
+ .descr = "DAC period/buffer size in microseconds (otherwise in frames)"
+ },{
+ .name = "DAC_PERIOD_SIZE",
+ .tag = AUD_OPT_INT,
+ .valp = &conf.period_size_out,
+ .descr = "DAC period size (0 to go with system default)",
+ .overriddenp = &conf.period_size_out_overridden
+ },{
+ .name = "DAC_BUFFER_SIZE",
+ .tag = AUD_OPT_INT,
+ .valp = &conf.buffer_size_out,
+ .descr = "DAC buffer size (0 to go with system default)",
+ .overriddenp = &conf.buffer_size_out_overridden
+ },{
+ .name = "ADC_SIZE_IN_USEC",
+ .tag = AUD_OPT_BOOL,
+ .valp = &conf.size_in_usec_in,
+ .descr = "ADC period/buffer size in microseconds (otherwise in frames)"
+ },{
+ .name = "ADC_PERIOD_SIZE",
+ .tag = AUD_OPT_INT,
+ .valp = &conf.period_size_in,
+ .descr = "ADC period size (0 to go with system default)",
+ .overriddenp = &conf.period_size_in_overridden
+ },{
+ .name = "ADC_BUFFER_SIZE",
+ .tag = AUD_OPT_INT,
+ .valp = &conf.buffer_size_in,
+ .descr = "ADC buffer size (0 to go with system default)",
+ .overriddenp = &conf.buffer_size_in_overridden
+ },{
+ .name = "THRESHOLD",
+ .tag = AUD_OPT_INT,
+ .valp = &conf.threshold,
+ .descr = "(undocumented)"
+ },{
+ .name = "DAC_DEV",
+ .tag = AUD_OPT_STR,
+ .valp = &conf.pcm_name_out,
+ .descr = "DAC device name (for instance dmix)"
+ },{
+ .name = "ADC_DEV",
+ .tag = AUD_OPT_STR,
+ .valp = &conf.pcm_name_in,
+ .descr = "ADC device name"
+ },{
+ .name = "VERBOSE",
+ .tag = AUD_OPT_BOOL,
+ .valp = &conf.verbose,
+ .descr = "Behave in a more verbose way"
+ },{
+ /* End of list */
+ }
};
static struct audio_pcm_ops alsa_pcm_ops = {
diff --git a/audio/audio.c b/audio/audio.c
index 0a3830d..281d1b3 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -1492,49 +1492,76 @@ static void audio_timer (void *opaque)
}
static struct audio_option audio_options[] = {
- /* DAC */
- {"DAC_FIXED_SETTINGS", AUD_OPT_BOOL, &conf.fixed_out.enabled,
- "Use fixed settings for host DAC", NULL, 0},
-
- {"DAC_FIXED_FREQ", AUD_OPT_INT, &conf.fixed_out.settings.freq,
- "Frequency for fixed host DAC", NULL, 0},
-
- {"DAC_FIXED_FMT", AUD_OPT_FMT, &conf.fixed_out.settings.fmt,
- "Format for fixed host DAC", NULL, 0},
-
- {"DAC_FIXED_CHANNELS", AUD_OPT_INT, &conf.fixed_out.settings.nchannels,
- "Number of channels for fixed DAC (1 - mono, 2 - stereo)", NULL, 0},
-
- {"DAC_VOICES", AUD_OPT_INT, &conf.fixed_out.nb_voices,
- "Number of voices for DAC", NULL, 0},
-
+ {
+ .name = "DAC_FIXED_SETTINGS",
+ .tag = AUD_OPT_BOOL,
+ .valp = &conf.fixed_out.enabled,
+ .descr = "Use fixed settings for host DAC"
+ },{
+ .name = "DAC_FIXED_FREQ",
+ .tag = AUD_OPT_INT,
+ .valp = &conf.fixed_out.settings.freq,
+ .descr = "Frequency for fixed host DAC"
+ },{
+ .name = "DAC_FIXED_FMT",
+ .tag = AUD_OPT_FMT,
+ .valp = &conf.fixed_out.settings.fmt,
+ .descr = "Format for fixed host DAC"
+ },{
+ .name = "DAC_FIXED_CHANNELS",
+ .tag = AUD_OPT_INT,
+ .valp = &conf.fixed_out.settings.nchannels,
+ .descr = "Number of channels for fixed DAC (1 - mono, 2 - stereo)"
+ },{
+ .name = "DAC_VOICES",
+ .tag = AUD_OPT_INT,
+ .valp = &conf.fixed_out.nb_voices,
+ .descr = "Number of voices for DAC"
+ },{
/* ADC */
- {"ADC_FIXED_SETTINGS", AUD_OPT_BOOL, &conf.fixed_in.enabled,
- "Use fixed settings for host ADC", NULL, 0},
-
- {"ADC_FIXED_FREQ", AUD_OPT_INT, &conf.fixed_in.settings.freq,
- "Frequency for fixed host ADC", NULL, 0},
-
- {"ADC_FIXED_FMT", AUD_OPT_FMT, &conf.fixed_in.settings.fmt,
- "Format for fixed host ADC", NULL, 0},
-
- {"ADC_FIXED_CHANNELS", AUD_OPT_INT, &conf.fixed_in.settings.nchannels,
- "Number of channels for fixed ADC (1 - mono, 2 - stereo)", NULL, 0},
-
- {"ADC_VOICES", AUD_OPT_INT, &conf.fixed_in.nb_voices,
- "Number of voices for ADC", NULL, 0},
-
+ .name = "ADC_FIXED_SETTINGS",
+ .tag = AUD_OPT_BOOL,
+ .valp = &conf.fixed_in.enabled,
+ .descr = "Use fixed settings for host ADC"
+ },{
+ .name = "ADC_FIXED_FREQ",
+ .tag = AUD_OPT_INT,
+ .valp = &conf.fixed_in.settings.freq,
+ .descr = "Frequency for fixed host ADC"
+ },{
+ .name = "ADC_FIXED_FMT",
+ .tag = AUD_OPT_FMT,
+ .valp = &conf.fixed_in.settings.fmt,
+ .descr = "Format for fixed host ADC"
+ },{
+ .name = "ADC_FIXED_CHANNELS",
+ .tag = AUD_OPT_INT,
+ .valp = &conf.fixed_in.settings.nchannels,
+ .descr = "Number of channels for fixed ADC (1 - mono, 2 - stereo)"
+ },{
+ .name = "ADC_VOICES",
+ .tag = AUD_OPT_INT,
+ .valp = &conf.fixed_in.nb_voices,
+ .descr = "Number of voices for ADC"
+ },{
/* Misc */
- {"TIMER_PERIOD", AUD_OPT_INT, &conf.period.hertz,
- "Timer period in HZ (0 - use lowest possible)", NULL, 0},
-
- {"PLIVE", AUD_OPT_BOOL, &conf.plive,
- "(undocumented)", NULL, 0},
-
- {"LOG_TO_MONITOR", AUD_OPT_BOOL, &conf.log_to_monitor,
- "print logging messages to monitor instead of stderr", NULL, 0},
-
- {NULL, 0, NULL, NULL, NULL, 0}
+ .name = "TIMER_PERIOD",
+ .tag = AUD_OPT_INT,
+ .valp = &conf.period.hertz,
+ .descr = "Timer period in HZ (0 - use lowest possible)"
+ },{
+ .name = "PLIVE",
+ .tag = AUD_OPT_BOOL,
+ .valp = &conf.plive,
+ .descr = "(undocumented)"
+ },{
+ .name = "LOG_TO_MONITOR",
+ .tag = AUD_OPT_BOOL,
+ .valp = &conf.log_to_monitor,
+ .descr = ".descr = print logging messages to monitor instead of stderr"
+ },{
+ /* End of list */
+ }
};
static void audio_pp_nb_voices (const char *typ, int nb)
diff --git a/audio/coreaudio.c b/audio/coreaudio.c
index 9a9754d..abc4b98 100644
--- a/audio/coreaudio.c
+++ b/audio/coreaudio.c
@@ -513,11 +513,19 @@ static void coreaudio_audio_fini (void *opaque)
}
static struct audio_option coreaudio_options[] = {
- {"BUFFER_SIZE", AUD_OPT_INT, &conf.buffer_frames,
- "Size of the buffer in frames", NULL, 0},
- {"BUFFER_COUNT", AUD_OPT_INT, &conf.nbuffers,
- "Number of buffers", NULL, 0},
- {NULL, 0, NULL, NULL, NULL, 0}
+ {
+ .name = "BUFFER_SIZE",
+ .tag = AUD_OPT_INT,
+ .valp = &conf.buffer_frames,
+ .descr = "Size of the buffer in frames"
+ },{
+ .name = "BUFFER_COUNT",
+ .tag = AUD_OPT_INT,
+ .valp = &conf.nbuffers,
+ .descr = "Number of buffers"
+ },{
+ /* End of list */
+ }
};
static struct audio_pcm_ops coreaudio_pcm_ops = {
diff --git a/audio/dsoundaudio.c b/audio/dsoundaudio.c
index a8edfee..cbe405c 100644
--- a/audio/dsoundaudio.c
+++ b/audio/dsoundaudio.c
@@ -1035,27 +1035,59 @@ static void *dsound_audio_init (void)
}
static struct audio_option dsound_options[] = {
- {"LOCK_RETRIES", AUD_OPT_INT, &conf.lock_retries,
- "Number of times to attempt locking the buffer", NULL, 0},
- {"RESTOURE_RETRIES", AUD_OPT_INT, &conf.restore_retries,
- "Number of times to attempt restoring the buffer", NULL, 0},
- {"GETSTATUS_RETRIES", AUD_OPT_INT, &conf.getstatus_retries,
- "Number of times to attempt getting status of the buffer", NULL, 0},
- {"SET_PRIMARY", AUD_OPT_BOOL, &conf.set_primary,
- "Set the parameters of primary buffer", NULL, 0},
- {"LATENCY_MILLIS", AUD_OPT_INT, &conf.latency_millis,
- "(undocumented)", NULL, 0},
- {"PRIMARY_FREQ", AUD_OPT_INT, &conf.settings.freq,
- "Primary buffer frequency", NULL, 0},
- {"PRIMARY_CHANNELS", AUD_OPT_INT, &conf.settings.nchannels,
- "Primary buffer number of channels (1 - mono, 2 - stereo)", NULL, 0},
- {"PRIMARY_FMT", AUD_OPT_FMT, &conf.settings.fmt,
- "Primary buffer format", NULL, 0},
- {"BUFSIZE_OUT", AUD_OPT_INT, &conf.bufsize_out,
- "(undocumented)", NULL, 0},
- {"BUFSIZE_IN", AUD_OPT_INT, &conf.bufsize_in,
- "(undocumented)", NULL, 0},
- {NULL, 0, NULL, NULL, NULL, 0}
+ {
+ .name = "LOCK_RETRIES",
+ .tag = AUD_OPT_INT,
+ .valp = &conf.lock_retries,
+ .descr = "Number of times to attempt locking the buffer"
+ },{
+ .name = "RESTOURE_RETRIES",
+ .tag = AUD_OPT_INT,
+ .valp = &conf.restore_retries,
+ .descr = "Number of times to attempt restoring the buffer"
+ },{
+ .name = "GETSTATUS_RETRIES",
+ .tag = AUD_OPT_INT,
+ .valp = &conf.getstatus_retries,
+ .descr = "Number of times to attempt getting status of the buffer"
+ },{
+ .name = "SET_PRIMARY",
+ .tag = AUD_OPT_BOOL,
+ .valp = &conf.set_primary
+ .descr = "Set the parameters of primary buffer"
+ },{
+ .name = "LATENCY_MILLIS",
+ .tag = AUD_OPT_INT,
+ .valp = &conf.latency_millis,
+ .descr = "(undocumented)",
+ },{
+ .name = "PRIMARY_FREQ",
+ .tag = AUD_OPT_INT,
+ .valp = &conf.settings.freq,
+ .descr = "Primary buffer frequency"
+ },{
+ .name = "PRIMARY_CHANNELS",
+ .tag = AUD_OPT_INT,
+ .valp = &conf.settings.nchannels,
+ .descr = "Primary buffer number of channels (1 - mono, 2 - stereo)"
+ },{
+ .name = "PRIMARY_FMT",
+ .tag = AUD_OPT_FMT,
+ .valp = &conf.settings.fmt,
+ .descr = "Primary buffer format"
+ },{
+ .name = "BUFSIZE_OUT",
+ .tag = AUD_OPT_INT,
+ .valp = &conf.bufsize_out,
+ .descr = "(undocumented)"
+ },{
+ .name = "BUFSIZE_IN",
+ .tag = AUD_OPT_INT,
+ .valp = &conf.bufsize_in,
+ .descr = "(undocumented)"
+ },{
+ /* End of list */
+ }
};
static struct audio_pcm_ops dsound_pcm_ops = {
diff --git a/audio/esdaudio.c b/audio/esdaudio.c
index 29f4ffc..308e8d5 100644
--- a/audio/esdaudio.c
+++ b/audio/esdaudio.c
@@ -551,19 +551,29 @@ static void qesd_audio_fini (void *opaque)
}
struct audio_option qesd_options[] = {
- {"SAMPLES", AUD_OPT_INT, &conf.samples,
- "buffer size in samples", NULL, 0},
-
- {"DIVISOR", AUD_OPT_INT, &conf.divisor,
- "threshold divisor", NULL, 0},
-
- {"DAC_HOST", AUD_OPT_STR, &conf.dac_host,
- "playback host", NULL, 0},
-
- {"ADC_HOST", AUD_OPT_STR, &conf.adc_host,
- "capture host", NULL, 0},
-
- {NULL, 0, NULL, NULL, NULL, 0}
+ {
+ .name = "SAMPLES",
+ .tag = AUD_OPT_INT,
+ .valp = &conf.samples,
+ .descr = "buffer size in samples"
+ },{
+ .name = "DIVISOR",
+ .tag = AUD_OPT_INT,
+ .valp = &conf.divisor,
+ .descr = "threshold divisor"
+ },{
+ .name = "DAC_HOST",
+ .tag = AUD_OPT_STR,
+ .valp = &conf.dac_host,
+ .descr = "playback host"
+ },{
+ .name = "ADC_HOST",
+ .tag = AUD_OPT_STR,
+ .valp = &conf.adc_host,
+ .descr = "capture host"
+ },{
+ /* End of list */
+ }
};
static struct audio_pcm_ops qesd_pcm_ops = {
diff --git a/audio/fmodaudio.c b/audio/fmodaudio.c
index 83a6454..ac7a09f 100644
--- a/audio/fmodaudio.c
+++ b/audio/fmodaudio.c
@@ -639,22 +639,41 @@ static void fmod_audio_fini (void *opaque)
}
static struct audio_option fmod_options[] = {
- {"DRV", AUD_OPT_STR, &conf.drvname,
- "FMOD driver", NULL, 0},
- {"FREQ", AUD_OPT_INT, &conf.freq,
- "Default frequency", NULL, 0},
- {"SAMPLES", AUD_OPT_INT, &conf.nb_samples,
- "Buffer size in samples", NULL, 0},
- {"CHANNELS", AUD_OPT_INT, &conf.nb_channels,
- "Number of default channels (1 - mono, 2 - stereo)", NULL, 0},
- {"BUFSIZE", AUD_OPT_INT, &conf.bufsize,
- "(undocumented)", NULL, 0},
+ {
+ .name = "DRV",
+ .tag = AUD_OPT_STR,
+ .valp = &conf.drvname,
+ .descr = "FMOD driver"
+ },{
+ .name = "FREQ",
+ .tag = AUD_OPT_INT,
+ .valp = &conf.freq,
+ .descr = "Default frequency"
+ },{
+ .name = "SAMPLES",
+ .tag = AUD_OPT_INT,
+ .valp = &conf.nb_samples,
+ .descr = "Buffer size in samples"
+ },{
+ .name = "CHANNELS",
+ .tag = AUD_OPT_INT,
+ .valp = &conf.nb_channels,
+ .descr = "Number of default channels (1 - mono, 2 - stereo)"
+ },{
+ .name = "BUFSIZE",
+ .tag = AUD_OPT_INT,
+ .valp = &conf.bufsize,
+ .descr = "(undocumented)"
#if 0
- {"THRESHOLD", AUD_OPT_INT, &conf.threshold,
- "(undocumented)"},
+ },{
+ .name = "THRESHOLD",
+ .tag = AUD_OPT_INT,
+ .valp = &conf.threshold,
+ .descr = "(undocumented)"
#endif
-
- {NULL, 0, NULL, NULL, NULL, 0}
+ },{
+ /* End of list */
+ }
};
static struct audio_pcm_ops fmod_pcm_ops = {
diff --git a/audio/ossaudio.c b/audio/ossaudio.c
index 27a7ea9..eba86c1 100644
--- a/audio/ossaudio.c
+++ b/audio/ossaudio.c
@@ -736,19 +736,39 @@ static void oss_audio_fini (void *opaque)
}
static struct audio_option oss_options[] = {
- {"FRAGSIZE", AUD_OPT_INT, &conf.fragsize,
- "Fragment size in bytes", NULL, 0},
- {"NFRAGS", AUD_OPT_INT, &conf.nfrags,
- "Number of fragments", NULL, 0},
- {"MMAP", AUD_OPT_BOOL, &conf.try_mmap,
- "Try using memory mapped access", NULL, 0},
- {"DAC_DEV", AUD_OPT_STR, &conf.devpath_out,
- "Path to DAC device", NULL, 0},
- {"ADC_DEV", AUD_OPT_STR, &conf.devpath_in,
- "Path to ADC device", NULL, 0},
- {"DEBUG", AUD_OPT_BOOL, &conf.debug,
- "Turn on some debugging messages", NULL, 0},
- {NULL, 0, NULL, NULL, NULL, 0}
+ {
+ .name = "FRAGSIZE",
+ .tag = AUD_OPT_INT,
+ .valp = &conf.fragsize,
+ .descr = "Fragment size in bytes"
+ },{
+ .name = "NFRAGS",
+ .tag = AUD_OPT_INT,
+ .valp = &conf.nfrags,
+ .descr = "Number of fragments"
+ },{
+ .name = "MMAP",
+ .tag = AUD_OPT_BOOL,
+ .valp = &conf.try_mmap,
+ .descr = "Try using memory mapped access"
+ },{
+ .name = "DAC_DEV",
+ .tag = AUD_OPT_STR,
+ .valp = &conf.devpath_out,
+ .descr = "Path to DAC device"
+ },{
+ .name = "ADC_DEV",
+ .tag = AUD_OPT_STR,
+ .valp = &conf.devpath_in,
+ .descr = "Path to ADC device"
+ },{
+ .name = "DEBUG",
+ .tag = AUD_OPT_BOOL,
+ .valp = &conf.debug,
+ .descr = "Turn on some debugging messages"
+ },{
+ /* End of list */
+ }
};
static struct audio_pcm_ops oss_pcm_ops = {
diff --git a/audio/paaudio.c b/audio/paaudio.c
index 43b3002..baf8e5f 100644
--- a/audio/paaudio.c
+++ b/audio/paaudio.c
@@ -469,22 +469,34 @@ static void qpa_audio_fini (void *opaque)
}
struct audio_option qpa_options[] = {
- {"SAMPLES", AUD_OPT_INT, &conf.samples,
- "buffer size in samples", NULL, 0},
-
- {"DIVISOR", AUD_OPT_INT, &conf.divisor,
- "threshold divisor", NULL, 0},
-
- {"SERVER", AUD_OPT_STR, &conf.server,
- "server address", NULL, 0},
-
- {"SINK", AUD_OPT_STR, &conf.sink,
- "sink device name", NULL, 0},
-
- {"SOURCE", AUD_OPT_STR, &conf.source,
- "source device name", NULL, 0},
-
- {NULL, 0, NULL, NULL, NULL, 0}
+ {
+ .name = "SAMPLES",
+ .tag = AUD_OPT_INT,
+ .valp = &conf.samples,
+ .descr = "buffer size in samples"
+ },{
+ .name = "DIVISOR",
+ .tag = AUD_OPT_INT,
+ .valp = &conf.divisor,
+ .descr = "threshold divisor"
+ },{
+ .name = "SERVER",
+ .tag = AUD_OPT_STR,
+ .valp = &conf.server,
+ .descr = "server address"
+ },{
+ .name = "SINK",
+ .tag = AUD_OPT_STR,
+ .valp = &conf.sink,
+ .descr = "sink device name"
+ },{
+ .name = "SOURCE",
+ .tag = AUD_OPT_STR,
+ .valp = &conf.source,
+ .descr = "source device name"
+ },{
+ /* End of list */
+ }
};
static struct audio_pcm_ops qpa_pcm_ops = {
diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c
index 051ea8e..18790c6 100644
--- a/audio/sdlaudio.c
+++ b/audio/sdlaudio.c
@@ -420,9 +420,14 @@ static void sdl_audio_fini (void *opaque)
}
static struct audio_option sdl_options[] = {
- {"SAMPLES", AUD_OPT_INT, &conf.nb_samples,
- "Size of SDL buffer in samples", NULL, 0},
- {NULL, 0, NULL, NULL, NULL, 0}
+ {
+ .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 = {
diff --git a/audio/wavaudio.c b/audio/wavaudio.c
index d5585e4..e2aa42a 100644
--- a/audio/wavaudio.c
+++ b/audio/wavaudio.c
@@ -219,18 +219,29 @@ static void wav_audio_fini (void *opaque)
}
static struct audio_option wav_options[] = {
- {"FREQUENCY", AUD_OPT_INT, &conf.settings.freq,
- "Frequency", NULL, 0},
-
- {"FORMAT", AUD_OPT_FMT, &conf.settings.fmt,
- "Format", NULL, 0},
-
- {"DAC_FIXED_CHANNELS", AUD_OPT_INT, &conf.settings.nchannels,
- "Number of channels (1 - mono, 2 - stereo)", NULL, 0},
-
- {"PATH", AUD_OPT_STR, &conf.wav_path,
- "Path to wave file", NULL, 0},
- {NULL, 0, NULL, NULL, NULL, 0}
+ {
+ .name = "FREQUENCY",
+ .tag = AUD_OPT_INT,
+ .valp = &conf.settings.freq,
+ .descr = "Frequency"
+ },{
+ .name = "FORMAT",
+ .tag = AUD_OPT_FMT,
+ .valp = &conf.settings.fmt,
+ .descr = "Format"
+ },{
+ .name = "DAC_FIXED_CHANNELS",
+ .tag = AUD_OPT_INT,
+ .valp = &conf.settings.nchannels,
+ .descr = "Number of channels (1 - mono, 2 - stereo)"
+ },{
+ .name = "PATH",
+ .tag = AUD_OPT_STR,
+ .valp = &conf.wav_path,
+ .descr = "Path to wave file"
+ },{
+ /* End of list */
+ }
};
static struct audio_pcm_ops wav_pcm_ops = {
--
1.6.2.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH 4/4] use C99 initializers for all audio/*
2009-07-28 8:56 [Qemu-devel] [PATCH v2 0/4] Use C99 struct initializers in audio/* Juan Quintela
` (2 preceding siblings ...)
2009-07-28 8:56 ` [Qemu-devel] [PATCH 3/4] Use C99 initializers for audio_option Juan Quintela
@ 2009-07-28 8:56 ` Juan Quintela
3 siblings, 0 replies; 5+ messages in thread
From: Juan Quintela @ 2009-07-28 8:56 UTC (permalink / raw)
To: qemu-devel; +Cc: aliguori
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
audio/alsaaudio.c | 9 +++++-
audio/dsoundaudio.c | 20 ++++++++--------
audio/esdaudio.c | 6 +---
audio/fmodaudio.c | 63 ++++++++++++++++++++++++++++++++++----------------
audio/ossaudio.c | 9 +++++-
audio/paaudio.c | 7 +----
audio/sdlaudio.c | 2 +-
audio/wavaudio.c | 9 +++----
8 files changed, 76 insertions(+), 49 deletions(-)
diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c
index 818c6a5..6b20e5c 100644
--- a/audio/alsaaudio.c
+++ b/audio/alsaaudio.c
@@ -763,8 +763,13 @@ static int alsa_run_in (HWVoiceIn *hw)
int add;
int len;
} bufs[2] = {
- { hw->wpos, 0 },
- { 0, 0 }
+ {
+ .add = hw->wpos,
+ .len = 0
+ },{
+ .add = 0,
+ .len = 0
+ }
};
snd_pcm_sframes_t avail;
snd_pcm_uframes_t read_samples = 0;
diff --git a/audio/dsoundaudio.c b/audio/dsoundaudio.c
index cbe405c..8572886 100644
--- a/audio/dsoundaudio.c
+++ b/audio/dsoundaudio.c
@@ -49,18 +49,18 @@ static struct {
struct audsettings settings;
int latency_millis;
} conf = {
- 1,
- 1,
- 1,
- 0,
- 16384,
- 16384,
+ .lock_retries = 1,
+ .restore_retries = 1,
+ .getstatus_retries = 1,
+ .set_primary = 0,
+ .bufsize_in = 16384,
+ .bufsize_out = 16384,
{
- 44100,
- 2,
- AUD_FMT_S16
+ .freq = 44100,
+ .nchannels = 2,
+ .fmt = AUD_FMT_S16
},
- 10
+ .latency_millis = 10
};
typedef struct {
diff --git a/audio/esdaudio.c b/audio/esdaudio.c
index 308e8d5..52aa84c 100644
--- a/audio/esdaudio.c
+++ b/audio/esdaudio.c
@@ -58,10 +58,8 @@ static struct {
char *dac_host;
char *adc_host;
} conf = {
- 1024,
- 2,
- NULL,
- NULL
+ .samples = 1024,
+ .divisor = 2,
};
static void GCC_FMT_ATTR (2, 3) qesd_logerr (int err, const char *fmt, ...)
diff --git a/audio/fmodaudio.c b/audio/fmodaudio.c
index ac7a09f..3ee3876 100644
--- a/audio/fmodaudio.c
+++ b/audio/fmodaudio.c
@@ -50,13 +50,9 @@ static struct {
int threshold;
int broken_adc;
} conf = {
- NULL,
- 2048 * 2,
- 44100,
- 2,
- 0,
- 0,
- 0
+ .nb_samples = 2048 * 2,
+ .freq = 44100,
+ .nb_channels = 2,
};
static void GCC_FMT_ATTR (1, 2) fmod_logerr (const char *fmt, ...)
@@ -517,27 +513,54 @@ static struct {
const char *name;
int type;
} drvtab[] = {
- {"none", FSOUND_OUTPUT_NOSOUND},
+ {
+ .name = "none",
+ .type = FSOUND_OUTPUT_NOSOUND
+ },{
#ifdef _WIN32
- {"winmm", FSOUND_OUTPUT_WINMM},
- {"dsound", FSOUND_OUTPUT_DSOUND},
- {"a3d", FSOUND_OUTPUT_A3D},
- {"asio", FSOUND_OUTPUT_ASIO},
+ .name = "winmm",
+ .type = FSOUND_OUTPUT_WINMM
+ },{
+ .name = "dsound",
+ .type = FSOUND_OUTPUT_DSOUND
+ },{
+ .name = "a3d",
+ .type = FSOUND_OUTPUT_A3D
+ },{
+ .name = "asio",
+ .type = FSOUND_OUTPUT_ASIO
+ },{
#endif
#ifdef __linux__
- {"oss", FSOUND_OUTPUT_OSS},
- {"alsa", FSOUND_OUTPUT_ALSA},
- {"esd", FSOUND_OUTPUT_ESD},
+ .name = "oss",
+ .type = FSOUND_OUTPUT_OSS
+ },{
+ .name = "alsa",
+ .type = FSOUND_OUTPUT_ALSA
+ },{
+ .name = "esd",
+ .type = FSOUND_OUTPUT_ESD
+ },{
#endif
#ifdef __APPLE__
- {"mac", FSOUND_OUTPUT_MAC},
+ .name = "mac",
+ .type = FSOUND_OUTPUT_MAC
+ },{
#endif
#if 0
- {"xbox", FSOUND_OUTPUT_XBOX},
- {"ps2", FSOUND_OUTPUT_PS2},
- {"gcube", FSOUND_OUTPUT_GC},
+ .name = "xbox",
+ .type = FSOUND_OUTPUT_XBOX
+ },{
+ .name = "ps2",
+ .type = FSOUND_OUTPUT_PS2
+ },{
+ .name = "gcube",
+ .type = FSOUND_OUTPUT_GC
+ }, {
#endif
- {"none-realtime", FSOUND_OUTPUT_NOSOUND_NONREALTIME}
+ .name = "none-realtime",
+ .type = FSOUND_OUTPUT_NOSOUND_NONREALTIME
+ }
};
static void *fmod_audio_init (void)
diff --git a/audio/ossaudio.c b/audio/ossaudio.c
index eba86c1..0a11344 100644
--- a/audio/ossaudio.c
+++ b/audio/ossaudio.c
@@ -654,8 +654,13 @@ static int oss_run_in (HWVoiceIn *hw)
int add;
int len;
} bufs[2] = {
- { hw->wpos, 0 },
- { 0, 0 }
+ {
+ .add = hw->wpos,
+ .len = 0
+ },{
+ .add = 0,
+ .len = 0
+ }
};
if (!dead) {
diff --git a/audio/paaudio.c b/audio/paaudio.c
index baf8e5f..f117b84 100644
--- a/audio/paaudio.c
+++ b/audio/paaudio.c
@@ -38,11 +38,8 @@ static struct {
char *sink;
char *source;
} conf = {
- 1024,
- 2,
- NULL,
- NULL,
- NULL
+ .samples = 1024,
+ .divisor = 2,
};
static void GCC_FMT_ATTR (2, 3) qpa_logerr (int err, const char *fmt, ...)
diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c
index 18790c6..3d04de0 100644
--- a/audio/sdlaudio.c
+++ b/audio/sdlaudio.c
@@ -48,7 +48,7 @@ typedef struct SDLVoiceOut {
static struct {
int nb_samples;
} conf = {
- 1024
+ .nb_samples = 1024
};
static struct SDLAudioState {
diff --git a/audio/wavaudio.c b/audio/wavaudio.c
index e2aa42a..b7f2890 100644
--- a/audio/wavaudio.c
+++ b/audio/wavaudio.c
@@ -41,12 +41,11 @@ static struct {
const char *wav_path;
} conf = {
{
- 44100,
- 2,
- AUD_FMT_S16,
- 0
+ .freq = 44100,
+ .nchannels = 2,
+ .fmt = AUD_FMT_S16,
},
- "qemu.wav"
+ .wav_path = "qemu.wav"
};
static int wav_run_out (HWVoiceOut *hw)
--
1.6.2.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-07-28 8:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-28 8:56 [Qemu-devel] [PATCH v2 0/4] Use C99 struct initializers in audio/* Juan Quintela
2009-07-28 8:56 ` [Qemu-devel] [PATCH 1/4] Use proper struct initializers and remove INIT_FIELD() macro Juan Quintela
2009-07-28 8:56 ` [Qemu-devel] [PATCH 2/4] use C99 initializers for audio_pcm_ops Juan Quintela
2009-07-28 8:56 ` [Qemu-devel] [PATCH 3/4] Use C99 initializers for audio_option Juan Quintela
2009-07-28 8:56 ` [Qemu-devel] [PATCH 4/4] use C99 initializers for all audio/* Juan Quintela
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).