Gst.BufferList

Fields

None

Methods

class

new ()

class

new_sized (size)

class

replace (old_list, new_list)

class

take (old_list, new_list)

calculate_size ()

copy_deep ()

foreach (func, *user_data)

get (idx)

get_writable (idx)

insert (idx, buffer)

is_writable ()

length ()

make_writable ()

remove (idx, length)

Details

class Gst.BufferList

Buffer lists are an object containing a list of buffers.

Buffer lists are created with Gst.BufferList.new() and filled with data using Gst.BufferList.insert().

Buffer lists can be pushed on a srcpad with Gst.Pad.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.

classmethod new()[source]
Returns:

the new Gst.BufferList.

Return type:

Gst.BufferList

Creates a new, empty Gst.BufferList.

classmethod new_sized(size)[source]
Parameters:

size (int) – an initial reserved size

Returns:

the new Gst.BufferList.

Return type:

Gst.BufferList

Creates a new, empty Gst.BufferList. The list will have size space preallocated so that memory reallocations can be avoided.

classmethod replace(old_list, new_list)[source]
Parameters:
Returns:

True if new_list was different from old_list

old_list:

pointer to a pointer to a Gst.BufferList to be replaced.

Return type:

(bool, old_list: Gst.BufferList or None)

Modifies a pointer to a Gst.BufferList to point to a different Gst.BufferList. The modification is done atomically (so this is useful for ensuring thread safety in some cases), and the reference counts are updated appropriately (the old buffer list is unreffed, the new is reffed).

Either new_list or the Gst.BufferList pointed to by old_list may be None.

New in version 1.16.

classmethod take(old_list, new_list)[source]
Parameters:
Returns:

True if new_list was different from old_list

old_list:

pointer to a pointer to a Gst.BufferList to be replaced.

Return type:

(bool, old_list: Gst.BufferList)

Modifies a pointer to a Gst.BufferList to point to a different Gst.BufferList. This function is similar to Gst.BufferList.replace() except that it takes ownership of new_list.

New in version 1.16.

calculate_size()[source]
Returns:

the size of the data contained in self in bytes.

Return type:

int

Calculates the size of the data contained in self by adding the size of all buffers.

New in version 1.14.

copy_deep()[source]
Returns:

a new copy of self.

Return type:

Gst.BufferList

Creates a copy of the given buffer list. This will make a newly allocated copy of the buffers that the source buffer list contains.

New in version 1.6.

foreach(func, *user_data)[source]
Parameters:
Returns:

True when func returned True for each buffer in self or when self is empty.

Return type:

bool

Calls func with data for each buffer in self.

func can modify the passed buffer pointer or its contents. The return value of func defines if this function returns or if the remaining buffers in the list should be skipped.

get(idx)[source]
Parameters:

idx (int) – the index

Returns:

the buffer at idx in group. The returned buffer remains valid as long as self is valid and buffer is not removed from the list.

Return type:

Gst.Buffer

Gets the buffer at idx.

You must make sure that idx does not exceed the number of buffers available.

get_writable(idx)[source]
Parameters:

idx (int) – the index

Returns:

the buffer at idx in group. The returned buffer remains valid as long as self is valid and the buffer is not removed from the list.

Return type:

Gst.Buffer

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.

New in version 1.14.

insert(idx, buffer)[source]
Parameters:

Inserts buffer at idx in self. Other buffers are moved to make room for this new buffer.

A -1 value for idx will append the buffer at the end.

is_writable()[source]
Return type:

bool

Tests if you can safely modify self. It is only safe to modify buffer list when there is only one owner of the buffer list - ie, the object is writable.

length()[source]
Returns:

the number of buffers in the buffer list

Return type:

int

Returns the number of buffers in self.

make_writable()[source]
Returns:

a writable buffer list which may or may not be the same as buffer list

Return type:

Gst.BufferList

Returns a writable copy of self.

If there is only one reference count on self, the caller must be the owner, and so this function will return the buffer list object unchanged. If on the other hand there is more than one reference on the object, a new buffer list object will be returned. The caller’s reference on self will be removed, and instead the caller will own a reference to the returned object.

In short, this function unrefs the buffer_list in the argument and refs the buffer list that it returns. Don’t access the argument after calling this function. See also: gst_buffer_list_ref().

remove(idx, length)[source]
Parameters:
  • idx (int) – the index

  • length (int) – the amount to remove

Removes length buffers starting from idx in self. The following buffers are moved to close the gap.