XMMS2
Data Fields
xmms_output_methods_St Struct Reference

Output functions that lets XMMS2 talk to the soundcard. More...

#include <xmms_outputplugin.h>

Data Fields

gboolean(* new )(xmms_output_t *output)
 Initiate the output plugin. More...
 
void(* destroy )(xmms_output_t *output)
 Destroy the output plugin. More...
 
gboolean(* open )(xmms_output_t *output)
 Open the output device. More...
 
void(* close )(xmms_output_t *output)
 Close the output device. More...
 
void(* flush )(xmms_output_t *output)
 Flush the soundcard buffer. More...
 
gboolean(* format_set )(xmms_output_t *output, const xmms_stream_type_t *type)
 Update the sample format. More...
 
gboolean(* format_set_always )(xmms_output_t *output, const xmms_stream_type_t *type)
 Update the sample format. More...
 
gboolean(* status )(xmms_output_t *output, xmms_playback_status_t status)
 Update the output plugin with the current playback status. More...
 
gboolean(* volume_set )(xmms_output_t *output, const gchar *chan, guint val)
 Set volume. More...
 
gboolean(* volume_get )(xmms_output_t *output, const gchar **names, guint *levels, guint *nchans)
 Get volume. More...
 
void(* write )(xmms_output_t *output, gpointer buffer, gint size, xmms_error_t *err)
 Write audio data to the output device. More...
 
guint(* latency_get )(xmms_output_t *)
 Get the number of bytes in the soundcard buffer. More...
 

Detailed Description

Output functions that lets XMMS2 talk to the soundcard.

An output plugin can behave in two diffrent ways. It can either use it's own event system, or it can depend on the one XMMS2 provides. If the architechture uses its own event mechanism the plugin should not implement open/close/write. Instead a status function is implemented which will be notified on playback status updates, and perform the proper actions based on this.

Field Documentation

void(* xmms_output_methods_St::close)(xmms_output_t *output)

Close the output device.

This function cannot coexist with status.

Parameters
outputan output object
void(* xmms_output_methods_St::destroy)(xmms_output_t *output)

Destroy the output plugin.

Tear down the data initialized in new.

Parameters
outputan output object
void(* xmms_output_methods_St::flush)(xmms_output_t *output)

Flush the soundcard buffer.

This should tell the soundcard to drop whatever it is doing and empty the buffer.

Parameters
outputan output object
gboolean(* xmms_output_methods_St::format_set)(xmms_output_t *output, const xmms_stream_type_t *type)

Update the sample format.

This should tell the soundcard what sample format that will be used for the next track. This is only called when there is an actual change in the sample format. This function cannot coexist with format_set_always.

Parameters
outputan output object
typethe stream type to use
Returns
TRUE if the format was successfully set.
gboolean(* xmms_output_methods_St::format_set_always)(xmms_output_t *output, const xmms_stream_type_t *type)

Update the sample format.

This should tell the soundcard what sample format that will be used for the next track. This is called each time a track changes even if the sample format is identical to the previous one. This function cannot coexist with format_set.

Parameters
outputan output object
typethe stream type to use
Returns
TRUE if the format was successfully set.
guint(* xmms_output_methods_St::latency_get)(xmms_output_t *)

Get the number of bytes in the soundcard buffer.

This is needed for the visualization to perform correct synchronization between audio and graphics for example.

Parameters
outputan output object
Returns
the number of bytes in the soundcard buffer or 0 on failure
gboolean(* xmms_output_methods_St::new)(xmms_output_t *output)

Initiate the output plugin.

This function should setup everything that is required to function once the output device is opened for playback. This may for example include probing for usable sound formats (xmms_output_format_add) and setting up the mixer. Blocking calls in this function are to be avoided as far as possible as this would freeze the startup of xmms2d.

Parameters
outputan output object
Returns
TRUE on successful init, otherwise FALSE
gboolean(* xmms_output_methods_St::open)(xmms_output_t *output)

Open the output device.

Blocking calls in this function are to be avoided as far as possible as this would freeze xmms2d. This function cannot coexist with status.

Parameters
outputan output object
Returns
TRUE on successful opening of the output device, otherwise FALSE
gboolean(* xmms_output_methods_St::status)(xmms_output_t *output, xmms_playback_status_t status)

Update the output plugin with the current playback status.

This function is used when the output architecture is driven by an external thread. When status is set to XMMS_PLAYBACK_STATUS_PLAY, the external thread should be activated, and will then get its data from xmms_output_read, and render it to the soundcard buffer. This function cannot coexist with open, close or write.

Parameters
outputan output object
statusthe new playback status
gboolean(* xmms_output_methods_St::volume_get)(xmms_output_t *output, const gchar **names, guint *levels, guint *nchans)

Get volume.

This function is typically called twice. The first run NULL will be passed to parameters names and levels, and the output plugin will then set the number of available channels to nchans and return TRUE. When the channels are known memory will be allocated for the channel names and volume level lists and the function will be called again, and this time the volume levels are extracted for real.

Parameters
outputan output object
namesa pointer to a list that is to be filled with channel names
levelsa pointer to a list that is to be filled with volume levels
nchansa pointer to a list that is to be filled with the nbr of chns
Returns
TRUE if the volume/chn count successfully retrieved, else FALSE
gboolean(* xmms_output_methods_St::volume_set)(xmms_output_t *output, const gchar *chan, guint val)

Set volume.

Parameters
outputan output object
chanthe name of the channel to set volume on
valthe volume level to set
Returns
TRUE if the update was successful, else FALSE
void(* xmms_output_methods_St::write)(xmms_output_t *output, gpointer buffer, gint size, xmms_error_t *err)

Write audio data to the output device.

This function is called from a separate thread and should block until the input buffer has been written to the soundcard. This function cannot coexist with status.

Parameters
outputan output object
buffera buffer with audio data to write to the soundcard
sizethe number of bytes in the buffer
erran error struct

The documentation for this struct was generated from the following file: