Hi! There are some little inconvenience in libao-0.8.5. - The biggest is may that: the documentation and the header file declare the ao_file_extension function, which give a hint for the file extension where the device is realy a sound file. This function is missing. -An other: the alsa 0.5 and the alsa 0.9+ drivers short name. It will be better if the alsa 0.5's name will be alsa05 and the 0.9's name will be alsa (now the alsa is alsa 0.5 and the alsa09 is alsa 0.9+...) -It will be a good thing, if the file-drivers have a file option to determine the filename through this options :-) -If a plugin (or static driver) report: failed "set_option" the _open_device function should set the errno to EBADOPTION instead EOPENDEVICE, and in the documentation the text should be say: "An invalid option or a valid option key has an invalid value." instead of "A valid option key has an invalid value.". -In the ao_macosx.c file: in ao_plugin_set_option function has a ao_macosx_internal *internal = (ao_macosx_internal *) device->internal; line. There is no practical meaning. The attached diff file (-u) make the above needed changes on libao-0.8.5 tarball. The "file" option checked in ao_open_file, and skipped all the file-output driver. The "file" option have a precedence over the "filename" option in the ao_open_file, so the calling program may offer a default filename value in the function call parallell to set the user needed filename in the option section. In the ao_info structure expanded with a char *extension member, and set NULL for all non-file-drivers and to "au", "raw" and "wav" in the file-drivers. An ao_file_extension function created, which return with the extension member of the driver info structure. Best regards: Gergely -------------- next part -------------- diff -ur libao-0.8.5/include/ao/ao.h libao-0.8.5.new/include/ao/ao.h --- libao-0.8.5/include/ao/ao.h 2003-01-08 04:48:54.000000000 +0100 +++ libao-0.8.5.new/include/ao/ao.h 2004-10-22 11:47:53.000000000 +0200 @@ -66,6 +66,7 @@ char *short_name; /* short name of driver */ char *author; /* driver author */ char *comment; /* driver comment */ + char *extension; /* filename extension if any */ int preferred_byte_format; int priority; char **options; diff -ur libao-0.8.5/src/ao_aixs.c libao-0.8.5.new/src/ao_aixs.c --- libao-0.8.5/src/ao_aixs.c 2003-01-08 04:48:54.000000000 +0100 +++ libao-0.8.5.new/src/ao_aixs.c 2004-10-22 12:13:38.000000000 +0200 @@ -55,6 +55,7 @@ "aixs", "Stefan Tibus <sjti@gmx.net>", "Outputs to the AIX audio system.", + NULL, AO_FMT_NATIVE, 20, ao_aixs_options, @@ -117,7 +118,8 @@ /* Free old string in case "dsp" set twice in options */ free(internal->dev); internal->dev = strdup(value); - } + } else + return 0; return 1; } diff -ur libao-0.8.5/src/ao_au.c libao-0.8.5.new/src/ao_au.c --- libao-0.8.5/src/ao_au.c 2001-09-05 21:33:40.000000000 +0200 +++ libao-0.8.5.new/src/ao_au.c 2004-10-22 13:05:56.000000000 +0200 @@ -71,6 +71,7 @@ "au", "Wil Mahan <wtm2@duke.edu>", "Sends output to a .au file", + "au", AO_FMT_BIG, 0, NULL, /* No options */ @@ -115,7 +116,12 @@ static int ao_au_set_option(ao_device *device, const char *key, const char *value) { - return 1; /* No options! */ + if (!strcmp(key, "file")) + ; + else + return 0; /* No options! */ + + return 1; } diff -ur libao-0.8.5/src/ao_null.c libao-0.8.5.new/src/ao_null.c --- libao-0.8.5/src/ao_null.c 2001-12-18 23:39:23.000000000 +0100 +++ libao-0.8.5.new/src/ao_null.c 2004-10-22 12:13:26.000000000 +0200 @@ -37,6 +37,7 @@ "null", "Stan Seibert <volsung@asu.edu>", "This driver does nothing.", + NULL, AO_FMT_NATIVE, 0, ao_null_options, @@ -87,7 +88,8 @@ if (!strcmp(key, "debug")) { internal->debug_output = 1; - } + } else + return 0; return 1; } diff -ur libao-0.8.5/src/ao_raw.c libao-0.8.5.new/src/ao_raw.c --- libao-0.8.5/src/ao_raw.c 2001-09-05 21:34:02.000000000 +0200 +++ libao-0.8.5.new/src/ao_raw.c 2004-10-22 12:57:06.000000000 +0200 @@ -37,6 +37,7 @@ "raw", "Stan Seibert <indigo@aztec.asu.edu>", "Writes raw audio samples to a file", + "raw", AO_FMT_NATIVE, 0, ao_raw_options, @@ -82,7 +83,9 @@ { ao_raw_internal *internal = (ao_raw_internal *)device->internal; - if (!strcmp(key, "byteorder")) { + if (!strcmp(value, "file")) + ; + else if (!strcmp(key, "byteorder")) { if (!strcmp(value, "native")) internal->byte_order = AO_FMT_NATIVE; else if (!strcmp(value, "big")) @@ -91,7 +94,8 @@ internal->byte_order = AO_FMT_LITTLE; else return 0; /* Bad option value */ - } + } else + return 0; return 1; } diff -ur libao-0.8.5/src/ao_wav.c libao-0.8.5.new/src/ao_wav.c --- libao-0.8.5/src/ao_wav.c 2001-09-05 21:34:12.000000000 +0200 +++ libao-0.8.5.new/src/ao_wav.c 2004-10-22 12:58:25.000000000 +0200 @@ -87,6 +87,7 @@ "wav", "Aaron Holtzman <aholtzma@ess.engr.uvic.ca>", "Sends output to a .wav file", + "wav", AO_FMT_LITTLE, 0, NULL, /* No options */ @@ -131,7 +132,10 @@ static int ao_wav_set_option(ao_device *device, const char *key, const char *value) { - return 1; /* No options! */ + if (!strcmp(key, "file")) + return 1; + + return 0; /* No options! */ } diff -ur libao-0.8.5/src/audio_out.c libao-0.8.5.new/src/audio_out.c --- libao-0.8.5/src/audio_out.c 2004-03-09 16:35:41.000000000 +0100 +++ libao-0.8.5.new/src/audio_out.c 2004-10-22 12:41:42.000000000 +0200 @@ -491,7 +491,7 @@ if (!funcs->set_option(device, options->key, options->value)) { /* Problem setting options */ free(device); - errno = AO_EOPENDEVICE; + errno = AO_EBADOPTION; return NULL; } @@ -629,14 +629,23 @@ { FILE *file; ao_device *device; + ao_option *o = options; + char *fname = (char *) filename; - if (strcmp("-", filename) == 0) + while (o) { + if (!(strcmp (o->key, "file"))) { + fname = o->value; + break; + } + o = o->next; + } + if (strcmp("-", fname) == 0) file = stdout; else { if (!overwrite) { /* Test for file existence */ - file = fopen(filename, "r"); + file = fopen(fname, "r"); if (file != NULL) { fclose(file); errno = AO_EFILEEXISTS; @@ -645,7 +654,7 @@ } - file = fopen(filename, "w"); + file = fopen(fname, "w"); } @@ -757,6 +766,15 @@ return info_table; } +char *ao_file_extension(int driver_id) +{ + driver_list *driver; + + if ( (driver = _get_driver(driver_id)) ) + return (driver->functions->driver_info())->extension; + else + return NULL; +} /* -- Miscellaneous -- */ diff -ur libao-0.8.5/src/plugins/alsa/ao_alsa.c libao-0.8.5.new/src/plugins/alsa/ao_alsa.c --- libao-0.8.5/src/plugins/alsa/ao_alsa.c 2003-07-14 03:55:47.000000000 +0200 +++ libao-0.8.5.new/src/plugins/alsa/ao_alsa.c 2004-10-22 12:06:08.000000000 +0200 @@ -42,9 +42,10 @@ { AO_TYPE_LIVE, "Advanced Linux Sound Architecture (ALSA) output", - "alsa", + "alsa05", "Stan Seibert <volsung@asu.edu>", "Outputs to the Advanced Linux Sound Architecture version 0.5.x.", + NULL, AO_FMT_NATIVE, 34, ao_alsa_options, @@ -110,6 +111,8 @@ internal->dev = atoi(value); else if (!strcmp(key, "buf_size")) internal->buf_size = atoi(value); + else + return 0; return 1; } diff -ur libao-0.8.5/src/plugins/alsa09/ao_alsa09.c libao-0.8.5.new/src/plugins/alsa09/ao_alsa09.c --- libao-0.8.5/src/plugins/alsa09/ao_alsa09.c 2003-10-13 04:12:32.000000000 +0200 +++ libao-0.8.5.new/src/plugins/alsa09/ao_alsa09.c 2004-10-22 12:06:26.000000000 +0200 @@ -75,9 +75,10 @@ { AO_TYPE_LIVE, "Advanced Linux Sound Architecture (ALSA) output", - "alsa09", + "alsa", "Bill Currie <bill@taniwha.org>/Kevin Cody, Jr. <kevinc@wuff.dhs.org>", "Outputs to the Advanced Linux Sound Architecture version 0.9.x.", + NULL, AO_FMT_NATIVE, 35, ao_alsa_options, @@ -181,7 +182,8 @@ internal->writei = snd_pcm_writei; internal->access_mask = SND_PCM_ACCESS_RW_INTERLEAVED; } - } + } else + return 0; return 1; } diff -ur libao-0.8.5/src/plugins/arts/ao_arts.c libao-0.8.5.new/src/plugins/arts/ao_arts.c --- libao-0.8.5/src/plugins/arts/ao_arts.c 2003-07-14 03:55:47.000000000 +0200 +++ libao-0.8.5.new/src/plugins/arts/ao_arts.c 2004-10-22 11:53:55.000000000 +0200 @@ -38,6 +38,7 @@ "arts", "Rik Hemsley (rikkus) <rik@kde.org>", "Outputs to the aRts soundserver.", + NULL, AO_FMT_NATIVE, #ifdef HAVE_ARTS_SUSPENDED 45, diff -ur libao-0.8.5/src/plugins/esd/ao_esd.c libao-0.8.5.new/src/plugins/esd/ao_esd.c --- libao-0.8.5/src/plugins/esd/ao_esd.c 2003-08-07 17:29:35.000000000 +0200 +++ libao-0.8.5.new/src/plugins/esd/ao_esd.c 2004-10-22 12:06:53.000000000 +0200 @@ -42,6 +42,7 @@ "esd", "Stan Seibert <volsung@asu.edu>", "Outputs to the Enlightened Sound Daemon.", + NULL, AO_FMT_NATIVE, 40, ao_esd_options, @@ -104,7 +105,8 @@ if (!strcmp(key, "host")) { free(internal->host); internal->host = strdup(value); - } + } else + return 0; return 1; } diff -ur libao-0.8.5/src/plugins/irix/ao_irix.c libao-0.8.5.new/src/plugins/irix/ao_irix.c --- libao-0.8.5/src/plugins/irix/ao_irix.c 2002-04-12 16:22:26.000000000 +0200 +++ libao-0.8.5.new/src/plugins/irix/ao_irix.c 2004-10-22 11:54:17.000000000 +0200 @@ -53,6 +53,7 @@ "irix", "Jim Miller <???@sgi.com>", "Outputs to the IRIX Audio Library.", + NULL, AO_FMT_NATIVE, 20, NULL, diff -ur libao-0.8.5/src/plugins/macosx/ao_macosx.c libao-0.8.5.new/src/plugins/macosx/ao_macosx.c --- libao-0.8.5/src/plugins/macosx/ao_macosx.c 2003-06-24 14:15:00.000000000 +0200 +++ libao-0.8.5.new/src/plugins/macosx/ao_macosx.c 2004-10-22 13:02:33.000000000 +0200 @@ -56,6 +56,7 @@ "macosx", "Timothy J. Wood <tjw@omnigroup.com>", "", + NULL, AO_FMT_NATIVE, 30, NULL, @@ -129,11 +130,11 @@ int ao_plugin_set_option(ao_device *device, const char *key, const char *value) { - ao_macosx_internal *internal = (ao_macosx_internal *) device->internal; - +/* ao_macosx_internal *internal = (ao_macosx_internal *) device->internal; +*/ /* No options */ - return 1; + return 0; } diff -ur libao-0.8.5/src/plugins/nas/ao_nas.c libao-0.8.5.new/src/plugins/nas/ao_nas.c --- libao-0.8.5/src/plugins/nas/ao_nas.c 2003-07-14 04:59:10.000000000 +0200 +++ libao-0.8.5.new/src/plugins/nas/ao_nas.c 2004-10-22 12:07:34.000000000 +0200 @@ -48,6 +48,7 @@ "nas", "Antoine Mathys <Antoine.Mathys@unifr.ch>", "Outputs to the Network Audio System.", + NULL, AO_FMT_NATIVE, 10, ao_nas_options, @@ -117,7 +118,8 @@ internal->buf_size = atoi(value); if (internal->buf_size <= 2) return 0; - } + } else + return 0; return 1; } diff -ur libao-0.8.5/src/plugins/oss/ao_oss.c libao-0.8.5.new/src/plugins/oss/ao_oss.c --- libao-0.8.5/src/plugins/oss/ao_oss.c 2004-03-09 01:05:44.000000000 +0100 +++ libao-0.8.5.new/src/plugins/oss/ao_oss.c 2004-10-22 12:07:44.000000000 +0200 @@ -49,6 +49,7 @@ "oss", "Aaron Holtzman <aholtzma@ess.engr.uvic.ca>", "Outputs audio to the Open Sound System driver.", + NULL, AO_FMT_NATIVE, 20, ao_oss_options, @@ -186,7 +187,8 @@ /* Free old string in case "dsp" set twice in options */ free(internal->dev); internal->dev = strdup(value); - } + } else + return 0; return 1; } diff -ur libao-0.8.5/src/plugins/sun/ao_sun.c libao-0.8.5.new/src/plugins/sun/ao_sun.c --- libao-0.8.5/src/plugins/sun/ao_sun.c 2001-12-16 22:10:34.000000000 +0100 +++ libao-0.8.5.new/src/plugins/sun/ao_sun.c 2004-10-22 12:07:55.000000000 +0200 @@ -52,6 +52,7 @@ "sun", "Christian Weisgerber <naddy@openbsd.org>", "Outputs to the sun audio system.", + NULL, AO_FMT_NATIVE, 20, ao_sun_options, @@ -114,7 +115,8 @@ /* Free old string in case "dsp" set twice in options */ free(internal->dev); internal->dev = strdup(value); - } + } else + return 0; return 1; }