ao_plugin_open

declared in "ao/plugin.h";

Open the device for playback. All of the device options will have
already been set by previous calls to ao_plugin_set_option(). If this is a
file output driver, the file itself will have be already opened and a
pointer to a FILE structure stored in device->file.

If the plugin wishes to support automatic channel mapping, but it
was not possible to set device->output_matrix in ao_plugin_device_init(), the
plugin should now set device->inter_matrix to the channel
ordering that will be expected for buffers submitted to ao_plugin_play().

Plugins should use device->output_channels to determine
the number of output channels to configure, not
format->channels. device->output_channels is the
number of channels libao will be submitting upon each call to ao_plugin_play(). A plugin may alter
the value of device->output_channels to demand a different
number of channels if necessary (such as if a plugin is manufacturing
a channel mapping manually).

Parameters

device

Pointer to pre-allocated device structure. The plugin should
set its desired byte format in device->driver_byte_format.

format

Output device sample format. format->byte_format should
be ignored as it is relevant only to the library core.
format->channels is relevant only if a plugin is constructing
a channel mapping manually; otherwise device->output should
be used as it is the actual number of channels that will be sent to ao_plugin_play().

Return Values

1 indicates success.

0 indicates failure to open the device.
ao_plugin_device_clear() should be
called to ensure the deallocate of all private data structures.