From 2700efa3236d20879473d6b9c612f882a1b43dda Mon Sep 17 00:00:00 2001 From: Juan Quintela Date: Tue, 11 Aug 2009 02:31:16 +0200 Subject: [PATCH] Use C99 initializers for audio_option Signed-off-by: Juan Quintela --- audio/alsaaudio.c | 76 +++++++++++++++++++++--------------- audio/audio.c | 93 ++++++++++++++++++++++++++------------------- audio/coreaudio.c | 14 ++++--- audio/dsoundaudio.c | 62 ++++++++++++++++++++---------- audio/esdaudio.c | 30 ++++++++------- audio/fmodaudio.c | 39 ++++++++++++------- audio/ossaudio.c | 38 +++++++++++------- audio/paaudio.c | 37 ++++++++++-------- audio/sdlaudio.c | 8 ++-- audio/wavaudio.c | 29 ++++++++------ 10 files changed, 258 insertions(+), 168 deletions(-) diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c index 61a8cd03ac..574531297c 100644 --- a/audio/alsaaudio.c +++ b/audio/alsaaudio.c @@ -935,37 +935,51 @@ 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 0a3830dc43..4033a935cf 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1493,48 +1493,61 @@ 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 c46b357d1f..ffeaa7f90b 100644 --- a/audio/coreaudio.c +++ b/audio/coreaudio.c @@ -513,11 +513,15 @@ 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 7c087903f4..6c52c65a61 100644 --- a/audio/dsoundaudio.c +++ b/audio/dsoundaudio.c @@ -1035,27 +1035,47 @@ 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 ff6725e306..83c18964fe 100644 --- a/audio/esdaudio.c +++ b/audio/esdaudio.c @@ -551,19 +551,23 @@ 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 8259551890..8239ed7d24 100644 --- a/audio/fmodaudio.c +++ b/audio/fmodaudio.c @@ -639,22 +639,33 @@ 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 97edf9fc35..b8e6ec3615 100644 --- a/audio/ossaudio.c +++ b/audio/ossaudio.c @@ -736,19 +736,31 @@ 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 0b469cf992..2488f74d53 100644 --- a/audio/paaudio.c +++ b/audio/paaudio.c @@ -469,22 +469,27 @@ 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 6870fdf1ed..e2563ba532 100644 --- a/audio/sdlaudio.c +++ b/audio/sdlaudio.c @@ -420,9 +420,11 @@ 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 96cc49d136..51ed6eb5dc 100644 --- a/audio/wavaudio.c +++ b/audio/wavaudio.c @@ -219,18 +219,23 @@ 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 = {