use C99 struct initializers

The old struct initializers are error prone and don't allow moving
elements around.  Since we are going to overhaul some of the APIs
soon, it's easier to have all implementations use C99 initializers.
This commit is contained in:
Max Kellermann 2008-09-29 15:55:17 +02:00
parent 21d3d300fd
commit de7cda1d6e
20 changed files with 141 additions and 190 deletions

View File

@ -406,15 +406,14 @@ static int alsa_playAudio(void *data, const char *playChunk, size_t size)
} }
const struct audio_output_plugin alsaPlugin = { const struct audio_output_plugin alsaPlugin = {
"alsa", .name = "alsa",
alsa_testDefault, .test_default_device = alsa_testDefault,
alsa_initDriver, .init = alsa_initDriver,
alsa_finishDriver, .finish = alsa_finishDriver,
alsa_openDevice, .open = alsa_openDevice,
alsa_playAudio, .play = alsa_playAudio,
alsa_dropBufferedAudio, .cancel = alsa_dropBufferedAudio,
alsa_closeDevice, .close = alsa_closeDevice,
NULL, /* sendMetadataFunc */
}; };
#else /* HAVE ALSA */ #else /* HAVE ALSA */

View File

@ -238,15 +238,13 @@ static int audioOutputAo_play(void *data, const char *playChunk, size_t size)
} }
const struct audio_output_plugin aoPlugin = { const struct audio_output_plugin aoPlugin = {
"ao", .name = "ao",
NULL, .init = audioOutputAo_initDriver,
audioOutputAo_initDriver, .finish = audioOutputAo_finishDriver,
audioOutputAo_finishDriver, .open = audioOutputAo_openDevice,
audioOutputAo_openDevice, .play = audioOutputAo_play,
audioOutputAo_play, .cancel = audioOutputAo_dropBufferedAudio,
audioOutputAo_dropBufferedAudio, .close = audioOutputAo_closeDevice,
audioOutputAo_closeDevice,
NULL, /* sendMetadataFunc */
}; };
#else #else

View File

@ -270,15 +270,13 @@ static int fifo_playAudio(void *data,
} }
const struct audio_output_plugin fifoPlugin = { const struct audio_output_plugin fifoPlugin = {
"fifo", .name = "fifo",
NULL, /* testDefaultDeviceFunc */ .init = fifo_initDriver,
fifo_initDriver, .finish = fifo_finishDriver,
fifo_finishDriver, .open = fifo_openDevice,
fifo_openDevice, .play = fifo_playAudio,
fifo_playAudio, .cancel = fifo_dropBufferedAudio,
fifo_dropBufferedAudio, .close = fifo_closeDevice,
fifo_closeDevice,
NULL, /* sendMetadataFunc */
}; };
#else /* HAVE_FIFO */ #else /* HAVE_FIFO */

View File

@ -435,15 +435,14 @@ static int jack_playAudio(void *data,
} }
const struct audio_output_plugin jackPlugin = { const struct audio_output_plugin jackPlugin = {
"jack", .name = "jack",
jack_testDefault, .test_default_device = jack_testDefault,
jack_initDriver, .init = jack_initDriver,
jack_finishDriver, .finish = jack_finishDriver,
jack_openDevice, .open = jack_openDevice,
jack_playAudio, .play = jack_playAudio,
jack_dropBufferedAudio, .cancel = jack_dropBufferedAudio,
jack_closeDevice, .close = jack_closeDevice,
NULL, /* sendMetadataFunc */
}; };
#else /* HAVE JACK */ #else /* HAVE JACK */

View File

@ -257,15 +257,14 @@ static int mvp_playAudio(struct audio_output *audioOutput,
} }
const struct audio_output_plugin mvpPlugin = { const struct audio_output_plugin mvpPlugin = {
"mvp", .name = "mvp",
mvp_testDefault, .test_default_device = mvp_testDefault,
mvp_initDriver, .init = mvp_initDriver,
mvp_finishDriver, .finish = mvp_finishDriver,
mvp_openDevice, .open = mvp_openDevice,
mvp_playAudio, .play = mvp_playAudio,
mvp_dropBufferedAudio, .cancel = mvp_dropBufferedAudio,
mvp_closeDevice, .close = mvp_closeDevice,
NULL, /* sendMetadataFunc */
}; };
#else /* HAVE_MVP */ #else /* HAVE_MVP */

View File

@ -76,13 +76,10 @@ static void null_dropBufferedAudio(void *data)
} }
const struct audio_output_plugin nullPlugin = { const struct audio_output_plugin nullPlugin = {
"null", .name = "null",
NULL, .init = null_initDriver,
null_initDriver, .open = null_openDevice,
NULL, .play = null_playAudio,
null_openDevice, .cancel = null_dropBufferedAudio,
null_playAudio, .close = null_closeDevice,
null_dropBufferedAudio,
null_closeDevice,
NULL,
}; };

View File

@ -544,15 +544,14 @@ static int oss_playAudio(void *data,
} }
const struct audio_output_plugin ossPlugin = { const struct audio_output_plugin ossPlugin = {
"oss", .name = "oss",
oss_testDefault, .test_default_device = oss_testDefault,
oss_initDriver, .init = oss_initDriver,
oss_finishDriver, .finish = oss_finishDriver,
oss_openDevice, .open = oss_openDevice,
oss_playAudio, .play = oss_playAudio,
oss_dropBufferedAudio, .cancel = oss_dropBufferedAudio,
oss_closeDevice, .close = oss_closeDevice,
NULL, /* sendMetadataFunc */
}; };
#else /* HAVE OSS */ #else /* HAVE OSS */

View File

@ -353,15 +353,14 @@ static int osx_play(struct audio_output *audioOutput,
} }
const struct audio_output_plugin osxPlugin = { const struct audio_output_plugin osxPlugin = {
"osx", .name = "osx",
osx_testDefault, .test_default_device = osx_testDefault,
osx_initDriver, .init = osx_initDriver,
osx_finishDriver, .finish = osx_finishDriver,
osx_openDevice, .open = osx_openDevice,
osx_play, .play = osx_play,
osx_dropBufferedAudio, .cancel = osx_dropBufferedAudio,
osx_closeDevice, .close = osx_closeDevice,
NULL, /* sendMetadataFunc */
}; };
#else #else

View File

@ -204,15 +204,14 @@ static int pulse_playAudio(void *data,
} }
const struct audio_output_plugin pulsePlugin = { const struct audio_output_plugin pulsePlugin = {
"pulse", .name = "pulse",
pulse_testDefault, .test_default_device = pulse_testDefault,
pulse_initDriver, .init = pulse_initDriver,
pulse_finishDriver, .finish = pulse_finishDriver,
pulse_openDevice, .open = pulse_openDevice,
pulse_playAudio, .play = pulse_playAudio,
pulse_dropBufferedAudio, .cancel = pulse_dropBufferedAudio,
pulse_closeDevice, .close = pulse_closeDevice,
NULL, /* sendMetadataFunc */
}; };
#else /* HAVE_PULSE */ #else /* HAVE_PULSE */

View File

@ -534,15 +534,14 @@ static void my_shout_set_tag(void *data,
} }
const struct audio_output_plugin shoutPlugin = { const struct audio_output_plugin shoutPlugin = {
"shout", .name = "shout",
NULL, .init = my_shout_init_driver,
my_shout_init_driver, .finish = my_shout_finish_driver,
my_shout_finish_driver, .open = my_shout_open_device,
my_shout_open_device, .play = my_shout_play,
my_shout_play, .cancel = my_shout_drop_buffered_audio,
my_shout_drop_buffered_audio, .close = my_shout_close_device,
my_shout_close_device, .send_tag = my_shout_set_tag,
my_shout_set_tag,
}; };
#else #else

View File

@ -593,16 +593,13 @@ static const char *aac_suffixes[] = { "aac", NULL };
static const char *aac_mimeTypes[] = { "audio/aac", "audio/aacp", NULL }; static const char *aac_mimeTypes[] = { "audio/aac", "audio/aacp", NULL };
struct decoder_plugin aacPlugin = { struct decoder_plugin aacPlugin = {
"aac", .name = "aac",
NULL, .stream_decode = aac_stream_decode,
NULL, .file_decode = aac_decode,
NULL, .tag_dup = aacTagDup,
aac_stream_decode, .stream_types = INPUT_PLUGIN_STREAM_FILE | INPUT_PLUGIN_STREAM_URL,
aac_decode, .suffixes = aac_suffixes,
aacTagDup, .mime_types = aac_mimeTypes
INPUT_PLUGIN_STREAM_FILE | INPUT_PLUGIN_STREAM_URL,
aac_suffixes,
aac_mimeTypes
}; };
#else #else

View File

@ -141,16 +141,11 @@ static struct tag *audiofileTagDup(char *file)
static const char *audiofileSuffixes[] = { "wav", "au", "aiff", "aif", NULL }; static const char *audiofileSuffixes[] = { "wav", "au", "aiff", "aif", NULL };
struct decoder_plugin audiofilePlugin = { struct decoder_plugin audiofilePlugin = {
"audiofile", .name = "audiofile",
NULL, .file_decode = audiofile_decode,
NULL, .tag_dup = audiofileTagDup,
NULL, .stream_types = INPUT_PLUGIN_STREAM_FILE,
NULL, .suffixes = audiofileSuffixes,
audiofile_decode,
audiofileTagDup,
INPUT_PLUGIN_STREAM_FILE,
audiofileSuffixes,
NULL
}; };
#else #else

View File

@ -464,16 +464,13 @@ static const char *flac_mime_types[] = { "audio/x-flac",
NULL }; NULL };
struct decoder_plugin flacPlugin = { struct decoder_plugin flacPlugin = {
"flac", .name = "flac",
flac_plugin_init, .init = flac_plugin_init,
NULL, .stream_decode = flac_decode,
NULL, .tag_dup = flacTagDup,
flac_decode, .stream_types = INPUT_PLUGIN_STREAM_URL | INPUT_PLUGIN_STREAM_FILE,
NULL, .suffixes = flacSuffixes,
flacTagDup, .mime_types = flac_mime_types
INPUT_PLUGIN_STREAM_URL | INPUT_PLUGIN_STREAM_FILE,
flacSuffixes,
flac_mime_types
}; };
#else /* !HAVE_FLAC */ #else /* !HAVE_FLAC */

View File

@ -272,16 +272,12 @@ static const char *modSuffixes[] = { "amf",
}; };
struct decoder_plugin modPlugin = { struct decoder_plugin modPlugin = {
"mod", .name = "mod",
NULL, .finish = mod_finishMikMod,
mod_finishMikMod, .file_decode = mod_decode,
NULL, .tag_dup = modTagDup,
NULL, .stream_types = INPUT_PLUGIN_STREAM_FILE,
mod_decode, .suffixes = modSuffixes,
modTagDup,
INPUT_PLUGIN_STREAM_FILE,
modSuffixes,
NULL
}; };
#else #else

View File

@ -1122,16 +1122,13 @@ static const char *mp3_suffixes[] = { "mp3", "mp2", NULL };
static const char *mp3_mimeTypes[] = { "audio/mpeg", NULL }; static const char *mp3_mimeTypes[] = { "audio/mpeg", NULL };
struct decoder_plugin mp3Plugin = { struct decoder_plugin mp3Plugin = {
"mp3", .name = "mp3",
mp3_plugin_init, .init = mp3_plugin_init,
NULL, .stream_decode = mp3_decode,
NULL, .tag_dup = mp3_tagDup,
mp3_decode, .stream_types = INPUT_PLUGIN_STREAM_FILE | INPUT_PLUGIN_STREAM_URL,
NULL, .suffixes = mp3_suffixes,
mp3_tagDup, .mime_types = mp3_mimeTypes
INPUT_PLUGIN_STREAM_FILE | INPUT_PLUGIN_STREAM_URL,
mp3_suffixes,
mp3_mimeTypes
}; };
#else #else

View File

@ -416,16 +416,12 @@ static const char *mp4_suffixes[] = { "m4a", "mp4", NULL };
static const char *mp4_mimeTypes[] = { "audio/mp4", "audio/m4a", NULL }; static const char *mp4_mimeTypes[] = { "audio/mp4", "audio/m4a", NULL };
struct decoder_plugin mp4Plugin = { struct decoder_plugin mp4Plugin = {
"mp4", .name = "mp4",
NULL, .stream_decode = mp4_decode,
NULL, .tag_dup = mp4TagDup,
NULL, .stream_types = INPUT_PLUGIN_STREAM_FILE | INPUT_PLUGIN_STREAM_URL,
mp4_decode, .suffixes = mp4_suffixes,
NULL, .mime_types = mp4_mimeTypes,
mp4TagDup,
INPUT_PLUGIN_STREAM_FILE | INPUT_PLUGIN_STREAM_URL,
mp4_suffixes,
mp4_mimeTypes
}; };
#else #else

View File

@ -303,16 +303,11 @@ static struct tag *mpcTagDup(char *file)
static const char *mpcSuffixes[] = { "mpc", NULL }; static const char *mpcSuffixes[] = { "mpc", NULL };
struct decoder_plugin mpcPlugin = { struct decoder_plugin mpcPlugin = {
"mpc", .name = "mpc",
NULL, .stream_decode = mpc_decode,
NULL, .tag_dup = mpcTagDup,
NULL, .stream_types = INPUT_PLUGIN_STREAM_URL | INPUT_PLUGIN_STREAM_FILE,
mpc_decode, .suffixes = mpcSuffixes,
NULL,
mpcTagDup,
INPUT_PLUGIN_STREAM_URL | INPUT_PLUGIN_STREAM_FILE,
mpcSuffixes,
NULL
}; };
#else #else

View File

@ -348,16 +348,13 @@ static const char *oggflac_mime_types[] = { "audio/x-flac+ogg",
NULL }; NULL };
struct decoder_plugin oggflacPlugin = { struct decoder_plugin oggflacPlugin = {
"oggflac", .name = "oggflac",
NULL, .try_decode = oggflac_try_decode,
NULL, .stream_decode = oggflac_decode,
oggflac_try_decode, .tag_dup = oggflac_TagDup,
oggflac_decode, .stream_types = INPUT_PLUGIN_STREAM_URL | INPUT_PLUGIN_STREAM_FILE,
NULL, .suffixes = oggflac_Suffixes,
oggflac_TagDup, .mime_types = oggflac_mime_types
INPUT_PLUGIN_STREAM_URL | INPUT_PLUGIN_STREAM_FILE,
oggflac_Suffixes,
oggflac_mime_types
}; };
#else /* !HAVE_FLAC */ #else /* !HAVE_FLAC */

View File

@ -382,16 +382,13 @@ static const char *oggvorbis_MimeTypes[] = { "application/ogg",
NULL }; NULL };
struct decoder_plugin oggvorbisPlugin = { struct decoder_plugin oggvorbisPlugin = {
"oggvorbis", .name = "oggvorbis",
NULL, .try_decode = oggvorbis_try_decode,
NULL, .stream_decode = oggvorbis_decode,
oggvorbis_try_decode, .tag_dup = oggvorbis_TagDup,
oggvorbis_decode, .stream_types = INPUT_PLUGIN_STREAM_URL | INPUT_PLUGIN_STREAM_FILE,
NULL, .suffixes = oggvorbis_Suffixes,
oggvorbis_TagDup, .mime_types = oggvorbis_MimeTypes
INPUT_PLUGIN_STREAM_URL | INPUT_PLUGIN_STREAM_FILE,
oggvorbis_Suffixes,
oggvorbis_MimeTypes
}; };
#else /* !HAVE_OGGVORBIS */ #else /* !HAVE_OGGVORBIS */

View File

@ -567,16 +567,14 @@ static char const *wavpackSuffixes[] = { "wv", NULL };
static char const *wavpackMimeTypes[] = { "audio/x-wavpack", NULL }; static char const *wavpackMimeTypes[] = { "audio/x-wavpack", NULL };
struct decoder_plugin wavpackPlugin = { struct decoder_plugin wavpackPlugin = {
"wavpack", .name = "wavpack",
NULL, .try_decode = wavpack_trydecode,
NULL, .stream_decode = wavpack_streamdecode,
wavpack_trydecode, .file_decode = wavpack_filedecode,
wavpack_streamdecode, .tag_dup = wavpack_tagdup,
wavpack_filedecode, .stream_types = INPUT_PLUGIN_STREAM_FILE | INPUT_PLUGIN_STREAM_URL,
wavpack_tagdup, .suffixes = wavpackSuffixes,
INPUT_PLUGIN_STREAM_FILE | INPUT_PLUGIN_STREAM_URL, .mime_types = wavpackMimeTypes
wavpackSuffixes,
wavpackMimeTypes
}; };
#else /* !HAVE_WAVPACK */ #else /* !HAVE_WAVPACK */