Callbacks¶
|
|
|
|
|
|
|
|
|
Details¶
- GstAudio.AudioBaseSinkCustomSlavingCallback(sink, etime, itime, requested_skew, discont_reason, *user_data)¶
- Parameters:
sink (
GstAudio.AudioBaseSink
) – aGstAudio.AudioBaseSink
etime (
int
) – external clock timeitime (
int
) – internal clock timerequested_skew (
int
) – skew amount requested by the callbackdiscont_reason (
GstAudio.AudioBaseSinkDiscontReason
) – reason for discontinuity (if any)
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 toGst.CLOCK_TIME_NONE
, and requested_skew isNone
. 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:
clock (
Gst.Clock
) – theGstAudio.AudioClock
- Returns:
the current time or
Gst.CLOCK_TIME_NONE
if the previous time should be used.- Return type:
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:
info (
GstAudio.AudioFormatInfo
) – aGstAudio.AudioFormatInfo
src (
bytes
) – a source arraydata (
bytes
) – pointer to the destination datalength (
int
) – the amount of samples to pack.
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:
info (
GstAudio.AudioFormatInfo
) – aGstAudio.AudioFormatInfo
dest (
bytes
) – a destination arraydata (
bytes
) – pointer to the audio datalength (
int
) – the amount of samples to unpack.
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:
rbuf (
GstAudio.AudioRingBuffer
) – aGstAudio.AudioRingBuffer
data (
bytes
) – target to fill
This function is set with
GstAudio.AudioRingBuffer.set_callback
() and is called to fill the memory at data with len bytes of samples.