Use C99 initializers for audio_option

Signed-off-by: Juan Quintela <quintela@redhat.com>
This commit is contained in:
Juan Quintela 2009-08-11 02:31:16 +02:00 committed by malc
parent bee37f32d4
commit 2700efa323
10 changed files with 258 additions and 168 deletions

View File

@ -935,37 +935,51 @@ static void alsa_audio_fini (void *opaque)
} }
static struct audio_option alsa_options[] = { static struct audio_option alsa_options[] = {
{"DAC_SIZE_IN_USEC", AUD_OPT_BOOL, &conf.size_in_usec_out, {.name = "DAC_SIZE_IN_USEC",
"DAC period/buffer size in microseconds (otherwise in frames)", NULL, 0}, .tag = AUD_OPT_BOOL,
{"DAC_PERIOD_SIZE", AUD_OPT_INT, &conf.period_size_out, .valp = &conf.size_in_usec_out,
"DAC period size (0 to go with system default)", .descr = "DAC period/buffer size in microseconds (otherwise in frames)"},
&conf.period_size_out_overridden, 0}, {.name = "DAC_PERIOD_SIZE",
{"DAC_BUFFER_SIZE", AUD_OPT_INT, &conf.buffer_size_out, .tag = AUD_OPT_INT,
"DAC buffer size (0 to go with system default)", .valp = &conf.period_size_out,
&conf.buffer_size_out_overridden, 0}, .descr = "DAC period size (0 to go with system default)",
.overriddenp = &conf.period_size_out_overridden},
{"ADC_SIZE_IN_USEC", AUD_OPT_BOOL, &conf.size_in_usec_in, {.name = "DAC_BUFFER_SIZE",
"ADC period/buffer size in microseconds (otherwise in frames)", NULL, 0}, .tag = AUD_OPT_INT,
{"ADC_PERIOD_SIZE", AUD_OPT_INT, &conf.period_size_in, .valp = &conf.buffer_size_out,
"ADC period size (0 to go with system default)", .descr = "DAC buffer size (0 to go with system default)",
&conf.period_size_in_overridden, 0}, .overriddenp = &conf.buffer_size_out_overridden},
{"ADC_BUFFER_SIZE", AUD_OPT_INT, &conf.buffer_size_in, {.name = "ADC_SIZE_IN_USEC",
"ADC buffer size (0 to go with system default)", .tag = AUD_OPT_BOOL,
&conf.buffer_size_in_overridden, 0}, .valp = &conf.size_in_usec_in,
.descr = "ADC period/buffer size in microseconds (otherwise in frames)"},
{"THRESHOLD", AUD_OPT_INT, &conf.threshold, {.name = "ADC_PERIOD_SIZE",
"(undocumented)", NULL, 0}, .tag = AUD_OPT_INT,
.valp = &conf.period_size_in,
{"DAC_DEV", AUD_OPT_STR, &conf.pcm_name_out, .descr = "ADC period size (0 to go with system default)",
"DAC device name (for instance dmix)", NULL, 0}, .overriddenp = &conf.period_size_in_overridden},
{.name = "ADC_BUFFER_SIZE",
{"ADC_DEV", AUD_OPT_STR, &conf.pcm_name_in, .tag = AUD_OPT_INT,
"ADC device name", NULL, 0}, .valp = &conf.buffer_size_in,
.descr = "ADC buffer size (0 to go with system default)",
{"VERBOSE", AUD_OPT_BOOL, &conf.verbose, .overriddenp = &conf.buffer_size_in_overridden},
"Behave in a more verbose way", NULL, 0}, {.name = "THRESHOLD",
.tag = AUD_OPT_INT,
{NULL, 0, NULL, NULL, NULL, 0} .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 = { static struct audio_pcm_ops alsa_pcm_ops = {

View File

@ -1493,48 +1493,61 @@ static void audio_timer (void *opaque)
static struct audio_option audio_options[] = { static struct audio_option audio_options[] = {
/* DAC */ /* DAC */
{"DAC_FIXED_SETTINGS", AUD_OPT_BOOL, &conf.fixed_out.enabled, {.name = "DAC_FIXED_SETTINGS",
"Use fixed settings for host DAC", NULL, 0}, .tag = AUD_OPT_BOOL,
.valp = &conf.fixed_out.enabled,
{"DAC_FIXED_FREQ", AUD_OPT_INT, &conf.fixed_out.settings.freq, .descr = "Use fixed settings for host DAC"},
"Frequency for fixed host DAC", NULL, 0}, {.name = "DAC_FIXED_FREQ",
.tag = AUD_OPT_INT,
{"DAC_FIXED_FMT", AUD_OPT_FMT, &conf.fixed_out.settings.fmt, .valp = &conf.fixed_out.settings.freq,
"Format for fixed host DAC", NULL, 0}, .descr = "Frequency for fixed host DAC"},
{.name = "DAC_FIXED_FMT",
{"DAC_FIXED_CHANNELS", AUD_OPT_INT, &conf.fixed_out.settings.nchannels, .tag = AUD_OPT_FMT,
"Number of channels for fixed DAC (1 - mono, 2 - stereo)", NULL, 0}, .valp = &conf.fixed_out.settings.fmt,
.descr = "Format for fixed host DAC"},
{"DAC_VOICES", AUD_OPT_INT, &conf.fixed_out.nb_voices, {.name = "DAC_FIXED_CHANNELS",
"Number of voices for DAC", NULL, 0}, .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 */
{"ADC_FIXED_SETTINGS", AUD_OPT_BOOL, &conf.fixed_in.enabled, {.name = "ADC_FIXED_SETTINGS",
"Use fixed settings for host ADC", NULL, 0}, .tag = AUD_OPT_BOOL,
.valp = &conf.fixed_in.enabled,
{"ADC_FIXED_FREQ", AUD_OPT_INT, &conf.fixed_in.settings.freq, .descr = "Use fixed settings for host ADC"},
"Frequency for fixed host ADC", NULL, 0}, {.name = "ADC_FIXED_FREQ",
.tag = AUD_OPT_INT,
{"ADC_FIXED_FMT", AUD_OPT_FMT, &conf.fixed_in.settings.fmt, .valp = &conf.fixed_in.settings.freq,
"Format for fixed host ADC", NULL, 0}, .descr = "Frequency for fixed host ADC"},
{.name = "ADC_FIXED_FMT",
{"ADC_FIXED_CHANNELS", AUD_OPT_INT, &conf.fixed_in.settings.nchannels, .tag = AUD_OPT_FMT,
"Number of channels for fixed ADC (1 - mono, 2 - stereo)", NULL, 0}, .valp = &conf.fixed_in.settings.fmt,
.descr = "Format for fixed host ADC"},
{"ADC_VOICES", AUD_OPT_INT, &conf.fixed_in.nb_voices, {.name = "ADC_FIXED_CHANNELS",
"Number of voices for ADC", NULL, 0}, .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 */ /* Misc */
{"TIMER_PERIOD", AUD_OPT_INT, &conf.period.hertz, {.name = "TIMER_PERIOD",
"Timer period in HZ (0 - use lowest possible)", NULL, 0}, .tag = AUD_OPT_INT,
.valp = &conf.period.hertz,
{"PLIVE", AUD_OPT_BOOL, &conf.plive, .descr = "Timer period in HZ (0 - use lowest possible)"},
"(undocumented)", NULL, 0}, {.name = "PLIVE",
.tag = AUD_OPT_BOOL,
{"LOG_TO_MONITOR", AUD_OPT_BOOL, &conf.log_to_monitor, .valp = &conf.plive,
"print logging messages to monitor instead of stderr", NULL, 0}, .descr = "(undocumented)"},
{.name = "LOG_TO_MONITOR",
{NULL, 0, NULL, NULL, NULL, 0} .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) static void audio_pp_nb_voices (const char *typ, int nb)

View File

@ -513,11 +513,15 @@ static void coreaudio_audio_fini (void *opaque)
} }
static struct audio_option coreaudio_options[] = { static struct audio_option coreaudio_options[] = {
{"BUFFER_SIZE", AUD_OPT_INT, &conf.buffer_frames, {.name = "BUFFER_SIZE",
"Size of the buffer in frames", NULL, 0}, .tag = AUD_OPT_INT,
{"BUFFER_COUNT", AUD_OPT_INT, &conf.nbuffers, .valp = &conf.buffer_frames,
"Number of buffers", NULL, 0}, .descr = "Size of the buffer in frames"},
{NULL, 0, NULL, NULL, NULL, 0} {.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 = { static struct audio_pcm_ops coreaudio_pcm_ops = {

View File

@ -1035,27 +1035,47 @@ static void *dsound_audio_init (void)
} }
static struct audio_option dsound_options[] = { static struct audio_option dsound_options[] = {
{"LOCK_RETRIES", AUD_OPT_INT, &conf.lock_retries, {.name = "LOCK_RETRIES",
"Number of times to attempt locking the buffer", NULL, 0}, .tag = AUD_OPT_INT,
{"RESTOURE_RETRIES", AUD_OPT_INT, &conf.restore_retries, .valp = &conf.lock_retries,
"Number of times to attempt restoring the buffer", NULL, 0}, .descr = "Number of times to attempt locking the buffer"},
{"GETSTATUS_RETRIES", AUD_OPT_INT, &conf.getstatus_retries, {.name = "RESTOURE_RETRIES",
"Number of times to attempt getting status of the buffer", NULL, 0}, .tag = AUD_OPT_INT,
{"SET_PRIMARY", AUD_OPT_BOOL, &conf.set_primary, .valp = &conf.restore_retries,
"Set the parameters of primary buffer", NULL, 0}, .descr = "Number of times to attempt restoring the buffer"},
{"LATENCY_MILLIS", AUD_OPT_INT, &conf.latency_millis, {.name = "GETSTATUS_RETRIES",
"(undocumented)", NULL, 0}, .tag = AUD_OPT_INT,
{"PRIMARY_FREQ", AUD_OPT_INT, &conf.settings.freq, .valp = &conf.getstatus_retries,
"Primary buffer frequency", NULL, 0}, .descr = "Number of times to attempt getting status of the buffer"},
{"PRIMARY_CHANNELS", AUD_OPT_INT, &conf.settings.nchannels, {.name = "SET_PRIMARY",
"Primary buffer number of channels (1 - mono, 2 - stereo)", NULL, 0}, .tag = AUD_OPT_BOOL,
{"PRIMARY_FMT", AUD_OPT_FMT, &conf.settings.fmt, .valp = &conf.set_primary
"Primary buffer format", NULL, 0}, .descr = "Set the parameters of primary buffer"},
{"BUFSIZE_OUT", AUD_OPT_INT, &conf.bufsize_out, {.name = "LATENCY_MILLIS",
"(undocumented)", NULL, 0}, .tag = AUD_OPT_INT,
{"BUFSIZE_IN", AUD_OPT_INT, &conf.bufsize_in, .valp = &conf.latency_millis,
"(undocumented)", NULL, 0}, .descr = "(undocumented)"},
{NULL, 0, NULL, NULL, NULL, 0} {.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 = { static struct audio_pcm_ops dsound_pcm_ops = {

View File

@ -551,19 +551,23 @@ static void qesd_audio_fini (void *opaque)
} }
struct audio_option qesd_options[] = { struct audio_option qesd_options[] = {
{"SAMPLES", AUD_OPT_INT, &conf.samples, {.name = "SAMPLES",
"buffer size in samples", NULL, 0}, .tag = AUD_OPT_INT,
.valp = &conf.samples,
{"DIVISOR", AUD_OPT_INT, &conf.divisor, .descr = "buffer size in samples"},
"threshold divisor", NULL, 0}, {.name = "DIVISOR",
.tag = AUD_OPT_INT,
{"DAC_HOST", AUD_OPT_STR, &conf.dac_host, .valp = &conf.divisor,
"playback host", NULL, 0}, .descr = "threshold divisor"},
{.name = "DAC_HOST",
{"ADC_HOST", AUD_OPT_STR, &conf.adc_host, .tag = AUD_OPT_STR,
"capture host", NULL, 0}, .valp = &conf.dac_host,
.descr = "playback host"},
{NULL, 0, NULL, NULL, NULL, 0} {.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 = { static struct audio_pcm_ops qesd_pcm_ops = {

View File

@ -639,22 +639,33 @@ static void fmod_audio_fini (void *opaque)
} }
static struct audio_option fmod_options[] = { static struct audio_option fmod_options[] = {
{"DRV", AUD_OPT_STR, &conf.drvname, {.name = "DRV",
"FMOD driver", NULL, 0}, .tag = AUD_OPT_STR,
{"FREQ", AUD_OPT_INT, &conf.freq, .valp = &conf.drvname,
"Default frequency", NULL, 0}, .descr = "FMOD driver"},
{"SAMPLES", AUD_OPT_INT, &conf.nb_samples, {.name = "FREQ",
"Buffer size in samples", NULL, 0}, .tag = AUD_OPT_INT,
{"CHANNELS", AUD_OPT_INT, &conf.nb_channels, .valp = &conf.freq,
"Number of default channels (1 - mono, 2 - stereo)", NULL, 0}, .descr = "Default frequency"},
{"BUFSIZE", AUD_OPT_INT, &conf.bufsize, {.name = "SAMPLES",
"(undocumented)", NULL, 0}, .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 #if 0
{"THRESHOLD", AUD_OPT_INT, &conf.threshold, {.name = "THRESHOLD",
"(undocumented)"}, .tag = AUD_OPT_INT,
.valp = &conf.threshold,
.descr = "(undocumented)"}
#endif #endif
{ /* End of list */ }
{NULL, 0, NULL, NULL, NULL, 0}
}; };
static struct audio_pcm_ops fmod_pcm_ops = { static struct audio_pcm_ops fmod_pcm_ops = {

View File

@ -736,19 +736,31 @@ static void oss_audio_fini (void *opaque)
} }
static struct audio_option oss_options[] = { static struct audio_option oss_options[] = {
{"FRAGSIZE", AUD_OPT_INT, &conf.fragsize, {.name = "FRAGSIZE",
"Fragment size in bytes", NULL, 0}, .tag = AUD_OPT_INT,
{"NFRAGS", AUD_OPT_INT, &conf.nfrags, .valp = &conf.fragsize,
"Number of fragments", NULL, 0}, .descr = "Fragment size in bytes"},
{"MMAP", AUD_OPT_BOOL, &conf.try_mmap, {.name = "NFRAGS",
"Try using memory mapped access", NULL, 0}, .tag = AUD_OPT_INT,
{"DAC_DEV", AUD_OPT_STR, &conf.devpath_out, .valp = &conf.nfrags,
"Path to DAC device", NULL, 0}, .descr = "Number of fragments"},
{"ADC_DEV", AUD_OPT_STR, &conf.devpath_in, {.name = "MMAP",
"Path to ADC device", NULL, 0}, .tag = AUD_OPT_BOOL,
{"DEBUG", AUD_OPT_BOOL, &conf.debug, .valp = &conf.try_mmap,
"Turn on some debugging messages", NULL, 0}, .descr = "Try using memory mapped access"},
{NULL, 0, NULL, NULL, NULL, 0} {.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 = { static struct audio_pcm_ops oss_pcm_ops = {

View File

@ -469,22 +469,27 @@ static void qpa_audio_fini (void *opaque)
} }
struct audio_option qpa_options[] = { struct audio_option qpa_options[] = {
{"SAMPLES", AUD_OPT_INT, &conf.samples, {.name = "SAMPLES",
"buffer size in samples", NULL, 0}, .tag = AUD_OPT_INT,
.valp = &conf.samples,
{"DIVISOR", AUD_OPT_INT, &conf.divisor, .descr = "buffer size in samples"},
"threshold divisor", NULL, 0}, {.name = "DIVISOR",
.tag = AUD_OPT_INT,
{"SERVER", AUD_OPT_STR, &conf.server, .valp = &conf.divisor,
"server address", NULL, 0}, .descr = "threshold divisor"},
{.name = "SERVER",
{"SINK", AUD_OPT_STR, &conf.sink, .tag = AUD_OPT_STR,
"sink device name", NULL, 0}, .valp = &conf.server,
.descr = "server address"},
{"SOURCE", AUD_OPT_STR, &conf.source, {.name = "SINK",
"source device name", NULL, 0}, .tag = AUD_OPT_STR,
.valp = &conf.sink,
{NULL, 0, NULL, NULL, NULL, 0} .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 = { static struct audio_pcm_ops qpa_pcm_ops = {

View File

@ -420,9 +420,11 @@ static void sdl_audio_fini (void *opaque)
} }
static struct audio_option sdl_options[] = { static struct audio_option sdl_options[] = {
{"SAMPLES", AUD_OPT_INT, &conf.nb_samples, {.name = "SAMPLES",
"Size of SDL buffer in samples", NULL, 0}, .tag = AUD_OPT_INT,
{NULL, 0, NULL, NULL, NULL, 0} .valp = &conf.nb_samples,
.descr = "Size of SDL buffer in samples"},
{ /* End of list */ }
}; };
static struct audio_pcm_ops sdl_pcm_ops = { static struct audio_pcm_ops sdl_pcm_ops = {

View File

@ -219,18 +219,23 @@ static void wav_audio_fini (void *opaque)
} }
static struct audio_option wav_options[] = { static struct audio_option wav_options[] = {
{"FREQUENCY", AUD_OPT_INT, &conf.settings.freq, {.name = "FREQUENCY",
"Frequency", NULL, 0}, .tag = AUD_OPT_INT,
.valp = &conf.settings.freq,
{"FORMAT", AUD_OPT_FMT, &conf.settings.fmt, .descr = "Frequency"},
"Format", NULL, 0}, {.name = "FORMAT",
.tag = AUD_OPT_FMT,
{"DAC_FIXED_CHANNELS", AUD_OPT_INT, &conf.settings.nchannels, .valp = &conf.settings.fmt,
"Number of channels (1 - mono, 2 - stereo)", NULL, 0}, .descr = "Format"},
{.name = "DAC_FIXED_CHANNELS",
{"PATH", AUD_OPT_STR, &conf.wav_path, .tag = AUD_OPT_INT,
"Path to wave file", NULL, 0}, .valp = &conf.settings.nchannels,
{NULL, 0, NULL, NULL, NULL, 0} .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 = { static struct audio_pcm_ops wav_pcm_ops = {