BufferList#
- class BufferList(**kwargs)#
Buffer lists are an object containing a list of buffers.
Buffer lists are created with new()
and filled with data
using insert()
.
Buffer lists can be pushed on a srcpad with push_list()
. This is
interesting when multiple buffers need to be pushed in one go because it
can reduce the amount of overhead for pushing each buffer individually.
Constructors#
- class BufferList
- classmethod new() BufferList #
Creates a new, empty
BufferList
.
- classmethod new_sized(size: int) BufferList #
Creates a new, empty
BufferList
. The list will havesize
space preallocated so that memory reallocations can be avoided.- Parameters:
size – an initial reserved size
Methods#
- class BufferList
- calculate_size() int #
Calculates the size of the data contained in
list
by adding the size of all buffers.Added in version 1.14.
- foreach(func: Callable[[int, Any], Tuple[bool, Buffer | None]], user_data: Any = None) bool #
Calls
func
withdata
for each buffer inlist
.func
can modify the passed buffer pointer or its contents. The return value offunc
defines if this function returns or if the remaining buffers in the list should be skipped.- Parameters:
func – a
BufferListFunc
to calluser_data – user data passed to
func
- get(idx: int) Buffer | None #
Gets the buffer at
idx
.You must make sure that
idx
does not exceed the number of buffers available.- Parameters:
idx – the index
- get_writable(idx: int) Buffer | None #
Gets the buffer at
idx
, ensuring it is a writable buffer.You must make sure that
idx
does not exceed the number of buffers available.Added in version 1.14.
- Parameters:
idx – the index