Class BufferList

java.lang.Object
org.javagi.base.ProxyInstance
org.freedesktop.gstreamer.gst.BufferList
All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class BufferList extends ProxyInstance

Buffer lists are an object containing a list of buffers.

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

    Constructors
    Constructor
    Description
    Creates a new, empty GstBufferList.
    Create a BufferList proxy instance for the provided memory address.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Calculates the size of the data contained in this BufferList by adding the size of all buffers.
    Creates a shallow copy of the given buffer list.
    Creates a copy of the given buffer list.
    boolean
    foreach(@Nullable BufferListFunc func)
    Calls func with data for each buffer in list.
    get(int idx)
    Gets the buffer at idx.
    The memory layout of the native struct.
    static @Nullable Type
    Get the GType of the BufferList class.
    getWritable(int idx)
    Gets the buffer at idx, ensuring it is a writable buffer.
    void
    insert(int idx, Buffer buffer)
    Inserts buffer at idx in list. Other buffers are moved to make room for this new buffer.
    int
    Returns the number of buffers in list.
    ref()
    Increases the refcount of the given buffer list by one.
    void
    remove(int idx, int length)
    Removes length buffers starting from idx in list. The following buffers are moved to close the gap.
    static boolean
    replace(@Nullable Out<BufferList> oldList, @Nullable BufferList newList)
    Modifies a pointer to a GstBufferList to point to a different GstBufferList.
    static BufferList
    sized(int size)
    Creates a new, empty GstBufferList.
    static boolean
    take(Out<BufferList> oldList, @Nullable BufferList newList)
    Modifies a pointer to a GstBufferList to point to a different GstBufferList.
    void
    Decreases the refcount of the buffer list.

    Methods inherited from class ProxyInstance

    equals, handle, hashCode

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BufferList

      public BufferList(MemorySegment address)
      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, empty GstBufferList.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the BufferList class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • sized

      public static BufferList sized(int size)
      Creates a new, empty GstBufferList. The list will have size space preallocated so that memory reallocations can be avoided.
      Parameters:
      size - an initial reserved size
      Returns:
      the new GstBufferList.
    • replace

      public static boolean replace(@Nullable Out<BufferList> oldList, @Nullable BufferList newList)

      Modifies a pointer to a GstBufferList to point to a different GstBufferList. 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 newList or the GstBufferList pointed to by oldList may be null.

      Parameters:
      oldList - pointer to a pointer to a GstBufferList to be replaced.
      newList - pointer to a GstBufferList that will replace the buffer list pointed to by oldList.
      Returns:
      true if newList was different from oldList
      Since:
      1.16
    • take

      public static boolean take(Out<BufferList> oldList, @Nullable BufferList newList)
      Modifies a pointer to a GstBufferList to point to a different GstBufferList. This function is similar to gst_buffer_list_replace() except that it takes ownership of newList.
      Parameters:
      oldList - pointer to a pointer to a GstBufferList to be replaced.
      newList - pointer to a GstBufferList that will replace the bufferlist pointed to by oldList.
      Returns:
      true if newList was different from oldList
      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

      public BufferList 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

      public BufferList 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

      public boolean foreach(@Nullable BufferListFunc func)

      Calls func with data for each buffer in list.

      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.

      Parameters:
      func - a GstBufferListFunc to call
      Returns:
      true when func returned true for each buffer in this BufferList or when this BufferList is empty.
    • get

      public Buffer get(int idx)

      Gets the buffer at idx.

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

      Parameters:
      idx - the index
      Returns:
      the buffer at idx in group. The returned buffer remains valid as long as this BufferList is valid and buffer is not removed from the list.
    • getWritable

      public Buffer getWritable(int idx)

      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.

      Parameters:
      idx - the index
      Returns:
      the buffer at idx in group. 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

      public void insert(int idx, Buffer buffer)

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

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

      Parameters:
      idx - the index
      buffer - a GstBuffer
    • length

      public int length()
      Returns the number of buffers in list.
      Returns:
      the number of buffers in the buffer list
    • ref

      public BufferList 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)
      Removes length buffers starting from idx in list. The following buffers are moved to close the gap.
      Parameters:
      idx - the index
      length - 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.