AudioBaseSink

This is the base class for audio sinks. Subclasses need to implement the ::create_ringbuffer vmethod. This base class will then take care of writing samples to the ringbuffer, synchronisation, clipping and flushing.

Members

Functions

createRingbuffer
gstaudio.audio_ring_buffer.AudioRingBuffer createRingbuffer()

Create and return the #GstAudioRingBuffer for sink. This function will call the ::create_ringbuffer vmethod and will set sink as the parent of the returned buffer (see gst.object.ObjectGst.setParent).

getAlignmentThreshold
gst.types.ClockTime getAlignmentThreshold()

Get the current alignment threshold, in nanoseconds, used by sink.

getDiscontWait
gst.types.ClockTime getDiscontWait()

Get the current discont wait, in nanoseconds, used by sink.

getDriftTolerance
long getDriftTolerance()

Get the current drift tolerance, in microseconds, used by sink.

getProvideClock
bool getProvideClock()

Queries whether sink will provide a clock or not. See also gst_audio_base_sink_set_provide_clock.

getSlaveMethod
gstaudio.types.AudioBaseSinkSlaveMethod getSlaveMethod()

Get the current slave method used by sink.

reportDeviceFailure
void reportDeviceFailure()

Informs this base class that the audio output device has failed for some reason, causing a discontinuity (for example, because the device recovered from the error, but lost all contents of its ring buffer). This function is typically called by derived classes, and is useful for the custom slave method.

setAlignmentThreshold
void setAlignmentThreshold(gst.types.ClockTime alignmentThreshold)

Controls the sink's alignment threshold.

setCustomSlavingCallback
void setCustomSlavingCallback(gstaudio.types.AudioBaseSinkCustomSlavingCallback callback)

Sets the custom slaving callback. This callback will be invoked if the slave-method property is set to GST_AUDIO_BASE_SINK_SLAVE_CUSTOM and the audio sink receives and plays samples.

setDiscontWait
void setDiscontWait(gst.types.ClockTime discontWait)

Controls how long the sink will wait before creating a discontinuity.

setDriftTolerance
void setDriftTolerance(long driftTolerance)

Controls the sink's drift tolerance.

setProvideClock
void setProvideClock(bool provide)

Controls whether sink will provide a clock or not. If provide is true, gst.element.Element.provideClock will return a clock that reflects the datarate of sink. If provide is false, gst.element.Element.provideClock will return NULL.

setSlaveMethod
void setSlaveMethod(gstaudio.types.AudioBaseSinkSlaveMethod method)

Controls how clock slaving will be performed in sink.

Inherited Members

From BaseSink

doPreroll
gst.types.FlowReturn doPreroll(gst.mini_object.MiniObject obj)

If the sink spawns its own thread for pulling buffers from upstream it should call this method after it has pulled a buffer. If the element needed to preroll, this function will perform the preroll and will then block until the element state is changed.

getBlocksize
uint getBlocksize()

Get the number of bytes that the sink will pull when it is operating in pull mode.

getDropOutOfSegment
bool getDropOutOfSegment()

Checks if sink is currently configured to drop buffers which are outside the current segment

getLastSample
gst.sample.Sample getLastSample()

Get the last sample that arrived in the sink and was used for preroll or for rendering. This property can be used to generate thumbnails.

getLatency
gst.types.ClockTime getLatency()

Get the currently configured latency.

getMaxBitrate
ulong getMaxBitrate()

Get the maximum amount of bits per second that the sink will render.

getMaxLateness
long getMaxLateness()

Gets the max lateness value. See gstbase.base_sink.BaseSink.setMaxLateness for more details.

getProcessingDeadline
gst.types.ClockTime getProcessingDeadline()

Get the processing deadline of sink. see gstbase.base_sink.BaseSink.setProcessingDeadline for more information about the processing deadline.

getRenderDelay
gst.types.ClockTime getRenderDelay()

Get the render delay of sink. see gstbase.base_sink.BaseSink.setRenderDelay for more information about the render delay.

getStats
gst.structure.Structure getStats()

Return various #GstBaseSink statistics. This function returns a #GstStructure with name application/x-gst-base-sink-stats with the following fields:

getSync
bool getSync()

Checks if sink is currently configured to synchronize against the clock.

getThrottleTime
ulong getThrottleTime()

Get the time that will be inserted between frames to control the maximum buffers per second.

getTsOffset
gst.types.ClockTimeDiff getTsOffset()

Get the synchronisation offset of sink.

isAsyncEnabled
bool isAsyncEnabled()

Checks if sink is currently configured to perform asynchronous state changes to PAUSED.

isLastSampleEnabled
bool isLastSampleEnabled()

Checks if sink is currently configured to store the last received sample in the last-sample property.

isQosEnabled
bool isQosEnabled()

Checks if sink is currently configured to send Quality-of-Service events upstream.

queryLatency
bool queryLatency(bool live, bool upstreamLive, gst.types.ClockTime minLatency, gst.types.ClockTime maxLatency)

Query the sink for the latency parameters. The latency will be queried from the upstream elements. live will be true if sink is configured to synchronize against the clock. upstream_live will be true if an upstream element is live.

setAsyncEnabled
void setAsyncEnabled(bool enabled)

Configures sink to perform all state changes asynchronously. When async is disabled, the sink will immediately go to PAUSED instead of waiting for a preroll buffer. This feature is useful if the sink does not synchronize against the clock or when it is dealing with sparse streams.

setBlocksize
void setBlocksize(uint blocksize)

Set the number of bytes that the sink will pull when it is operating in pull mode.

setDropOutOfSegment
void setDropOutOfSegment(bool dropOutOfSegment)

Configure sink to drop buffers which are outside the current segment

setLastSampleEnabled
void setLastSampleEnabled(bool enabled)

Configures sink to store the last received sample in the last-sample property.

setMaxBitrate
void setMaxBitrate(ulong maxBitrate)

Set the maximum amount of bits per second that the sink will render.

setMaxLateness
void setMaxLateness(long maxLateness)

Sets the new max lateness value to max_lateness. This value is used to decide if a buffer should be dropped or not based on the buffer timestamp and the current clock time. A value of -1 means an unlimited time.

setProcessingDeadline
void setProcessingDeadline(gst.types.ClockTime processingDeadline)

Maximum amount of time (in nanoseconds) that the pipeline can take for processing the buffer. This is added to the latency of live pipelines.

setQosEnabled
void setQosEnabled(bool enabled)

Configures sink to send Quality-of-Service events upstream.

setRenderDelay
void setRenderDelay(gst.types.ClockTime delay)

Set the render delay in sink to delay. The render delay is the time between actual rendering of a buffer and its synchronisation time. Some devices might delay media rendering which can be compensated for with this function.

setSync
void setSync(bool sync)

Configures sink to synchronize on the clock or not. When sync is false, incoming samples will be played as fast as possible. If sync is true, the timestamps of the incoming buffers will be used to schedule the exact render time of its contents.

setThrottleTime
void setThrottleTime(ulong throttle)

Set the time that will be inserted between rendered buffers. This can be used to control the maximum buffers per second that the sink will render.

setTsOffset
void setTsOffset(gst.types.ClockTimeDiff offset)

Adjust the synchronisation of sink with offset. A negative value will render buffers earlier than their timestamp. A positive value will delay rendering. This function can be used to fix playback of badly timestamped buffers.

wait
gst.types.FlowReturn wait(gst.types.ClockTime time, gst.types.ClockTimeDiff jitter)

This function will wait for preroll to complete and will then block until time is reached. It is usually called by subclasses that use their own internal synchronisation but want to let some synchronization (like EOS) be handled by the base class.

waitClock
gst.types.ClockReturn waitClock(gst.types.ClockTime time, gst.types.ClockTimeDiff jitter)

This function will block until time is reached. It is usually called by subclasses that use their own internal synchronisation.

waitPreroll
gst.types.FlowReturn waitPreroll()

If the #GstBaseSinkClass::render method performs its own synchronisation against the clock it must unblock when going from PLAYING to the PAUSED state and call this method before continuing to render the remaining data.