AudioBuffer.truncate

Truncate the buffer to finally have samples number of samples, removing the necessary amount of samples from the end and trim number of samples from the beginning.

This function does not know the audio rate, therefore the caller is responsible for re-setting the correct timestamp and duration to the buffer. However, timestamp will be preserved if trim == 0, and duration will also be preserved if there is no trimming to be done. Offset and offset end will be preserved / updated.

After calling this function the caller does not own a reference to buffer anymore.

class AudioBuffer
static
truncate

Parameters

buffer gst.buffer.Buffer

The buffer to truncate.

bpf int

size of one audio frame in bytes. This is the size of one sample * number of channels.

trim size_t

the number of samples to remove from the beginning of the buffer

samples size_t

the final number of samples that should exist in this buffer or -1 to use all the remaining samples if you are only removing samples from the beginning.

Return Value

Type: gst.buffer.Buffer

the truncated buffer