Class BufferList
- All Implemented Interfaces:
Proxy
Buffer lists are created with gst_buffer_list_new() and filled with data using gst_buffer_list_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.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new, emptyGstBufferList.BufferList(MemorySegment address) Create a BufferList proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionlongCalculates the size of the data contained in this BufferList by adding the size of all buffers.copy()Creates a shallow copy of the given buffer list.copyDeep()Creates a copy of the given buffer list.booleanforeach(@Nullable BufferListFunc func) Callsfuncwithdatafor each buffer inlist.get(int idx) Gets the buffer atidx.static @Nullable TypegetType()Get the GType of the BufferList classgetWritable(int idx) Gets the buffer atidx,ensuring it is a writable buffer.voidInsertsbufferatidxinlist.Other buffers are moved to make room for this new buffer.intlength()Returns the number of buffers inlist.ref()Increases the refcount of the given buffer list by one.voidremove(int idx, int length) Removeslengthbuffers starting fromidxinlist.The following buffers are moved to close the gap.static booleanreplace(@Nullable Out<BufferList> oldList, @Nullable BufferList newList) Modifies a pointer to aGstBufferListto point to a differentGstBufferList.static BufferListsized(int size) Creates a new, emptyGstBufferList.static booleantake(Out<BufferList> oldList, @Nullable BufferList newList) Modifies a pointer to aGstBufferListto point to a differentGstBufferList.voidunref()Decreases the refcount of the buffer list.Methods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
BufferList
Create a BufferList proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
BufferList
public BufferList()Creates a new, emptyGstBufferList.
-
-
Method Details
-
getType
-
sized
Creates a new, emptyGstBufferList. The list will havesizespace preallocated so that memory reallocations can be avoided.- Parameters:
size- an initial reserved size- Returns:
- the new
GstBufferList.
-
replace
Modifies a pointer to aGstBufferListto point to a differentGstBufferList. 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
newListor theGstBufferListpointed to byoldListmay benull.- Parameters:
oldList- pointer to a pointer to aGstBufferListto be replaced.newList- pointer to aGstBufferListthat will replace the buffer list pointed to byoldList.- Returns:
trueifnewListwas different fromoldList- Since:
- 1.16
-
take
Modifies a pointer to aGstBufferListto point to a differentGstBufferList. This function is similar to gst_buffer_list_replace() except that it takes ownership ofnewList.- Parameters:
oldList- pointer to a pointer to aGstBufferListto be replaced.newList- pointer to aGstBufferListthat will replace the bufferlist pointed to byoldList.- Returns:
trueifnewListwas different fromoldList- Since:
- 1.16
-
calculateSize
public long calculateSize()Calculates the size of the data contained in this BufferList by adding the size of all buffers.- Returns:
- the size of the data contained in this BufferList in bytes.
- Since:
- 1.14
-
copy
Creates a shallow copy of the given buffer list. This will make a newly allocated copy of the source list with copies of buffer pointers. The refcount of buffers pointed to will be increased by one.- Returns:
- a new copy of
list.
-
copyDeep
Creates a copy of the given buffer list. This will make a newly allocated copy of the buffers that the source buffer list contains.- Returns:
- a new copy of
list. - Since:
- 1.6
-
foreach
Callsfuncwithdatafor each buffer inlist.funccan modify the passed buffer pointer or its contents. The return value offuncdefines if this function returns or if the remaining buffers in the list should be skipped.- Parameters:
func- aGstBufferListFuncto call- Returns:
truewhenfuncreturnedtruefor each buffer in this BufferList or when this BufferList is empty.
-
get
Gets the buffer atidx.You must make sure that
idxdoes not exceed the number of buffers available.- Parameters:
idx- the index- Returns:
- the buffer at
idxingroup.The returned buffer remains valid as long as this BufferList is valid and buffer is not removed from the list.
-
getWritable
Gets the buffer atidx,ensuring it is a writable buffer.You must make sure that
idxdoes not exceed the number of buffers available.- Parameters:
idx- the index- Returns:
- the buffer at
idxingroup.The returned buffer remains valid as long as this BufferList is valid and the buffer is not removed from the list. - Since:
- 1.14
-
insert
Insertsbufferatidxinlist.Other buffers are moved to make room for this new buffer.A -1 value for
idxwill append the buffer at the end.- Parameters:
idx- the indexbuffer- aGstBuffer
-
length
public int length()Returns the number of buffers inlist.- Returns:
- the number of buffers in the buffer list
-
ref
Increases the refcount of the given buffer list by one.Note that the refcount affects the writability of this BufferList and its data, see gst_buffer_list_make_writable(). It is important to note that keeping additional references to GstBufferList instances can potentially increase the number of memcpy operations in a pipeline.
- Returns:
- this BufferList
-
remove
public void remove(int idx, int length) Removeslengthbuffers starting fromidxinlist.The following buffers are moved to close the gap.- Parameters:
idx- the indexlength- the amount to remove
-
unref
public void unref()Decreases the refcount of the buffer list. If the refcount reaches 0, the buffer list will be freed.
-