[xiph-cvs] cvs commit: ao/src/plugins/solaris ao_solaris.c

Jack Moffitt jack at xiph.org
Sun Oct 29 20:38:50 PST 2000



jack        00/10/29 20:38:50

  Modified:    src      audio_out.c
               src/plugins/alsa ao_alsa.c
               src/plugins/esd ao_esd.c
               src/plugins/irix ao_irix.c
               src/plugins/oss ao_oss.c
               src/plugins/solaris ao_solaris.c
  Log:
  now this actually works :)

Revision  Changes    Path
1.5       +4 -4      ao/src/audio_out.c

Index: audio_out.c
===================================================================
RCS file: /usr/local/cvsroot/ao/src/audio_out.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- audio_out.c	2000/10/30 00:46:41	1.4
+++ audio_out.c	2000/10/30 04:38:48	1.5
@@ -76,13 +76,13 @@
                         return NULL;
                 }
 
-		dt->functions->get_driver_info = dlsym(dt->handle, "get_driver_info");
+		dt->functions->get_driver_info = dlsym(dt->handle, "plugin_get_driver_info");
                 if (dlerror()) { free(dt->functions); free(dt); return NULL; }
-		dt->functions->open = dlsym(dt->handle, "open");
+		dt->functions->open = dlsym(dt->handle, "plugin_open");
                 if (dlerror()) { free(dt->functions); free(dt); return NULL; }
-		dt->functions->play = dlsym(dt->handle, "play");
+		dt->functions->play = dlsym(dt->handle, "plugin_play");
                 if (dlerror()) { free(dt->functions); free(dt); return NULL; }
-		dt->functions->close = dlsym(dt->handle, "close");
+		dt->functions->close = dlsym(dt->handle, "plugin_close");
                 if (dlerror()) { free(dt->functions); free(dt); return NULL; }
         } else {
                 return NULL;

1.2       +13 -40    ao/src/plugins/alsa/ao_alsa.c

Index: ao_alsa.c
===================================================================
RCS file: /usr/local/cvsroot/ao/src/plugins/alsa/ao_alsa.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ao_alsa.c	2000/10/30 00:46:42	1.1
+++ ao_alsa.c	2000/10/30 04:38:48	1.2
@@ -45,23 +45,21 @@
         int dev;
 } ao_alsa_internal_t;
 
-static ao_info_t ao_alsa_info =
+ao_info_t ao_alsa_info =
 {
         "Advanced Linux Sound Architecture (ALSA) output",
         "alsa",
         "Stan Seibert <volsung at asu.edu>",
-	""
+	"Otuputs to the Advanced Linux Sound Architecture."
 };
 
-static void
-ao_alsa_parse_options(ao_alsa_internal_t *state, ao_option_t *options)
+void ao_alsa_parse_options(ao_alsa_internal_t *state, ao_option_t *options)
 {
         state->card = 0;
         state->dev = 0;
         state->buf_size = AO_ALSA_BUF_SIZE;
 
-	while (options)
-	{
+	while (options) {
                 if (!strcmp(options->key, "card"))
                         state->card = atoi(options->value);
                 else if (!strcmp(options->key, "dev"))
@@ -73,8 +71,7 @@
         }
 }
 
-static ao_internal_t*
-ao_alsa_open (uint_32 bits, uint_32 rate, uint_32 channels, ao_option_t *options)
+ao_internal_t *plugin_open(uint_32 bits, uint_32 rate, uint_32 channels, ao_option_t *options)
 {
         ao_alsa_internal_t *state;
         snd_pcm_channel_params_t param;
@@ -87,8 +84,7 @@
 
         param.format.interleave = 1;
 
-	switch (bits)
-	{
+	switch (bits) {
         case 8  : param.format.format = SND_PCM_SFMT_S8;
                   break;
         case 16 : param.format.format = ao_is_big_endian() ?
@@ -126,16 +122,14 @@
                            state->card, 
                            state->dev,
                            SND_PCM_OPEN_PLAYBACK | SND_PCM_OPEN_NONBLOCK);
-	if ( err < 0 )
-	{
+	if (err < 0) {
                 free(state);
                 return NULL;
         }
 
         err = snd_pcm_channel_params(state->pcm_handle, &param);
 
-	if (err < 0 )
-	{
+	if (err < 0) {
                 snd_pcm_close(state->pcm_handle);
                 free(state);
                 return NULL;
@@ -150,16 +144,14 @@
         return state;
 }
 
-static void
-ao_alsa_close (ao_internal_t *state)
+void plugin_close(ao_internal_t *state)
 {
         ao_alsa_internal_t *s = (ao_alsa_internal_t *) state;
         snd_pcm_close(s->pcm_handle);
         free(s);
 }
 
-static void
-ao_alsa_write_buffer (ao_alsa_internal_t *s)
+void ao_alsa_write_buffer(ao_alsa_internal_t *s)
 {
         snd_pcm_channel_status_t status;
         snd_pcm_t *pcm_handle = s->pcm_handle;
@@ -188,16 +180,14 @@
         }
 }	
 
-static void
-ao_alsa_play (ao_internal_t *state, void* output_samples, uint_32 num_bytes)
+void plugin_play(ao_internal_t *state, void* output_samples, uint_32 num_bytes)
 {
         ao_alsa_internal_t *s = (ao_alsa_internal_t *) state;
         int packed = 0;
         int copy_len;
         char *samples = (char *) output_samples;
 
-	while (packed < num_bytes)
-	{
+	while (packed < num_bytes) {
                 /* Pack the buffer */
                 if (num_bytes-packed < s->buf_size-s->buf_end)
                         copy_len = num_bytes - packed;
@@ -209,28 +199,11 @@
                 s->buf_end += copy_len;
 
                 if(s->buf_end == s->buf_size)
-		{
                         ao_alsa_write_buffer(s);
-		}
         }
 }
 
-static ao_info_t*
-ao_alsa_get_driver_info (void)
+ao_info_t *plugin_get_driver_info(void)
 {
         return &ao_alsa_info;
 }
-
-ao_functions_t ao_alsa = 
-{
-	ao_alsa_get_driver_info,
-	ao_alsa_open,
-	ao_alsa_play,
-	ao_alsa_close
-};
-
-
-
-
-
-

1.2       +9 -30     ao/src/plugins/esd/ao_esd.c

Index: ao_esd.c
===================================================================
RCS file: /usr/local/cvsroot/ao/src/plugins/esd/ao_esd.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ao_esd.c	2000/10/30 00:46:42	1.1
+++ ao_esd.c	2000/10/30 04:38:48	1.2
@@ -39,21 +39,19 @@
         char *host;
 } ao_esd_internal_t;
 
-static ao_info_t ao_esd_info =
+ao_info_t ao_esd_info =
 {
         "ESounD output",
         "esd",
         "Stan Seibert <volsung at asu.edu>",
-	""
+	"Outputs to the Enlighted Sound Daemon."
 };
 
-static void
-ao_esd_parse_options(ao_esd_internal_t *state, ao_option_t *options)
+void ao_esd_parse_options(ao_esd_internal_t *state, ao_option_t *options)
 {
         state->host = NULL;
 
-	while (options)
-	{
+	while (options) {
                 if (!strcmp(options->key, "host"))
                         state->host = strdup(options->value);
                 
@@ -61,8 +59,7 @@
         }
 }
 
-static ao_internal_t*
-ao_esd_open (uint_32 bits, uint_32 rate, uint_32 channels, ao_option_t *options)
+ao_internal_t *plugin_open(uint_32 bits, uint_32 rate, uint_32 channels, ao_option_t *options)
 {
         ao_esd_internal_t *state;
         int esd_bits;
@@ -109,8 +106,7 @@
         return state;
 }
 
-static void
-ao_esd_close (ao_internal_t *state)
+void plugin_close(ao_internal_t *state)
 {
         ao_esd_internal_t *s = (ao_esd_internal_t *) state;
         close(s->sock);
@@ -118,29 +114,12 @@
         free(s);
 }
 
-static void
-ao_esd_play (ao_internal_t *state, void* output_samples, uint_32 num_bytes)
+void plugin_play(ao_internal_t *state, void* output_samples, uint_32 num_bytes)
 {
-	write( ((ao_esd_internal_t *) state)->sock, output_samples, 
-	       num_bytes );
+	write(((ao_esd_internal_t *) state)->sock, output_samples, num_bytes);
 }
 
-static ao_info_t*
-ao_esd_get_driver_info (void)
+ao_info_t *plugin_get_driver_info(void)
 {
         return &ao_esd_info;
 }
-
-ao_functions_t ao_esd = 
-{
-	ao_esd_get_driver_info,
-	ao_esd_open,
-	ao_esd_play,
-	ao_esd_close
-};
-
-
-
-
-
-

1.2       +14 -34    ao/src/plugins/irix/ao_irix.c

Index: ao_irix.c
===================================================================
RCS file: /usr/local/cvsroot/ao/src/plugins/irix/ao_irix.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ao_irix.c	2000/10/30 00:46:42	1.1
+++ ao_irix.c	2000/10/30 04:38:49	1.2
@@ -45,7 +45,7 @@
 } ao_irix_internal_t;
 
 
-static ao_info_t ao_irix_info =
+ao_info_t ao_irix_info =
 {
         "Irix audio output ",
         "irix",
@@ -57,8 +57,7 @@
 /*
  * open the audio device for writing to
  */
-static ao_internal_t*
-ao_irix_open(uint_32 bits, uint_32 rate, uint_32 channels, ao_option_t *options)
+ao_internal_t *plugin_open(uint_32 bits, uint_32 rate, uint_32 channels, ao_option_t *options)
 {
         ALpv params[2];
         int  dev = AL_DEFAULT_OUTPUT;
@@ -75,29 +74,25 @@
 
         state->alconfig = alNewConfig();
 
-	if (alSetQueueSize(state->alconfig, BUFFER_SIZE) < 0) 
-	{
+	if (alSetQueueSize(state->alconfig, BUFFER_SIZE) < 0) {
                 fprintf(stderr, "alSetQueueSize failed: %s\n", 
                         alGetErrorString(oserror()));
                 return 0;
         }
 
-	if (alSetChannels(state->alconfig, channels) < 0) 
-	{
+	if (alSetChannels(state->alconfig, channels) < 0) {
                 fprintf(stderr, "alSetChannels(%d) failed: %s\n", 
                         channels, alGetErrorString(oserror()));
                 return 0;
         }
         
-	if (alSetDevice(state->alconfig, dev) < 0) 
-	{
+	if (alSetDevice(state->alconfig, dev) < 0) {
                 fprintf(stderr, "alSetDevice failed: %s\n", 
                         alGetErrorString(oserror()));
                 return 0;
         }
         
-	if (alSetSampFmt(state->alconfig, AL_SAMPFMT_TWOSCOMP) < 0) 
-	{
+	if (alSetSampFmt(state->alconfig, AL_SAMPFMT_TWOSCOMP) < 0) {
                 fprintf(stderr, "alSetSampFmt failed: %s\n", 
                         alGetErrorString(oserror()));
                 return 0;
@@ -105,15 +100,13 @@
 
         state->alport = alOpenPort("AC3Decode", "w", 0);
 
-	if (!state->alport) 
-	{
+	if (!state->alport) {
                 fprintf(stderr, "alOpenPort failed: %s\n", 
                         alGetErrorString(oserror()));
                 return 0;
         }
 
-	switch (bits) 
-	{
+	switch (bits) {
         case 8:         
                 state->bytesPerWord = 1;
                 wsize = AL_SAMPLE_8;
@@ -134,8 +127,7 @@
                 break;
         }
 
-	if (alSetWidth(state->alconfig, wsize) < 0) 
-	{
+	if (alSetWidth(state->alconfig, wsize) < 0) {
                 fprintf(stderr, "alSetWidth failed: %s\n", alGetErrorString(oserror()));
                 return 0;
         }
@@ -156,17 +148,14 @@
  * play the sample to the already opened file descriptor
  */
 
-static void 
-ao_irix_play(ao_internal_t *state, void* output_samples, uint_32 num_bytes)
+void plugin_play(ao_internal_t *state, void* output_samples, uint_32 num_bytes)
 {
-	alWriteFrames( ((ao_irix_internal_t *) state)->alport, 
-		       output_samples, num_bytes); 
+	alWriteFrames(((ao_irix_internal_t *)state)->alport, output_samples, num_bytes); 
 }
 
-static void
-ao_irix_close(ao_internal_t *state)
+void plugin_close(ao_internal_t *state)
 {
-	ao_irix_internal_t *s = (ao_irix_internal_t *) state;
+	ao_irix_internal_t *s = (ao_irix_internal_t *)state;
 
         alClosePort(s->alport);
         alFreeConfig(s->alconfig);
@@ -174,16 +163,7 @@
         free(state);
 }
 
-static ao_info_t*
-ao_irix_get_driver_info(void)
+ao_info_t *plugin_get_driver_info(void)
 {
         return &ao_irix_info;
 }
-
-ao_functions_t ao_irix =
-{
-        ao_irix_get_driver_info,
-        ao_irix_open,
-        ao_irix_play,
-        ao_irix_close
-};

1.2       +8 -23     ao/src/plugins/oss/ao_oss.c

Index: ao_oss.c
===================================================================
RCS file: /usr/local/cvsroot/ao/src/plugins/oss/ao_oss.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ao_oss.c	2000/10/30 00:46:43	1.1
+++ ao_oss.c	2000/10/30 04:38:49	1.2
@@ -41,12 +41,12 @@
 
 #include <ao/ao.h>
 
-static ao_info_t ao_oss_info =
+ao_info_t ao_oss_info =
 {
         "OSS audio driver output ",
         "oss",
         "Aaron Holtzman <aholtzma at ess.engr.uvic.ca>",
-	""
+	"Outputs audio to the Open Sound System driver."
 };
 
 
@@ -55,13 +55,11 @@
         int fd;
 } ao_oss_internal_t;
 
-static void
-ao_oss_parse_options(ao_oss_internal_t *state, ao_option_t *options)
+void ao_oss_parse_options(ao_oss_internal_t *state, ao_option_t *options)
 {
         state->dev = NULL;
 
-	while (options)
-	{
+	while (options) {
                 if (!strcmp(options->key, "dsp"))
                         state->dev = strdup(options->value);
                 
@@ -75,8 +73,7 @@
 /*
  * open the audio device for writing to
  */
-static ao_internal_t*
-ao_oss_open(uint_32 bits, uint_32 rate, uint_32 channels, ao_option_t *options)
+ao_internal_t *plugin_open(uint_32 bits, uint_32 rate, uint_32 channels, ao_option_t *options)
 {
         ao_oss_internal_t *state;
         int tmp;
@@ -147,16 +144,13 @@
 /*
  * play the sample to the already opened file descriptor
  */
-static void 
-ao_oss_play(ao_internal_t *state, void *output_samples, uint_32 num_bytes)
+void plugin_play(ao_internal_t *state, void *output_samples, uint_32 num_bytes)
 {
-	
         write( ((ao_oss_internal_t *)state)->fd, output_samples, num_bytes);
 }
 
 
-static void
-ao_oss_close(ao_internal_t *state)
+void plugin_close(ao_internal_t *state)
 {
         ao_oss_internal_t *s = (ao_oss_internal_t *) state;
         close(s->fd);
@@ -165,16 +159,7 @@
 }
 
 
-static ao_info_t*
-ao_oss_get_driver_info(void)
+ao_info_t *plugin_get_driver_info(void)
 {
         return &ao_oss_info;
 }
-
-ao_functions_t ao_oss =
-{
-        ao_oss_get_driver_info,
-        ao_oss_open,
-        ao_oss_play,
-        ao_oss_close
-};

1.2       +9 -26     ao/src/plugins/solaris/ao_solaris.c

Index: ao_solaris.c
===================================================================
RCS file: /usr/local/cvsroot/ao/src/plugins/solaris/ao_solaris.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ao_solaris.c	2000/10/30 00:46:43	1.1
+++ ao_solaris.c	2000/10/30 04:38:49	1.2
@@ -41,9 +41,9 @@
 #include <ao/ao.h>
 
 
-static ao_info_t ao_solaris_info =
+ao_info_t ao_solaris_info =
 {
-	"Solaris audio output ",
+	"Solaris audio output",
         "solaris",
         "Aaron Holtzman <aholtzma at ess.engr.uvic.ca>",
         "WARNING: This driver is untested."
@@ -59,10 +59,8 @@
 /*
  * open the audio device for writing to
  */
-static ao_internal_t*
-ao_open(uint_32 bits, uint_32 rate, uint_32 channels, ao_option_t *options)
+ao_internal_t *plugin_open(uint_32 bits, uint_32 rate, uint_32 channels, ao_option_t *options)
 {
-
         ao_solaris_internal_t *state;
 
         state = malloc(sizeof(ao_solaris_internal_t));
@@ -76,8 +74,7 @@
          */
 
         state->fd=open(state->dev,O_WRONLY);
-	if(state->fd < 0) 
-	{
+	if(state->fd < 0) {
                 fprintf(stderr,"%s: Opening audio device %s\n",
                                 strerror(errno), state->dev);
                 goto ERR;
@@ -98,8 +95,7 @@
         /* An implicit GETINFO is also performed so we can get
          * the buffer_size */
 
-	if(ioctl(state->fd, AUDIO_SETINFO, &(state->info)) < 0)
-	{
+	if(ioctl(state->fd, AUDIO_SETINFO, &(state->info)) < 0) {
                 fprintf(stderr, "%s: Writing audio config block\n",strerror(errno));
                 goto ERR;
         }
@@ -114,32 +110,19 @@
 /*
  * play the sample to the already opened file descriptor
  */
-static void 
-ao_solaris_play(ao_internal_t *state, void *output_samples, uint_32 num_bytes)
+void plugin_play(ao_internal_t *state, void *output_samples, uint_32 num_bytes)
 {
-	write( ((ao_solaris_internal_t *) state)->fd,
-	       output_samples, num_bytes);
+	write(((ao_solaris_internal_t *)state)->fd, output_samples, num_bytes);
 }
 
 
-static void
-ao_solaris_close(ao_internal_t *state)
+void plugin_close(ao_internal_t *state)
 {
         close(((ao_solaris_internal_t *) state)->fd);
         free(state);
 }
 
-static const ao_info_t*
-ao_solaris_get_driver_info(void)
+const ao_info_t *plugin_get_driver_info(void)
 {
         return &ao_solaris_info;
 }
-
-
-ao_functions_t ao_solaris =
-{
-        ao_solaris_get_driver_info,
-        ao_solaris_open,
-        ao_solaris_play,
-        ao_solaris_close
-};

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list