Restructure driver registration structures a bit so it is easier to add

new fields (and also reduce some memory usage/leaks).


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1344 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
Pierre Ossman 2006-12-07 11:54:29 +00:00
parent 7180a70b7a
commit 139e42d9ef
5 changed files with 78 additions and 71 deletions

View File

@ -276,23 +276,24 @@ alsa_play(void)
return;
}
static struct audio_driver alsa_driver = {
.name = "alsa",
.description = "ALSA output driver, default device: " DEFAULTDEVICE,
.wave_out_open = alsa_open,
.wave_out_close = alsa_close,
.wave_out_format_supported = alsa_format_supported,
.wave_out_set_format = alsa_set_format,
.wave_out_volume = rdpsnd_dsp_softvol_set,
.wave_out_play = alsa_play,
.need_byteswap_on_be = 0,
.need_resampling = 0,
};
struct audio_driver *
alsa_register(char *options)
{
static struct audio_driver alsa_driver;
alsa_driver.wave_out_open = alsa_open;
alsa_driver.wave_out_close = alsa_close;
alsa_driver.wave_out_format_supported = alsa_format_supported;
alsa_driver.wave_out_set_format = alsa_set_format;
alsa_driver.wave_out_volume = rdpsnd_dsp_softvol_set;
alsa_driver.wave_out_play = alsa_play;
alsa_driver.name = xstrdup("alsa");
alsa_driver.description = xstrdup("ALSA output driver, default device: " DEFAULTDEVICE);
alsa_driver.need_byteswap_on_be = 0;
alsa_driver.need_resampling = 0;
alsa_driver.next = NULL;
if (options)
{
pcm_name = xstrdup(options);

View File

@ -175,23 +175,24 @@ libao_play(void)
return;
}
static struct audio_driver libao_driver = {
.name = "libao",
.description = "libao output driver, default device: system dependent",
.wave_out_open = libao_open,
.wave_out_close = libao_close,
.wave_out_format_supported = rdpsnd_dsp_resample_supported,
.wave_out_set_format = libao_set_format,
.wave_out_volume = rdpsnd_dsp_softvol_set,
.wave_out_play = libao_play,
.need_byteswap_on_be = 1,
.need_resampling = 1,
};
struct audio_driver *
libao_register(char *options)
{
static struct audio_driver libao_driver;
libao_driver.wave_out_open = libao_open;
libao_driver.wave_out_close = libao_close;
libao_driver.wave_out_format_supported = rdpsnd_dsp_resample_supported;
libao_driver.wave_out_set_format = libao_set_format;
libao_driver.wave_out_volume = rdpsnd_dsp_softvol_set;
libao_driver.wave_out_play = libao_play;
libao_driver.name = xstrdup("libao");
libao_driver.description = xstrdup("libao output driver, default device: system dependent");
libao_driver.need_byteswap_on_be = 1;
libao_driver.need_resampling = 1;
libao_driver.next = NULL;
if (options)
{
libao_device = xstrdup(options);

View File

@ -46,9 +46,11 @@
static int snd_rate;
static short samplewidth;
static char *dsp_dev;
static struct audio_driver oss_driver;
static BOOL in_esddsp;
/* This is a just a forward declaration */
static struct audio_driver oss_driver;
static BOOL
detect_esddsp(void)
{
@ -296,22 +298,24 @@ oss_play(void)
return;
}
static struct audio_driver oss_driver = {
.name = "oss",
.description = "OSS output driver, default device: " DEFAULTDEVICE " or $AUDIODEV",
.wave_out_open = oss_open,
.wave_out_close = oss_close,
.wave_out_format_supported = oss_format_supported,
.wave_out_set_format = oss_set_format,
.wave_out_volume = oss_volume,
.wave_out_play = oss_play,
.need_byteswap_on_be = 0,
.need_resampling = 0,
};
struct audio_driver *
oss_register(char *options)
{
oss_driver.wave_out_open = oss_open;
oss_driver.wave_out_close = oss_close;
oss_driver.wave_out_format_supported = oss_format_supported;
oss_driver.wave_out_set_format = oss_set_format;
oss_driver.wave_out_volume = oss_volume;
oss_driver.wave_out_play = oss_play;
oss_driver.name = xstrdup("oss");
oss_driver.description =
xstrdup("OSS output driver, default device: " DEFAULTDEVICE " or $AUDIODEV");
oss_driver.need_byteswap_on_be = 0;
oss_driver.need_resampling = 0;
oss_driver.next = NULL;
if (options)
{
dsp_dev = xstrdup(options);

View File

@ -273,23 +273,24 @@ sgi_play(void)
}
}
static struct audio_driver sgi_driver = {
.name = "sgi",
.description = "SGI output driver",
.wave_out_open = sgi_open,
.wave_out_close = sgi_close,
.wave_out_format_supported = sgi_format_supported,
.wave_out_set_format = sgi_set_format,
.wave_out_volume = sgi_volume,
.wave_out_play = sgi_play,
.need_byteswap_on_be = 1,
.need_resampling = 0,
};
struct audio_driver *
sgi_register(char *options)
{
static struct audio_driver sgi_driver;
sgi_driver.wave_out_open = sgi_open;
sgi_driver.wave_out_close = sgi_close;
sgi_driver.wave_out_format_supported = sgi_format_supported;
sgi_driver.wave_out_set_format = sgi_set_format;
sgi_driver.wave_out_volume = sgi_volume;
sgi_driver.wave_out_play = sgi_play;
sgi_driver.name = xstrdup("sgi");
sgi_driver.description = xstrdup("SGI output driver");
sgi_driver.need_byteswap_on_be = 1;
sgi_driver.need_resampling = 0;
sgi_driver.next = NULL;
if (options)
{
sgi_output_device = xstrdup(options);

View File

@ -242,24 +242,24 @@ sun_play(void)
}
}
static struct audio_driver sun_driver = {
.name = "sun",
.description = "SUN/BSD output driver, default device: " DEFAULTDEVICE " or $AUDIODEV",
.wave_out_open = sun_open,
.wave_out_close = sun_close,
.wave_out_format_supported = sun_format_supported,
.wave_out_set_format = sun_set_format,
.wave_out_volume = sun_volume,
.wave_out_play = sun_play,
.need_byteswap_on_be = 1,
.need_resampling = 0,
};
struct audio_driver *
sun_register(char *options)
{
static struct audio_driver sun_driver;
sun_driver.wave_out_open = sun_open;
sun_driver.wave_out_close = sun_close;
sun_driver.wave_out_format_supported = sun_format_supported;
sun_driver.wave_out_set_format = sun_set_format;
sun_driver.wave_out_volume = sun_volume;
sun_driver.wave_out_play = sun_play;
sun_driver.name = xstrdup("sun");
sun_driver.description =
xstrdup("SUN/BSD output driver, default device: " DEFAULTDEVICE " or $AUDIODEV");
sun_driver.need_byteswap_on_be = 1;
sun_driver.need_resampling = 0;
sun_driver.next = NULL;
if (options)
{
dsp_dev = xstrdup(options);