Class: GstAudio::AudioRingBuffer
- Inherits:
-
Gst::Object
- Object
- GObject::InitiallyUnowned
- Gst::Object
- GstAudio::AudioRingBuffer
- Defined in:
- (unknown)
Overview
The vmethods that subclasses can override to implement the ringbuffer.
Class Method Summary collapse
-
.debug_spec_buff(spec) ⇒ nil
Print debug info about the buffer sized in spec to the debug log.
-
.debug_spec_caps(spec) ⇒ nil
Print debug info about the parsed caps in spec to the debug log.
-
.parse_caps(spec, caps) ⇒ Boolean
Parse caps into spec.
Instance Method Summary collapse
-
#acquire(spec) ⇒ Boolean
Allocate the resources for the ringbuffer.
-
#activate(active) ⇒ Boolean
Activate buf to start or stop pulling data.
-
#advance(advance) ⇒ nil
Subclasses should call this function to notify the fact that advance segments are now processed by the device.
-
#channel_positions=(position) ⇒ nil
Tell the ringbuffer about the device's channel positions.
-
#clear(segment) ⇒ nil
Clear the given segment of the buffer with silence samples.
-
#clear_all ⇒ nil
Clear all samples from the ringbuffer.
-
#close_device ⇒ Boolean
Close the audio device associated with the ring buffer.
-
#commit(sample, data, in_samples, out_samples, accum) ⇒ Integer
Commit in_samples samples pointed to by data to the ringbuffer buf.
-
#convert(src_fmt, src_val, dest_fmt, dest_val) ⇒ Boolean
Convert src_val in src_fmt to the equivalent value in dest_fmt.
-
#delay ⇒ Integer
Get the number of samples queued in the audio device.
-
#device_is_open ⇒ Boolean
Checks the status of the device associated with the ring buffer.
-
#flushing=(flushing) ⇒ nil
Set the ringbuffer to flushing mode or normal mode.
-
#is_acquired ⇒ Boolean
Check if the ringbuffer is acquired and ready to use.
-
#is_active ⇒ Boolean
Check if buf is activated.
-
#is_flushing ⇒ Boolean
Check if buf is flushing.
-
#may_start(allowed) ⇒ nil
Tell the ringbuffer that it is allowed to start playback when the ringbuffer is filled with samples.
-
#open_device ⇒ Boolean
Open the audio device associated with the ring buffer.
-
#pause ⇒ Boolean
Pause processing samples from the ringbuffer.
-
#prepare_read(segment, readptr, len) ⇒ Boolean
Returns a pointer to memory where the data from segment segment can be found.
-
#read(sample, data, len, timestamp) ⇒ Integer
Read len samples from the ringbuffer into the memory pointed to by data.
-
#release ⇒ Boolean
Free the resources of the ringbuffer.
-
#sample=(sample) ⇒ nil
Make sure that the next sample written to the device is accounted for as being the sample sample written to the device.
-
#samples_done ⇒ Integer
Get the number of samples that were processed by the ringbuffer since it was last started.
-
#set_callback(cb, user_data) ⇒ nil
Sets the given callback function on the buffer.
-
#set_callback_full(cb, user_data, notify) ⇒ nil
Sets the given callback function on the buffer.
-
#set_errored ⇒ nil
Mark the ringbuffer as errored after it has started.
- #set_timestamp(readseg, timestamp) ⇒ nil
-
#start ⇒ Boolean
Start processing samples from the ringbuffer.
-
#stop ⇒ Boolean
Stop processing samples from the ringbuffer.
Methods inherited from Gst::Object
#add_control_binding, check_uniqueness, #control_bindings_disabled=, #control_rate, #control_rate=, default_deep_notify, #default_error, #get_control_binding, #get_g_value_array, #get_value, #get_value_array, #has_active_control_bindings, #has_ancestor, #has_as_ancestor, #has_as_parent, #name, #name=, #parent, #parent=, #path_string, #ref, ref_sink, #remove_control_binding, replace, #set_control_binding_disabled, #suggest_next_sync, #sync_values, #unparent, #unref
Class Method Details
.debug_spec_buff(spec) ⇒ nil
Print debug info about the buffer sized in spec to the debug log.
.debug_spec_caps(spec) ⇒ nil
Print debug info about the parsed caps in spec to the debug log.
.parse_caps(spec, caps) ⇒ Boolean
Parse caps into spec.
Instance Method Details
#acquire(spec) ⇒ Boolean
Allocate the resources for the ringbuffer. This function fills in the data pointer of the ring buffer with a valid Gst::Buffer to which samples can be written. MT safe.
#activate(active) ⇒ Boolean
Activate buf to start or stop pulling data.
MT safe. FALSE on error.
#advance(advance) ⇒ nil
Subclasses should call this function to notify the fact that advance segments are now processed by the device.
MT safe.
#channel_positions=(position) ⇒ nil
Tell the ringbuffer about the device's channel positions. This must be called in when the ringbuffer is acquired.
#clear(segment) ⇒ nil
Clear the given segment of the buffer with silence samples. This function is used by subclasses.
MT safe.
#clear_all ⇒ nil
Clear all samples from the ringbuffer.
MT safe.
#close_device ⇒ Boolean
Close the audio device associated with the ring buffer. The ring buffer should already have been released via gst_audio_ring_buffer_release(). MT safe.
#commit(sample, data, in_samples, out_samples, accum) ⇒ Integer
Commit in_samples samples pointed to by data to the ringbuffer buf.
in_samples and out_samples define the rate conversion to perform on the samples in data. For negative rates, out_samples must be negative and in_samples positive.
When out_samples is positive, the first sample will be written at position sample in the ringbuffer. When out_samples is negative, the last sample will be written to sample in reverse order.
out_samples does not need to be a multiple of the segment size of the ringbuffer although it is recommended for optimal performance.
accum will hold a temporary accumulator used in rate conversion and should be set to 0 when this function is first called. In case the commit operation is interrupted, one can resume the processing by passing the previously returned accum value back to this function.
MT safe. number of samples written can be less than out_samples when buf was interrupted with a flush or stop.
#convert(src_fmt, src_val, dest_fmt, dest_val) ⇒ Boolean
Convert src_val in src_fmt to the equivalent value in dest_fmt. The result will be put in dest_val.
#delay ⇒ Integer
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.
For playback ringbuffers this is the amount of samples transferred from the ringbuffer to the device but still not played.
For capture ringbuffers this is the amount of samples in the device that are not yet transferred to the ringbuffer. MT safe.
#device_is_open ⇒ Boolean
Checks the status of the device associated with the ring buffer. MT safe.
#flushing=(flushing) ⇒ nil
Set the ringbuffer to flushing mode or normal mode.
MT safe.
#is_acquired ⇒ Boolean
Check if the ringbuffer is acquired and ready to use. MT safe.
#is_active ⇒ Boolean
Check if buf is activated.
MT safe.
#is_flushing ⇒ Boolean
Check if buf is flushing.
MT safe.
#may_start(allowed) ⇒ nil
Tell the ringbuffer that it is allowed to start playback when the ringbuffer is filled with samples.
MT safe.
#open_device ⇒ Boolean
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. MT safe.
#pause ⇒ Boolean
Pause processing samples from the ringbuffer. MT safe.
#prepare_read(segment, readptr, len) ⇒ Boolean
Returns a pointer to memory where the data from segment segment can be found. This function is mostly used by subclasses. MT safe.
#read(sample, data, len, timestamp) ⇒ Integer
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.
len should not be a multiple of the segment size of the ringbuffer although it is recommended.
timestamp will return the timestamp associated with the data returned. error.
MT safe.
#release ⇒ Boolean
Free the resources of the ringbuffer. MT safe.
#sample=(sample) ⇒ nil
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 ringbuffer.
This function will also clear the buffer with silence.
MT safe.
#samples_done ⇒ Integer
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 gst_audio_ring_buffer_delay()). MT safe.
#set_callback(cb, user_data) ⇒ nil
Sets the given callback function on the buffer. This function will be called every time a segment has been written to a device.
MT safe.
#set_callback_full(cb, user_data, notify) ⇒ nil
Sets the given callback function on the buffer. This function will be called every time a segment has been written to a device.
MT safe.
#set_errored ⇒ nil
Mark the ringbuffer as errored after it has started.
MT safe.
#set_timestamp(readseg, timestamp) ⇒ nil
#start ⇒ Boolean
Start processing samples from the ringbuffer. MT safe.
#stop ⇒ Boolean
Stop processing samples from the ringbuffer. MT safe.