| Top |
GObject ╰── GInitiallyUnowned ╰── GstObject ╰── GstElement ╰── GstBaseSrc ╰── GstPushSrc ╰── GstAudioBaseSrc ╰── GstAudioSrc
This is the most simple base class for audio sources that only requires subclasses to implement a set of simple functions:
:Open the device.open()
:Configure the device with the specified format.prepare()
:Read samples from the device.read()
:Unblock reads and flush the device.reset()
:Get the number of samples in the device but not yet read.delay()
:Undo operations done by prepare.unprepare()
:Close the device.close()
All scheduling of samples and timestamps is done in this base class together with GstAudioBaseSrc using a default implementation of a GstAudioRingBuffer that uses threads.
struct GstAudioSrcClass {
GstAudioBaseSrcClass parent_class;
/* vtable */
/* open the device with given specs */
gboolean (*open) (GstAudioSrc *src);
/* prepare resources and state to operate with the given specs */
gboolean (*prepare) (GstAudioSrc *src, GstAudioRingBufferSpec *spec);
/* undo anything that was done in prepare() */
gboolean (*unprepare) (GstAudioSrc *src);
/* close the device */
gboolean (*close) (GstAudioSrc *src);
/* read samples from the device */
guint (*read) (GstAudioSrc *src, gpointer data, guint length,
GstClockTime *timestamp);
/* get number of frames queued in the device */
guint (*delay) (GstAudioSrc *src);
/* reset the audio device, unblock from a write */
void (*reset) (GstAudioSrc *src);
};
GstAudioSrc class. Override the vmethod to implement functionality.