[vorbis-dev] libao AU driver
William T. Mahan
wtm2 at duke.edu
Tue May 8 20:32:30 PDT 2001
Hi,
I noticed there was some discussion on this list about the desire
for ogg123 to support output to stdout via Sun's .au file format, so
I decided to give implementing an AU driver for libao a shot. Here
is my first attempt.
To test the driver:
* Apply the patch below (against ao in CVS)
* Copy the attached ao_au.c into ao/src
* Run ao/autogen.sh, compile, and install
* Test: e.g. ogg123 -d au -o file:- | play -t au -
This is my first patch to libao, so any comments or suggestions
would be appreciated. Thanks to Stan Seibert for the raw
output driver, which I used as an example. I hope someone
finds this driver useful.
Regards,
Wil Mahan
Index: doc/DRIVERS
===================================================================
RCS file: /usr/local/cvsroot/ao/doc/DRIVERS,v
retrieving revision 1.3
diff -u -r1.3 DRIVERS
--- doc/DRIVERS 2001/05/06 00:13:58 1.3
+++ doc/DRIVERS 2001/05/09 01:39:18
@@ -72,6 +72,15 @@
big-endian order, and "little" for little-endian order. By
default this is "native".
+au
+--
+Sun audio file output. Writes an au file from the audio
+data you output.
+ Option keys:
+ "file" - Sets the output file. Use "-" to
+ write to stdout. By default this is
+ "output.au".
+
ADDING NEW DRIVERS
[To be written. - Stan]
Index: include/ao/ao.h
===================================================================
RCS file: /usr/local/cvsroot/ao/include/ao/ao.h,v
retrieving revision 1.12
diff -u -r1.12 ao.h
--- include/ao/ao.h 2001/05/06 00:13:59 1.12
+++ include/ao/ao.h 2001/05/09 01:39:18
@@ -76,6 +76,7 @@
#define AO_NULL 0
#define AO_WAV 1
#define AO_RAW 2
+#define AO_AU 3
/* --- Functions --- */
Index: src/Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/ao/src/Makefile.am,v
retrieving revision 1.5
diff -u -r1.5 Makefile.am
--- src/Makefile.am 2001/05/06 00:13:59 1.5
+++ src/Makefile.am 2001/05/09 01:39:18
@@ -7,7 +7,7 @@
lib_LTLIBRARIES = libao.la
-libao_la_SOURCES = audio_out.c ao_raw.c ao_wav.c ao_null.c
+libao_la_SOURCES = audio_out.c ao_au.c ao_raw.c ao_wav.c ao_null.c
libao_la_LDFLAGS = -version-info @LIB_CURRENT@:@LIB_REVISION@:@LIB_AGE@
Index: src/audio_out.c
===================================================================
RCS file: /usr/local/cvsroot/ao/src/audio_out.c,v
retrieving revision 1.14
diff -u -r1.14 audio_out.c
--- src/audio_out.c 2001/05/06 00:13:59 1.14
+++ src/audio_out.c 2001/05/09 01:39:18
@@ -56,6 +56,7 @@
extern ao_functions_t ao_null;
extern ao_functions_t ao_wav;
extern ao_functions_t ao_raw;
+extern ao_functions_t ao_au;
driver_tree_t *driver_head = NULL;
@@ -99,6 +100,7 @@
driver_tree_t *dnull;
driver_tree_t *dwav;
driver_tree_t *draw;
+ driver_tree_t *dau;
driver_tree_t *plugin;
driver_tree_t *driver;
DIR *plugindir;
@@ -109,7 +111,7 @@
char fullpath[FILENAME_MAX];
if (driver_head == NULL) {
- /* insert the null and wav drivers into the tree */
+ /* insert the null, wav, raw, and au drivers into the tree */
dnull = (driver_tree_t *)malloc(sizeof(driver_tree_t));
dnull->functions = &ao_null;
dnull->handle = NULL;
@@ -119,13 +121,17 @@
draw = (driver_tree_t *)malloc(sizeof(driver_tree_t));
draw->functions = &ao_raw;
draw->handle = NULL;
+ dau = (driver_tree_t *)malloc(sizeof(driver_tree_t));
+ dau->functions = &ao_au;
+ dau->handle = NULL;
dnull->next = dwav;
dwav->next = draw;
- draw->next = NULL;
+ draw->next = dau;
+ dau->next = NULL;
driver_head = dnull;
- driver = draw;
+ driver = dau;
/* now insert any plugins we find */
plugindir = opendir(AO_PLUGIN_PATH);
@@ -157,7 +163,7 @@
if (!driver_head) return;
/* unload and free all the plugins */
- driver = driver->next->next->next; /* Skip null, wav, and raw driver */
+ driver = driver->next->next->next->next; /* Skip null, wav, raw, and au drivers */
while (driver) {
if (driver->functions) free(driver->functions);
if (driver->handle) dlclose(driver->handle);
<HR NOSHADE>
<UL>
<LI>TEXT/PLAIN attachment: ao_au.c
</UL>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ao_au.c
Type: application/octet-stream
Size: 7746 bytes
Desc: not available
Url : http://lists.xiph.org/pipermail/vorbis-dev/attachments/20010508/9e3e3116/ao_au.obj
More information about the Vorbis-dev
mailing list