[xiph-cvs] cvs commit: ao/src/plugins/sun ao_sun.c
Stan Seibert
volsung at xiph.org
Tue Jul 24 10:51:16 PDT 2001
volsung 01/07/24 10:51:16
Modified: doc Tag: volsung_20010721 ao_default_driver_id.html
ao_info.html drivers.html index.html overview.html
include/ao Tag: volsung_20010721 ao.h
src Tag: volsung_20010721 ao_au.c ao_null.c ao_raw.c
ao_wav.c audio_out.c
src/plugins/alsa Tag: volsung_20010721 ao_alsa.c
src/plugins/arts Tag: volsung_20010721 ao_arts.c
src/plugins/esd Tag: volsung_20010721 ao_esd.c
src/plugins/irix Tag: volsung_20010721 ao_irix.c
src/plugins/oss Tag: volsung_20010721 ao_oss.c
src/plugins/sun Tag: volsung_20010721 ao_sun.c
Log:
We now use a ranking system to select a defaut driver from the range of
possible drivers. Note that the null device is no longer a possible
default device to prevent user confusion that we have had in the past.
Revision Changes Path
No revision
No revision
1.1.2.2 +6 -3 ao/doc/Attic/ao_default_driver_id.html
Index: ao_default_driver_id.html
===================================================================
RCS file: /usr/local/cvsroot/ao/doc/Attic/ao_default_driver_id.html,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- ao_default_driver_id.html 2001/07/22 03:35:41 1.1.2.1
+++ ao_default_driver_id.html 2001/07/24 17:51:09 1.1.2.2
@@ -17,7 +17,7 @@
<p><i>declared in "ao/ao.h";</i></p>
-<p>Determins the default live output driver and returns its ID number.
+<p>Returns the ID number of the default live output driver.
If the <a href="ao_conf.html">configuration files</a> specify a
default driver, its ID is returned, otherwise the library tries to
pick a live output driver that will work on the host platform.
@@ -37,10 +37,13 @@
<blockquote>
<li>a non-negative value is the ID number of the default driver.</li>
-<li>-1 indicates failure. Currently, this should never happen, but check
-for it anyway.</li>
+<li>-1 indicates failure to find a usable audio output device.</li>
</blockquote>
<p>
+
+<h3>Notes</h3>
+<p>If no default device is available, you may still use the null device
+to test your application.</p>
<br><br>
<hr noshade>
1.1.2.2 +6 -0 ao/doc/Attic/ao_info.html
Index: ao_info.html
===================================================================
RCS file: /usr/local/cvsroot/ao/doc/Attic/ao_info.html,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- ao_info.html 2001/07/22 03:35:41 1.1.2.1
+++ ao_info.html 2001/07/24 17:51:09 1.1.2.2
@@ -29,6 +29,7 @@
char *short_name; /* short name of driver */
char *comment; /* driver comment */
int preferred_byte_format;
+ int priority;
char **options;
int option_count;
} ao_info;</b></pre>
@@ -60,6 +61,11 @@
<a href="ao_sample_format.html">ao_sample_format</a> for a list of
allowed values.
</dd>
+<dt><i>priority</i></dt>
+<dd>A positive integer ranking how likely it is for this driver to be
+the default. The default driver will be a functioning driver with
+highest priority. See the <a href="drivers.html">drivers document</a>
+for more explanation.</dd>
<dt><i>comment</i></dt>
<dd>Pointer to a driver comment string (possibly <tt>NULL</tt>). It may
contain newlines.</dd>
1.1.2.2 +32 -2 ao/doc/Attic/drivers.html
Index: drivers.html
===================================================================
RCS file: /usr/local/cvsroot/ao/doc/Attic/drivers.html,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- drivers.html 2001/07/22 03:35:41 1.1.2.1
+++ drivers.html 2001/07/24 17:51:09 1.1.2.2
@@ -29,8 +29,7 @@
<h3>null</h3>
Null driver. This is just a test device which does not write the
-audio data anywhere. It will be used as the default driver if no
-other suitable driver can be found.
+audio data anywhere.
<p>
<b>Option keys:</b> None.
@@ -161,6 +160,37 @@
<b>Option keys:</b> None.
<p>
+<hr>
+
+<a name="default_driver">
+<h2>Default Driver Detection</h2>
+
+In the absence of <a href="config.html">configuration files</a> to
+explicit identify a default driver, the library will try to detect a
+suitable default driver. It does this by testing every available live
+output driver (using <a
+href="ao_plugin_test.html">ao_plugin_test()</a>) and finding the
+driver with the highest priority (see the <a
+href="ao_info.html">ao_info</a> struct) that works. Drivers with
+priority 0, such as the null and file output drivers, are never
+selected as the default.
+<p>
+
+The ranking system currently used is:
+<center>
+<table border="1">
+ <tr><th>Priority</th><th>Drivers</th> </tr>
+ <tr><td>30</td> <td>alsa</td> </tr>
+ <tr><td>20</td> <td>oss, irix, sun</td> </tr>
+ <tr><td>10</td> <td>esd,arts</td> </tr>
+ <tr bgcolor="#888888"><td> 0</td> <td>null, all file output</td></tr>
+</table>
+</center>
+<p>
+
+Clearly, any ranking scheme will fail to make everybody happy. For
+such cases, the <a href="config.html">configuration files</a> can be
+easily used to define an appropriate default output device
<br><br>
<hr noshade>
1.2.2.2 +1 -1 ao/doc/Attic/index.html
Index: index.html
===================================================================
RCS file: /usr/local/cvsroot/ao/doc/Attic/index.html,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -u -r1.2.2.1 -r1.2.2.2
--- index.html 2001/07/22 03:35:41 1.2.2.1
+++ index.html 2001/07/24 17:51:09 1.2.2.2
@@ -28,7 +28,7 @@
</ul>
<p>
<a href="overview.html">libao api overview</a><br>
-<a href="drivers.html">driver list</a><br>
+<a href="drivers.html">drivers</a><br>
<a href="ao_example.c">example code</a><br>
<a href="config.html">configuration files</a><br>
<a href="libao-api.html">libao api reference</a><br>
1.1.2.2 +6 -6 ao/doc/Attic/overview.html
Index: overview.html
===================================================================
RCS file: /usr/local/cvsroot/ao/doc/Attic/overview.html,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- overview.html 2001/07/22 03:35:41 1.1.2.1
+++ overview.html 2001/07/24 17:51:09 1.1.2.2
@@ -46,12 +46,12 @@
<li>Call <a
href="ao_default_driver_id.html">ao_default_driver_id()</a> to get the
-ID number of the default output driver. This is <i>always</i> a live
-output driver, though it may be the null driver, which just discards
-the audio data. If you want to specify a particular output driver,
-you may call <a href="ao_driver_id.html">ao_driver_id()</a> with a
-string corresponding to the short name of the device (i.e. "oss",
-"wav", etc.) instead.
+ID number of the default output driver. This may not be successful if
+no audio hardware is available, it is in use, or is not in the "standard"
+configuration. If you want to specify a particular output driver, you
+may call <a href="ao_driver_id.html">ao_driver_id()</a> with a string
+corresponding to the short name of the device (i.e. "oss", "wav",
+etc.) instead.
<p>
<li>If you are using the default device, no extra options are needed.
No revision
No revision
1.13.2.2 +1 -0 ao/include/ao/ao.h
Index: ao.h
===================================================================
RCS file: /usr/local/cvsroot/ao/include/ao/ao.h,v
retrieving revision 1.13.2.1
retrieving revision 1.13.2.2
diff -u -r1.13.2.1 -r1.13.2.2
--- ao.h 2001/07/22 03:35:47 1.13.2.1
+++ ao.h 2001/07/24 17:51:10 1.13.2.2
@@ -66,6 +66,7 @@
char *author; /* driver author */
char *comment; /* driver comment */
int preferred_byte_format;
+ int priority;
char **options;
int option_count;
} ao_info;
No revision
No revision
1.2.2.2 +1 -0 ao/src/ao_au.c
Index: ao_au.c
===================================================================
RCS file: /usr/local/cvsroot/ao/src/ao_au.c,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -u -r1.2.2.1 -r1.2.2.2
--- ao_au.c 2001/07/22 03:35:48 1.2.2.1
+++ ao_au.c 2001/07/24 17:51:11 1.2.2.2
@@ -70,6 +70,7 @@
"Wil Mahan <wtm2 at duke.edu>",
"Sends output to a .au file",
AO_FMT_BIG,
+ 0,
NULL, /* No options */
0
};
1.4.2.3 +1 -0 ao/src/ao_null.c
Index: ao_null.c
===================================================================
RCS file: /usr/local/cvsroot/ao/src/ao_null.c,v
retrieving revision 1.4.2.2
retrieving revision 1.4.2.3
diff -u -r1.4.2.2 -r1.4.2.3
--- ao_null.c 2001/07/24 00:02:33 1.4.2.2
+++ ao_null.c 2001/07/24 17:51:11 1.4.2.3
@@ -34,6 +34,7 @@
"Stan Seibert <volsung at asu.edu>",
"This driver does nothing.",
AO_FMT_NATIVE,
+ 0,
NULL, /* No options */
0
};
1.1.2.2 +1 -0 ao/src/ao_raw.c
Index: ao_raw.c
===================================================================
RCS file: /usr/local/cvsroot/ao/src/ao_raw.c,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- ao_raw.c 2001/07/22 03:35:48 1.1.2.1
+++ ao_raw.c 2001/07/24 17:51:11 1.1.2.2
@@ -38,6 +38,7 @@
"Stan Seibert <indigo at aztec.asu.edu>",
"Writes raw audio samples to a file",
AO_FMT_NATIVE,
+ 0,
ao_raw_options,
1
};
1.8.2.2 +1 -0 ao/src/ao_wav.c
Index: ao_wav.c
===================================================================
RCS file: /usr/local/cvsroot/ao/src/ao_wav.c,v
retrieving revision 1.8.2.1
retrieving revision 1.8.2.2
diff -u -r1.8.2.1 -r1.8.2.2
--- ao_wav.c 2001/07/22 03:35:48 1.8.2.1
+++ ao_wav.c 2001/07/24 17:51:11 1.8.2.2
@@ -88,6 +88,7 @@
"Aaron Holtzman <aholtzma at ess.engr.uvic.ca>",
"Sends output to a .wav file",
AO_FMT_LITTLE,
+ 0,
NULL, /* No options */
0
};
1.15.2.4 +10 -11 ao/src/audio_out.c
Index: audio_out.c
===================================================================
RCS file: /usr/local/cvsroot/ao/src/audio_out.c,v
retrieving revision 1.15.2.3
retrieving revision 1.15.2.4
diff -u -r1.15.2.3 -r1.15.2.4
--- audio_out.c 2001/07/24 00:08:02 1.15.2.3
+++ audio_out.c 2001/07/24 17:51:11 1.15.2.4
@@ -152,31 +152,30 @@
{
int def_id;
int id;
+ int priority;
+ ao_info *info;
driver_list *driver = driver_head;
if ( name == NULL || (def_id = ao_driver_id(name)) < 0 ) {
/* No default specified. Find one among available drivers. */
def_id = -1;
- /* Skip null driver */
- id = 1;
- driver = driver->next;
+ id = 0;
+ priority = 0; /* This forces the null driver to be skipped */
+ while (driver != NULL) {
- while (driver != NULL && def_id == -1) {
+ info = driver->functions->driver_info();
- if ( (driver->functions->driver_info()->type
- == AO_TYPE_LIVE) &&
+ if ( info->type == AO_TYPE_LIVE &&
+ info->priority > priority &&
driver->functions->test() ) {
-
+ priority = info->priority;
def_id = id; /* Found a usable driver */
}
+
driver = driver->next;
id++;
}
-
- /* Did we actually find anything? */
- if (def_id == -1)
- def_id = 0; /* If not, use null driver */
}
return def_id;
No revision
No revision
1.5.2.4 +1 -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.5.2.3
retrieving revision 1.5.2.4
diff -u -r1.5.2.3 -r1.5.2.4
--- ao_alsa.c 2001/07/24 00:08:03 1.5.2.3
+++ ao_alsa.c 2001/07/24 17:51:12 1.5.2.4
@@ -46,6 +46,7 @@
"Stan Seibert <volsung at asu.edu>",
"Outputs to the Advanced Linux Sound Architecture version 0.5.x.",
AO_FMT_NATIVE,
+ 30,
ao_alsa_options,
3
};
No revision
No revision
1.3.2.4 +1 -0 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.3.2.3
retrieving revision 1.3.2.4
diff -u -r1.3.2.3 -r1.3.2.4
--- ao_arts.c 2001/07/24 00:08:04 1.3.2.3
+++ ao_arts.c 2001/07/24 17:51:13 1.3.2.4
@@ -39,6 +39,7 @@
"Rik Hemsley (rikkus) <rik at kde.org>",
"Outputs to the aRts soundserver.",
AO_FMT_NATIVE,
+ 10,
NULL,
0
};
No revision
No revision
1.4.2.3 +1 -0 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.4.2.2
retrieving revision 1.4.2.3
diff -u -r1.4.2.2 -r1.4.2.3
--- ao_esd.c 2001/07/24 00:08:04 1.4.2.2
+++ ao_esd.c 2001/07/24 17:51:13 1.4.2.3
@@ -43,6 +43,7 @@
"Stan Seibert <volsung at asu.edu>",
"Outputs to the Enlightened Sound Daemon.",
AO_FMT_NATIVE,
+ 10,
ao_esd_options,
1
};
No revision
No revision
1.3.2.3 +1 -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.3.2.2
retrieving revision 1.3.2.3
diff -u -r1.3.2.2 -r1.3.2.3
--- ao_irix.c 2001/07/24 00:08:05 1.3.2.2
+++ ao_irix.c 2001/07/24 17:51:14 1.3.2.3
@@ -53,6 +53,7 @@
"Jim Miller <???@sgi.com>",
"WARNING: This driver is untested!"
AO_FMT_NATIVE,
+ 20,
NULL,
1
};
No revision
No revision
1.6.2.3 +1 -0 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.6.2.2
retrieving revision 1.6.2.3
diff -u -r1.6.2.2 -r1.6.2.3
--- ao_oss.c 2001/07/24 00:08:05 1.6.2.2
+++ ao_oss.c 2001/07/24 17:51:14 1.6.2.3
@@ -52,6 +52,7 @@
"Aaron Holtzman <aholtzma at ess.engr.uvic.ca>",
"Outputs audio to the Open Sound System driver.",
AO_FMT_NATIVE,
+ 20,
ao_oss_options,
1
};
No revision
No revision
1.1.2.4 +1 -0 ao/src/plugins/sun/ao_sun.c
Index: ao_sun.c
===================================================================
RCS file: /usr/local/cvsroot/ao/src/plugins/sun/ao_sun.c,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- ao_sun.c 2001/07/24 00:08:06 1.1.2.3
+++ ao_sun.c 2001/07/24 17:51:16 1.1.2.4
@@ -53,6 +53,7 @@
"Christian Weisgerber <naddy at openbsd.org>",
"Outputs to the sun audio system.",
AO_FMT_NATIVE,
+ 20,
ao_sun_options,
1
};
--- >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