Top | ![]() |
![]() |
![]() |
![]() |
GObject ╰── GInitiallyUnowned ╰── GstObject ╰── GstElement ╰── GstBaseSink ╰── GstAudioBaseSink ╰── GstAudioSink
This is the most simple base class for audio sinks that only requires subclasses to implement a set of simple functions:
|
Open the device. |
|
Configure the device with the specified format. |
|
Write samples to the device. |
|
Unblock writes and flush the device. |
|
Get the number of samples written but not yet played by the device. |
|
Undo operations done by prepare. |
|
Close the device. |
All scheduling of samples and timestamps is done in this base class together with GstAudioBaseSink using a default implementation of a GstAudioRingBuffer that uses threads.
struct GstAudioSinkClass { GstAudioBaseSinkClass parent_class; /* vtable */ /* open the device with given specs */ gboolean (*open) (GstAudioSink *sink); /* prepare resources and state to operate with the given specs */ gboolean (*prepare) (GstAudioSink *sink, GstAudioRingBufferSpec *spec); /* undo anything that was done in prepare() */ gboolean (*unprepare) (GstAudioSink *sink); /* close the device */ gboolean (*close) (GstAudioSink *sink); /* write samples to the device */ gint (*write) (GstAudioSink *sink, gpointer data, guint length); /* get number of samples queued in the device */ guint (*delay) (GstAudioSink *sink); /* reset the audio device, unblock from a write */ void (*reset) (GstAudioSink *sink); };
GstAudioSink class. Override the vmethods to implement functionality.
GstAudioBaseSinkClass |
the parent class structure. |
|
Open the device. No configuration needs to be done at this point. This function is also used to check if the device is available. |
||
Prepare the device to operate with the specified parameters. |
||
Undo operations done in prepare. |
||
Close the device. |
||
Write data to the device. |
||
Return how many samples are still in the device. This is used to drive the synchronisation. |
||
Returns as quickly as possible from a write and flush any pending samples from the device. |