XMMS2
|
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... | |
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.
void(* xmms_output_methods_St::close)(xmms_output_t *output) |
Close the output device.
This function cannot coexist with status.
output | an output object |
void(* xmms_output_methods_St::destroy)(xmms_output_t *output) |
Destroy the output plugin.
Tear down the data initialized in new.
output | an 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.
output | an 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.
output | an output object |
type | the stream type to use |
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.
output | an output object |
type | the stream type to use |
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.
output | an output object |
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.
output | an output object |
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.
output | an output object |
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.
output | an output object |
status | the 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.
output | an output object |
names | a pointer to a list that is to be filled with channel names |
levels | a pointer to a list that is to be filled with volume levels |
nchans | a pointer to a list that is to be filled with the nbr of chns |
gboolean(* xmms_output_methods_St::volume_set)(xmms_output_t *output, const gchar *chan, guint val) |
Set volume.
output | an output object |
chan | the name of the channel to set volume on |
val | the volume level to set |
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.
output | an output object |
buffer | a buffer with audio data to write to the soundcard |
size | the number of bytes in the buffer |
err | an error struct |