diff --git a/configure.in b/configure.in index beaca639f106d514c0155f128689167198ddb315..3c856caa2ae359bb44e8a21cd579aed3e495ce84 100644 --- a/configure.in +++ b/configure.in @@ -6,9 +6,9 @@ AM_INIT_AUTOMAKE(libao,0.8.1) AM_DISABLE_STATIC dnl Library versioning -LIB_CURRENT=2 -LIB_REVISION=2 -LIB_AGE=0 +LIB_CURRENT=3 +LIB_REVISION=0 +LIB_AGE=1 AC_SUBST(LIB_CURRENT) AC_SUBST(LIB_REVISION) AC_SUBST(LIB_AGE) diff --git a/doc/ao_file_extension.html b/doc/ao_file_extension.html new file mode 100644 index 0000000000000000000000000000000000000000..9859087beae055c08882778a762faa8b75011a63 --- /dev/null +++ b/doc/ao_file_extension.html @@ -0,0 +1,67 @@ +<html> + +<head> +<title>libao - function - ao_file_extension</title> +<link rel=stylesheet href="style.css" type="text/css"> +</head> + +<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff"> +<table border=0 width=100%> +<tr> +<td><p class=tiny>libao documentation</p></td> +<td align=right><p class=tiny>libao version 0.8.0 - 20010804</p></td> +</tr> +</table> + +<h1>ao_file_extension</h1> + +<p><i>declared in "ao/ao.h";</i></p> + +<p>Returns the normal file extension associated with a particular +driver (like "wav" or "au"). This is just an information function to +allow library users to guess appropriate file names. You can safely +ignore the recommended extension.</p> + +<br><br> +<table border=0 color=black cellspacing=0 cellpadding=7> +<tr bgcolor=#cccccc> + <td> +<pre><b> +char* ao_file_extension(int driver_id); +</b></pre> + </td> +</tr> +</table> + +<h3>Parameters</h3> +<dl> +<dt><i>driver_id</i></dt> +<dd>The ID number of the driver as returned by either +<a href="ao_driver_id.html">ao_driver_id()</a> or +<a href="ao_default_driver_id.html">ao_default_driver_id()</a>.</dd> +</dl> + +<h3>Return Values</h3> +<blockquote> +<li>pointer to string containing suggested file extension.</li> + +<li>NULL if this driver has no file extension associated with it or if +this driver does not exist.</li> +</blockquote> +<p> + +<br><br> +<hr noshade> +<table border=0 width=100%> +<tr valign=top> +<td><p class=tiny>copyright © 2001 Stan Seibert</p></td> +<td align=right><p class=tiny><a href="http://www.xiph.org/">xiph.org</a><br><a href="mailto:indigo@aztec.asu.edu">indigo@aztec.asu.edu</a></p></td> +</tr><tr> +<td><p class=tiny>libao documentation</p></td> +<td align=right><p class=tiny>libao version 0.8.0 - 20010804</p></td> +</tr> +</table> + +</body> + +</html> diff --git a/doc/ao_plugin_file_extension.html b/doc/ao_plugin_file_extension.html new file mode 100644 index 0000000000000000000000000000000000000000..6cb489808bc89098f9a155f9faeb3af4257bf45a --- /dev/null +++ b/doc/ao_plugin_file_extension.html @@ -0,0 +1,59 @@ +<html> + +<head> +<title>libao - function - ao_plugin_file_extension</title> +<link rel=stylesheet href="style.css" type="text/css"> +</head> + +<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff"> +<table border=0 width=100%> +<tr> +<td><p class=tiny>libao documentation</p></td> +<td align=right><p class=tiny>libao version 0.8.0 - 20010804</p></td> +</tr> +</table> + +<h1>ao_plugin_file_extension</h1> + +<p><i>declared in "ao/plugin.h";</i></p> + +<p>Returns the normal file extension associated with this driver (like +"wav" or "au"). This is an <b>optional</b> function. Live audio +plugins do not need to implement this function.</p> + +<br><br> +<table border=0 color=black cellspacing=0 cellpadding=7> +<tr bgcolor=#cccccc> + <td> +<pre><b> +char *ao_plugin_file_extension(int driver_id); +</b></pre> + </td> +</tr> +</table> + +<h3>Return Values</h3> +<blockquote> +<li>pointer to string containing suggested file extension.</li> + +<li>NULL if this driver has no file extension associated with it. +Live audio plugins must always return NULL if they do implement this +function.</li> +</blockquote> +<p> + +<br><br> +<hr noshade> +<table border=0 width=100%> +<tr valign=top> +<td><p class=tiny>copyright © 2001 Stan Seibert</p></td> +<td align=right><p class=tiny><a href="http://www.xiph.org/">xiph.org</a><br><a href="mailto:indigo@aztec.asu.edu">indigo@aztec.asu.edu</a></p></td> +</tr><tr> +<td><p class=tiny>libao documentation</p></td> +<td align=right><p class=tiny>libao version 0.8.0 - 20010804</p></td> +</tr> +</table> + +</body> + +</html> diff --git a/doc/libao-api.html b/doc/libao-api.html index 6b432277f0a8cef140dcc310aa32ee0fe60120e0..16ca518d8f87a66b6621ea13d6a1718907be2369 100644 --- a/doc/libao-api.html +++ b/doc/libao-api.html @@ -39,6 +39,7 @@ <a href="ao_default_driver_id.html">ao_default_driver_id()</a><br> <a href="ao_driver_info.html">ao_driver_info()</a><br> <a href="ao_driver_info_list.html">ao_driver_info_list()</a><br> +<a href="ao_file_extension.html">ao_file_extension()</a><br> <br> <b>Miscellaneous</b><br> <a href="ao_is_big_endian.html">ao_is_big_endian()</a><br> diff --git a/doc/plugin-api.html b/doc/plugin-api.html index 772db4e6cc064333d3bbe293e911112647bb4d4f..a36c39de8026de145d5f4c83ed1dc5a9c5be9aac 100644 --- a/doc/plugin-api.html +++ b/doc/plugin-api.html @@ -24,6 +24,7 @@ <a href="ao_plugin_play.html">ao_plugin_play()</a><br> <a href="ao_plugin_close.html">ao_plugin_close()</a><br> <a href="ao_plugin_device_clear.html">ao_plugin_device_clear()</a><br> +<a href="ao_plugin_file_extension.html">ao_plugin_file_extension()</a><br> <br><br> <hr noshade> diff --git a/include/ao/ao.h b/include/ao/ao.h index 35e608fa9bf29a3c6fc2385aaf069983a04402a8..a25ad52b32b32adf066bcb1ee86cfeac4ae7493a 100644 --- a/include/ao/ao.h +++ b/include/ao/ao.h @@ -104,6 +104,7 @@ struct ao_functions { uint_32 num_bytes); int (*close)(ao_device *device); void (*device_clear)(ao_device *device); + char* (*file_extension)(void); }; typedef struct ao_option { @@ -135,6 +136,7 @@ int ao_driver_id(const char *short_name); int ao_default_driver_id(); ao_info *ao_driver_info(int driver_id); ao_info **ao_driver_info_list(int *driver_count); +char *ao_file_extension(int driver_id); /* miscellaneous */ int ao_is_big_endian(void); diff --git a/include/ao/plugin.h b/include/ao/plugin.h index c22f5603626f565b8d96fc87235f2ca784792919..29a3d969399b0fb2487d94a51b260233616ec497 100644 --- a/include/ao/plugin.h +++ b/include/ao/plugin.h @@ -2,7 +2,7 @@ * * plugin.h - function declarations for libao plugins * - * Copyright (C) Stan Seibert - June 2001C + * Copyright (C) Stan Seibert - June 2001 * * This file is part of libao, a cross-platform audio outputlibrary. See * README for a history of this source code. @@ -42,6 +42,7 @@ int ao_plugin_play(ao_device *device, const char *output_samples, uint_32 num_bytes); int ao_plugin_close(ao_device *device); void ao_plugin_device_clear(ao_device *device); +char *ao_plugin_file_extension(); #ifdef __cplusplus } diff --git a/src/ao_au.c b/src/ao_au.c index 83d38cc07fa811384d12776ec8e256453c170818..3a8690285f852724965b37cac5f90c0b81cf6270 100644 --- a/src/ao_au.c +++ b/src/ao_au.c @@ -221,6 +221,13 @@ static void ao_au_device_clear(ao_device *device) free(internal); } + +static char *ao_au_file_extension(void) +{ + return "au"; +} + + ao_functions ao_au = { ao_au_test, ao_au_driver_info, @@ -229,5 +236,6 @@ ao_functions ao_au = { ao_au_open, ao_au_play, ao_au_close, - ao_au_device_clear + ao_au_device_clear, + ao_au_file_extension }; diff --git a/src/ao_raw.c b/src/ao_raw.c index a015bf1b36d32695748e765a8f88d30722dd4449..d9632792fa5bc78d349f7a44c714f7b06bf61c0b 100644 --- a/src/ao_raw.c +++ b/src/ao_raw.c @@ -136,6 +136,12 @@ static void ao_raw_device_clear(ao_device *device) } +static char *ao_raw_file_extension(void) +{ + return "raw"; +} + + ao_functions ao_raw = { ao_raw_test, ao_raw_driver_info, @@ -144,5 +150,6 @@ ao_functions ao_raw = { ao_raw_open, ao_raw_play, ao_raw_close, - ao_raw_device_clear + ao_raw_device_clear, + ao_raw_file_extension }; diff --git a/src/ao_wav.c b/src/ao_wav.c index 51c3e2163b15c91a086826e0da1c5488841930a7..e611f57eb573f8fda380a94e39157efa07a3f33e 100644 --- a/src/ao_wav.c +++ b/src/ao_wav.c @@ -257,6 +257,12 @@ static void ao_wav_device_clear(ao_device *device) } +static char *ao_wav_file_extension(void) +{ + return "wav"; +} + + ao_functions ao_wav = { ao_wav_test, ao_wav_driver_info, @@ -265,6 +271,6 @@ ao_functions ao_wav = { ao_wav_open, ao_wav_play, ao_wav_close, - ao_wav_device_clear + ao_wav_device_clear, + ao_wav_file_extension }; - diff --git a/src/audio_out.c b/src/audio_out.c index cd26035c1f075ca2a5f407bd54fc46b7696a928d..56279e5fa4d565863d1c05d1bb3a6deec679ae29 100644 --- a/src/audio_out.c +++ b/src/audio_out.c @@ -137,6 +137,11 @@ driver_list *_get_plugin(char *plugin_file) dlsym(dt->handle, "ao_plugin_device_clear"); if (dlerror()) { free(dt->functions); free(dt); return NULL; } + /* Optional function */ + dt->functions->file_extension = + dlsym(dt->handle, "ao_plugin_file_extension"); + if (dlerror()) { dt->functions->file_extension = NULL; } + } else { return NULL; @@ -698,6 +703,18 @@ ao_info **ao_driver_info_list(int *count) } +char *ao_file_extension(int driver_id) +{ + driver_list *driver; + + if ( (driver = _get_driver(driver_id)) + && driver->functions->file_extension != NULL) + return driver->functions->file_extension(); + else + return NULL; +} + + /* -- Miscellaneous -- */ /* Stolen from Vorbis' lib/vorbisfile.c */