Callbacks

AudioBaseSinkCustomSlavingCallback (sink, etime, itime, requested_skew, discont_reason, *user_data)

AudioClockGetTimeFunc (clock, *user_data)

AudioFormatPack (info, flags, src, data, length)

AudioFormatUnpack (info, flags, dest, data, length)

AudioRingBufferCallback (rbuf, data, *user_data)

Details

GstAudio.AudioBaseSinkCustomSlavingCallback(sink, etime, itime, requested_skew, discont_reason, *user_data)
Parameters:

This function is set with GstAudio.AudioBaseSink.set_custom_slaving_callback() and is called during playback. It receives the current time of external and internal clocks, which the callback can then use to apply any custom slaving/synchronization schemes.

The external clock is the sink’s element clock, the internal one is the internal audio clock. The internal audio clock’s calibration is applied to the timestamps before they are passed to the callback. The difference between etime and itime is the skew; how much internal and external clock lie apart from each other. A skew of 0 means both clocks are perfectly in sync. itime > etime means the external clock is going slower, while itime < etime means it is going faster than the internal clock. etime and itime are always valid timestamps, except for when a discontinuity happens.

requested_skew is an output value the callback can write to. It informs the sink of whether or not it should move the playout pointer, and if so, by how much. This pointer is only None if a discontinuity occurs; otherwise, it is safe to write to *requested_skew. The default skew is 0.

The sink may experience discontinuities. If one happens, discont is True, itime, etime are set to Gst.CLOCK_TIME_NONE, and requested_skew is None. This makes it possible to reset custom clock slaving algorithms when a discontinuity happens.

New in version 1.6.

GstAudio.AudioClockGetTimeFunc(clock, *user_data)
Parameters:
Returns:

the current time or Gst.CLOCK_TIME_NONE if the previous time should be used.

Return type:

int

This function will be called whenever the current clock time needs to be calculated. If this function returns Gst.CLOCK_TIME_NONE, the last reported time will be returned by the clock.

GstAudio.AudioFormatPack(info, flags, src, data, length)
Parameters:

Packs length samples from src to the data array in format info. The samples from source have each channel interleaved and will be packed into data.

GstAudio.AudioFormatUnpack(info, flags, dest, data, length)
Parameters:

Unpacks length samples from the given data of format info. The samples will be unpacked into dest which each channel interleaved. dest should at least be big enough to hold length * channels * size(unpack_format) bytes.

GstAudio.AudioRingBufferCallback(rbuf, data, *user_data)
Parameters:

This function is set with GstAudio.AudioRingBuffer.set_callback() and is called to fill the memory at data with len bytes of samples.