gstaudio.audio_ring_buffer
Module for [AudioRingBuffer] class
Types 3
This object is the base class for audio ringbuffers used by the base audio source and sink classes.
The ringbuffer abstracts a circular buffer of data. One reader and one writer can operate on the data from different threads in a lockfree manner. The base class is sufficiently flexible to be used as an abstraction for DMA based ringbuffers as well as a pure software implementations.
Methods
AudioRingBuffer self()Returns `this`, for use in `with` statements.AudioRingBufferGidBuilder builder()Get builder for [gstaudio.audioringbuffer.AudioRingBuffer] Returns: New builder objectvoid debugSpecBuff(gstaudio.audio_ring_buffer_spec.AudioRingBufferSpec spec)Print debug info about the buffer sized in spec to the debug log.void debugSpecCaps(gstaudio.audio_ring_buffer_spec.AudioRingBufferSpec spec)Print debug info about the parsed caps in spec to the debug log.bool parseCaps(gstaudio.audio_ring_buffer_spec.AudioRingBufferSpec spec, gst.caps.Caps caps)Parse caps into spec.bool acquire(gstaudio.audio_ring_buffer_spec.AudioRingBufferSpec spec)Allocate the resources for the ringbuffer. This function fills in the data pointer of the ring buffer with a valid #GstBuffer to which samples can be written.bool activate(bool active)Activate buf to start or stop pulling data.void advance(uint advance)Subclasses should call this function to notify the fact that advance segments are now processed by the device.void clear(int segment)Clear the given segment of the buffer with silence samples. This function is used by subclasses.void clearAll()Clear all samples from the ringbuffer.bool closeDevice()Close the audio device associated with the ring buffer. The ring buffer should already have been released via [gstaudio.audioringbuffer.AudioRingBuffer.release]. Returns: TRUE if the device could b...uint commit(ref ulong sample, ubyte[] data, int outSamples, ref int accum)Commit in_samples samples pointed to by data to the ringbuffer buf.bool convert(gst.types.Format srcFmt, long srcVal, gst.types.Format destFmt, out long destVal)Convert srcval in srcfmt to the equivalent value in destfmt. The result will be put in destval.uint delay()Get the number of samples queued in the audio device. This is usually less than the segment size but can be bigger when the implementation uses another internal buffer between the audio device.bool deviceIsOpen()Checks the status of the device associated with the ring buffer. Returns: TRUE if the device was open, FALSE if it was closed.bool isAcquired()Check if the ringbuffer is acquired and ready to use. Returns: TRUE if the ringbuffer is acquired, FALSE on error.bool isActive()Check if buf is activated.bool isFlushing()Check if buf is flushing.void mayStart(bool allowed)Tell the ringbuffer that it is allowed to start playback when the ringbuffer is filled with samples.bool openDevice()Open the audio device associated with the ring buffer. Does not perform any setup on the device. You must open the device before acquiring the ring buffer. Returns: TRUE if the device could be open...bool pause()Pause processing samples from the ringbuffer. Returns: TRUE if the device could be paused, FALSE on error.bool prepareRead(out int segment, out ubyte[] readptr)Returns a pointer to memory where the data from segment segment can be found. This function is mostly used by subclasses.uint read(ulong sample, ubyte[] data, out gst.types.ClockTime timestamp)Read len samples from the ringbuffer into the memory pointed to by data. The first sample should be read from position sample in the ringbuffer.bool release()Free the resources of the ringbuffer. Returns: TRUE if the device could be released, FALSE on error.ulong samplesDone()Get the number of samples that were processed by the ringbuffer since it was last started. This does not include the number of samples not yet processed (see [gstaudio.audioringbuffer.AudioRingBuff...void setCallback(gstaudio.types.AudioRingBufferCallback cb = null)Sets the given callback function on the buffer. This function will be called every time a segment has been written to a device.void setErrored()Mark the ringbuffer as errored after it has started.void setFlushing(bool flushing)Set the ringbuffer to flushing mode or normal mode.void setSample(ulong sample)Make sure that the next sample written to the device is accounted for as being the sample sample written to the device. This value will be used in reporting the current sample position of the ringb...void setTimestamp(int readseg, gst.types.ClockTime timestamp)bool start()Start processing samples from the ringbuffer. Returns: TRUE if the device could be started, FALSE on error.bool stop()Stop processing samples from the ringbuffer. Returns: TRUE if the device could be stopped, FALSE on error.Fluent builder for [gstaudio.audio_ring_buffer.AudioRingBuffer]
Methods