Use C99 struct initializers in audio/*
v2 cover Use C99 struct initializers in audio/*
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(-)
PATCH v2 1/4 Use proper struct initializers and remove INIT_FIELD() macro
--- 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(-)
audio/alsaaudio.c +11 -11
@@ -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) };
audio/audio_int.h +0 -2
@@ -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
audio/coreaudio.c +11 -12
@@ -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 };
audio/dsoundaudio.c +11 -12
@@ -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) };
audio/esdaudio.c +11 -12
@@ -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) };
audio/fmodaudio.c +11 -11
@@ -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) };
audio/noaudio.c +11 -11
@@ -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) };
audio/ossaudio.c +11 -11
@@ -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) };
audio/paaudio.c +11 -11
@@ -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) };
audio/sdlaudio.c +11 -11
@@ -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 };
audio/wavaudio.c +11 -12
@@ -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 };
Signature · 1 line
1.6.2.5
PATCH v2 2/4 use C99 initializers for audio_pcm_ops
In reply to Juan Quintela--- 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(-)
audio/alsaaudio.c +11 -11
@@ -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 = {
audio/coreaudio.c +5 -11
@@ -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 = {
audio/dsoundaudio.c +11 -11
@@ -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 = {
audio/esdaudio.c +11 -11
@@ -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 = {
audio/fmodaudio.c +11 -11
@@ -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 = {
audio/noaudio.c +11 -11
@@ -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 = {
audio/ossaudio.c +11 -11
@@ -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 = {
audio/paaudio.c +11 -10
@@ -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 = {
audio/sdlaudio.c +5 -11
@@ -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 = {
audio/wavaudio.c +5 -11
@@ -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 = {
Signature · 1 line
1.6.2.5
PATCH v2 3/4 Use C99 initializers for audio_option
In reply to Juan Quintela--- 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(-)
audio/alsaaudio.c +57 -31
@@ -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 = {
audio/audio.c +68 -41
117 lines not on this page · raw message
audio/coreaudio.c +13 -5
@@ -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 = {
audio/dsoundaudio.c +53 -21
80 lines not on this page · raw message
audio/esdaudio.c +23 -13
@@ -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 = {
audio/fmodaudio.c +33 -14
55 lines not on this page · raw message
audio/ossaudio.c +33 -13
52 lines not on this page · raw message
audio/paaudio.c +28 -16
50 lines not on this page · raw message
audio/sdlaudio.c +8 -3
@@ -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 = {
audio/wavaudio.c +23 -12
@@ -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 = {
Signature · 1 line
1.6.2.5
PATCH v2 4/4 use C99 initializers for all audio/*
In reply to Juan Quintela--- 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(-)
audio/alsaaudio.c +7 -2
@@ -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 ;
audio/dsoundaudio.c +10 -10
@@ -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 {
audio/esdaudio.c +2 -4
@@ -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, ...)
audio/fmodaudio.c +43 -20
83 lines not on this page · raw message
audio/ossaudio.c +7 -2
@@ -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) {
audio/paaudio.c +2 -5
@@ -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, ...)
audio/sdlaudio.c +1 -1
@@ -48,7 +48,7 @@ typedef struct SDLVoiceOut {static struct {int nb_samples; } conf = { -1024 + .nb_samples =1024 }; static struct SDLAudioState {
audio/wavaudio.c +4 -5
@@ -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)
Signature · 1 line
1.6.2.5