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

Jack Moffitt jack at xiph.org
Fri Feb 23 17:31:49 PST 2001



jack        01/02/23 17:31:49

  Modified:    .        configure.in
               include/ao ao.h
               src      ao_null.c ao_wav.c audio_out.c
               src/plugins/alsa ao_alsa.c
               src/plugins/arts ao_arts.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:
  rik at kde.org's ao_get_latency patch + fixes to make it compile
  incremented teh library version

Revision  Changes    Path
1.16      +1 -1      ao/configure.in

Index: configure.in
===================================================================
RCS file: /usr/local/cvsroot/ao/configure.in,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- configure.in	2001/02/24 01:21:03	1.15
+++ configure.in	2001/02/24 01:31:45	1.16
@@ -7,7 +7,7 @@
 dnl Library versioning
 LIB_CURRENT=1
 LIB_REVISION=0
-LIB_AGE=0
+LIB_AGE=1
 AC_SUBST(LIB_CURRENT)
 AC_SUBST(LIB_REVISION)
 AC_SUBST(LIB_AGE)

1.11      +4 -0      ao/include/ao/ao.h

Index: ao.h
===================================================================
RCS file: /usr/local/cvsroot/ao/include/ao/ao.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- ao.h	2001/02/24 01:21:03	1.10
+++ ao.h	2001/02/24 01:31:46	1.11
@@ -61,6 +61,7 @@
         ao_internal_t *(*open)(uint_32 bits, uint_32 rate, uint_32 channels, ao_option_t *options);
         void (*play)(ao_internal_t *state, void* output_samples, uint_32 num_bytes);
         void (*close)(ao_internal_t *state);
+	int (*get_latency)(ao_internal_t *state);
 } ao_functions_t;
 
 typedef struct ao_device_s {
@@ -96,6 +97,9 @@
 
 /* misc functions */
 int ao_is_big_endian(void);
+
+/* returns the number of bytes buffered by the driver / output device */
+int ao_get_latency(ao_device_t *device);
 
 #ifdef __cplusplus
 }

1.3       +7 -1      ao/src/ao_null.c

Index: ao_null.c
===================================================================
RCS file: /usr/local/cvsroot/ao/src/ao_null.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ao_null.c	2000/10/30 00:46:41	1.2
+++ ao_null.c	2001/02/24 01:31:46	1.3
@@ -73,9 +73,15 @@
         return &ao_null_info;
 }
 
+static int ao_null_get_latency(void)
+{
+	return 0;
+}
+
 ao_functions_t ao_null = {
         ao_null_get_driver_info,
         ao_null_open,
         ao_null_play,
-	ao_null_close
+	ao_null_close,
+	ao_null_get_latency
 };

1.6       +7 -1      ao/src/ao_wav.c

Index: ao_wav.c
===================================================================
RCS file: /usr/local/cvsroot/ao/src/ao_wav.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ao_wav.c	2000/12/24 06:21:51	1.5
+++ ao_wav.c	2001/02/24 01:31:46	1.6
@@ -300,6 +300,11 @@
         free(s);
 }
 
+static int ao_wav_get_latency(void)
+{
+	return 0;
+}
+
 static ao_info_t *ao_wav_get_driver_info(void)
 {
         return &ao_wav_info;
@@ -328,5 +333,6 @@
         ao_wav_get_driver_info,
         ao_wav_open,
         ao_wav_play,
-        ao_wav_close
+        ao_wav_close,
+        ao_wav_get_latency
 };

1.12      +8 -0      ao/src/audio_out.c

Index: audio_out.c
===================================================================
RCS file: /usr/local/cvsroot/ao/src/audio_out.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- audio_out.c	2001/02/24 01:21:04	1.11
+++ audio_out.c	2001/02/24 01:31:46	1.12
@@ -84,6 +84,8 @@
                 if (dlerror()) { free(dt->functions); free(dt); return NULL; }
                 dt->functions->close = dlsym(dt->handle, "plugin_close");
                 if (dlerror()) { free(dt->functions); free(dt); return NULL; }
+		dt->functions->get_latency = dlsym(dt->handle, "plugin_get_latency");
+		if (dlerror()) { free(dt->functions); free(dt); return NULL; }
         } else {
                 return NULL;
         }
@@ -318,3 +320,9 @@
         if (bytewise[0] == 0xba) return 1;
         return 0;
 }
+
+int ao_get_latency(ao_device_t *device)
+{
+	return device->funcs->get_latency(device->state);
+}
+

1.4       +8 -0      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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ao_alsa.c	2001/01/23 21:45:03	1.3
+++ ao_alsa.c	2001/02/24 01:31:47	1.4
@@ -212,6 +212,14 @@
         }
 }
 
+int plugin_get_latency(ao_internal_t *state)
+{
+	ao_alsa_internal_t * s = (ao_alsa_internal_t *) state;
+	snd_pcm_channel_status_t status;
+	int err = snd_pcm_channel_status(s->pcm_handle, &status);
+	return (err < 0 ? 0 : status.count);
+}
+
 ao_info_t *plugin_get_driver_info(void)
 {
         return &ao_alsa_info;

1.2       +22 -6     ao/src/plugins/arts/ao_arts.c

Index: ao_arts.c
===================================================================
RCS file: /usr/local/cvsroot/ao/src/plugins/arts/ao_arts.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ao_arts.c	2000/12/30 05:03:25	1.1
+++ ao_arts.c	2001/02/24 01:31:47	1.2
@@ -32,14 +32,17 @@
 typedef struct ao_arts_internal_s
 {
   arts_stream_t stream;
+	uint_32 bits;
+	uint_32 rate;
+	uint_32 channels;
 } ao_arts_internal_t;
 
 ao_info_t ao_arts_info =
 {
-	"aRts output",
-	"arts",
-	"Rik Hemsley (rikkus) <rik at kde.org>",
-	"Outputs to the aRts soundserver."
+  "aRts output",
+  "arts",
+  "Rik Hemsley (rikkus) <rik at kde.org>",
+  "Outputs to the aRts soundserver."
 };
 
   ao_internal_t *
@@ -74,7 +77,11 @@
 
   state->stream = arts_play_stream(rate, bits, channels, "ao stream");
 
-	return state;
+	state->bits = bits;
+	state->rate = rate;
+	state->channels = channels;
+
+  return state;
 }
 
   void
@@ -102,9 +109,18 @@
   }
 }
 
+  int
+plugin_get_latency(ao_internal_t * state)
+{
+  ao_arts_internal_t * s = (ao_arts_internal_t *)state;
+	int ms = arts_stream_get(s->stream, ARTS_P_TOTAL_LATENCY);
+	int sample_rate = (s->bits / 8) * s->rate * s->channels;
+	return (sample_rate * ms) / 1000;
+}
+
   ao_info_t *
 plugin_get_driver_info(void)
 {
-	return &ao_arts_info;
+  return &ao_arts_info;
 }
 

1.3       +7 -1      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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ao_esd.c	2000/10/30 04:38:48	1.2
+++ ao_esd.c	2001/02/24 01:31:47	1.3
@@ -108,7 +108,7 @@
 
 void plugin_close(ao_internal_t *state)
 {
-	ao_esd_internal_t *s = (ao_esd_internal_t *) state;
+	ao_esd_internal_t *s = (ao_esd_internal_t *)state;
         close(s->sock);
         free(s->host);
         free(s);
@@ -117,6 +117,12 @@
 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);
+}
+
+int plugin_get_latency(ao_internal_t *state)
+{
+	ao_esd_internal_t *s = (ao_esd_internal_t *)state;
+	return (esd_get_latency(s->sock));
 }
 
 ao_info_t *plugin_get_driver_info(void)

1.3       +6 -0      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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ao_irix.c	2000/10/30 04:38:49	1.2
+++ ao_irix.c	2001/02/24 01:31:48	1.3
@@ -163,6 +163,12 @@
         free(state);
 }
 
+int plugin_get_latency(ao_internal_t *state)
+{
+	/* TODO */
+	return 0;
+}
+
 ao_info_t *plugin_get_driver_info(void)
 {
         return &ao_irix_info;

1.6       +6 -1      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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ao_oss.c	2001/02/02 10:02:06	1.5
+++ ao_oss.c	2001/02/24 01:31:48	1.6
@@ -166,7 +166,6 @@
         ioctl(state->fd,SNDCTL_DSP_SPEED, &tmp);
         
         return state;
-	
 
  ERR:
         if(state != NULL)
@@ -196,6 +195,12 @@
         free(s);
 }
 
+int plugin_get_latency(ao_internal_t *state)
+{
+	int odelay = 0;
+	ioctl(((ao_oss_internal_t *)state)->fd, SNDCTL_DSP_GETODELAY, &odelay);
+	return odelay;
+}
 
 ao_info_t *plugin_get_driver_info(void)
 {

1.3       +6 -0      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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ao_solaris.c	2000/10/30 04:38:49	1.2
+++ ao_solaris.c	2001/02/24 01:31:48	1.3
@@ -122,6 +122,12 @@
         free(state);
 }
 
+int plugin_get_latency(ao_internal_t *state)
+{
+	/* TODO */
+	return 0;
+}
+
 const ao_info_t *plugin_get_driver_info(void)
 {
         return &ao_solaris_info;

--- >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