Sample#
- class Sample(**kwargs)#
A Sample is a small object containing data, a type, timing and
extra arbitrary information.
Constructors#
Methods#
- class Sample
-
- get_buffer_list() BufferList | None#
Get the buffer list associated with
sampleAdded in version 1.6.
- is_writable() bool#
Tests if you can safely set the buffer and / or buffer list of
sample.Added in version 1.16.
- make_writable() Sample#
Returns a writable copy of
sample. If the source sample is already writable, this will simply return the same sample.Use this function to ensure that a sample can be safely modified before making changes to it, for example before calling
set_buffer()If the reference count of the source sample
sampleis exactly one, the caller is the sole owner and this function will return the sample object unchanged.If there is more than one reference on the object, a copy will be made using
copy(). The passed-insamplewill be unreffed in that case, and the caller will now own a reference to the new returned sample object.In short, this function unrefs the sample in the argument and refs the sample that it returns. Don’t access the argument after calling this function unless you have an additional reference to it.
Added in version 1.16.
- set_buffer(buffer: Buffer) None#
Set the buffer associated with
sample.samplemust be writable.Added in version 1.16.
- Parameters:
buffer – A
Buffer
- set_buffer_list(buffer_list: BufferList) None#
Set the buffer list associated with
sample.samplemust be writable.Added in version 1.6.
- Parameters:
buffer_list – a
BufferList
- set_caps(caps: Caps) None#
Set the caps associated with
sample.samplemust be writable.Added in version 1.16.
- Parameters:
caps – A
Caps