CVS: rdesktop rdpsnd_alsa.c, 1.10, 1.11 rdpsnd_libao.c, 1.29, 1.30 rdpsnd_oss.c, 1.30, 1.31 rdpsnd_sgi.c, 1.16, 1.17 rdpsnd_sun.c, 1.23, 1.24

Pierre Ossman <[email protected]> Thu, 07 Dec 2006 03:54:32 -0800
Newsgroups gmane.network.rdesktop.cvs
Message-ID <[email protected]>
Update of /cvsroot/rdesktop/rdesktop
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv27339

Modified Files:
	rdpsnd_alsa.c rdpsnd_libao.c rdpsnd_oss.c rdpsnd_sgi.c 
	rdpsnd_sun.c 
Log Message:
Restructure driver registration structures a bit so it is easier to add
new fields (and also reduce some memory usage/leaks).


Index: rdpsnd_alsa.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/rdpsnd_alsa.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** rdpsnd_alsa.c	7 Nov 2006 14:21:39 -0000	1.10
--- rdpsnd_alsa.c	7 Dec 2006 11:54:29 -0000	1.11
***************
*** 277,297 ****
  }
  
  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)
  	{
--- 277,298 ----
  }
  
+ 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)
  {
  	if (options)
  	{

Index: rdpsnd_libao.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/rdpsnd_libao.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** rdpsnd_libao.c	7 Nov 2006 16:48:48 -0000	1.29
--- rdpsnd_libao.c	7 Dec 2006 11:54:29 -0000	1.30
***************
*** 176,196 ****
  }
  
  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)
  	{
--- 176,197 ----
  }
  
+ 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)
  {
  	if (options)
  	{

Index: rdpsnd_oss.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/rdpsnd_oss.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** rdpsnd_oss.c	2 Nov 2006 11:55:59 -0000	1.30
--- rdpsnd_oss.c	7 Dec 2006 11:54:29 -0000	1.31
***************
*** 47,53 ****
  static short samplewidth;
  static char *dsp_dev;
- static struct audio_driver oss_driver;
  static BOOL in_esddsp;
  
  static BOOL
  detect_esddsp(void)
--- 47,55 ----
  static short samplewidth;
  static char *dsp_dev;
  static BOOL in_esddsp;
  
+ /* This is a just a forward declaration */
+ static struct audio_driver oss_driver;
+ 
  static BOOL
  detect_esddsp(void)
***************
*** 297,316 ****
  }
  
  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)
  	{
--- 299,320 ----
  }
  
+ 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)
  {
  	if (options)
  	{

Index: rdpsnd_sgi.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/rdpsnd_sgi.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** rdpsnd_sgi.c	27 Oct 2006 12:29:05 -0000	1.16
--- rdpsnd_sgi.c	7 Dec 2006 11:54:29 -0000	1.17
***************
*** 274,294 ****
  }
  
  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)
  	{
--- 274,295 ----
  }
  
+ 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)
  {
  	if (options)
  	{

Index: rdpsnd_sun.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/rdpsnd_sun.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** rdpsnd_sun.c	27 Oct 2006 12:29:05 -0000	1.23
--- rdpsnd_sun.c	7 Dec 2006 11:54:29 -0000	1.24
***************
*** 243,264 ****
  }
  
  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)
  	{
--- 243,264 ----
  }
  
+ 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)
  {
  	if (options)
  	{


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV