Class DataQueue

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class DataQueue extends GObject
GstDataQueue is an object that handles threadsafe queueing of objects. It also provides size-related functionality. This object should be used for any GstElement that wishes to provide some sort of queueing functionality.
  • Constructor Details

    • DataQueue

      public DataQueue(MemorySegment address)
      Create a DataQueue instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • DataQueue

      public DataQueue(@Nullable DataQueueCheckFullFunction checkfull, @Nullable DataQueueFullCallback fullcallback, @Nullable DataQueueEmptyCallback emptycallback)
      Creates a new GstDataQueue. If fullcallback or emptycallback are supplied, then the GstDataQueue will call the respective callback to signal full or empty condition. If the callbacks are NULL the GstDataQueue will instead emit 'full' and 'empty' signals.
      Parameters:
      checkfull - the callback used to tell if the element considers the queue full or not.
      fullcallback - the callback which will be called when the queue is considered full.
      emptycallback - the callback which will be called when the queue is considered empty.
      Since:
      1.2
    • DataQueue

      public DataQueue()
      Create a new DataQueue.
  • Method Details

    • getType

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

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

      protected DataQueue asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class GObject
      Returns:
      the instance as if it were its parent type
    • dropHead

      public boolean dropHead(Type type)
      Pop and unref the head-most GstMiniObject with the given GType.
      Parameters:
      type - The GType of the item to drop.
      Returns:
      true if an element was removed.
      Since:
      1.2
    • flush

      public void flush()
      Flushes all the contents of the queue. Any call to gst_data_queue_push and gst_data_queue_pop will be released. MT safe.
      Since:
      1.2
    • getLevel

      public void getLevel(DataQueueSize level)
      Get the current level of the queue.
      Parameters:
      level - the location to store the result
      Since:
      1.2
    • isEmpty

      public boolean isEmpty()
      Queries if there are any items in the queue. MT safe.
      Returns:
      true if this DataQueue is empty.
      Since:
      1.2
    • isFull

      public boolean isFull()
      Queries if this DataQueue is full. This check will be done using the GstDataQueueCheckFullFunction registered with queue. MT safe.
      Returns:
      true if this DataQueue is full.
      Since:
      1.2
    • limitsChanged

      public void limitsChanged()
      Inform the queue that the limits for the fullness check have changed and that any blocking gst_data_queue_push() should be unblocked to recheck the limits.
      Since:
      1.2
    • peek

      public boolean peek(Out<DataQueueItem> item)
      Retrieves the first item available on the this DataQueue without removing it. If the queue is currently empty, the call will block until at least one item is available, OR the this DataQueue is set to the flushing state. MT safe.
      Parameters:
      item - pointer to store the returned GstDataQueueItem.
      Returns:
      true if an item was successfully retrieved from the queue.
      Since:
      1.2
    • pop

      public boolean pop(Out<DataQueueItem> item)
      Retrieves the first item available on the queue. If the queue is currently empty, the call will block until at least one item is available, OR the this DataQueue is set to the flushing state. MT safe.
      Parameters:
      item - pointer to store the returned GstDataQueueItem.
      Returns:
      true if an item was successfully retrieved from the queue.
      Since:
      1.2
    • push

      public boolean push(DataQueueItem item)

      Pushes a GstDataQueueItem (or a structure that begins with the same fields) on the queue. If the this DataQueue is full, the call will block until space is available, OR the this DataQueue is set to flushing state. MT safe.

      Note that this function has slightly different semantics than gst_pad_push() and gst_pad_push_event(): this function only takes ownership of item and the GstMiniObject contained in item if the push was successful. If false is returned, the caller is responsible for freeing item and its contents.

      Parameters:
      item - a GstDataQueueItem.
      Returns:
      true if the item was successfully pushed on the queue.
      Since:
      1.2
    • pushForce

      public boolean pushForce(DataQueueItem item)

      Pushes a GstDataQueueItem (or a structure that begins with the same fields) on the queue. It ignores if the this DataQueue is full or not and forces the item to be pushed anyway. MT safe.

      Note that this function has slightly different semantics than gst_pad_push() and gst_pad_push_event(): this function only takes ownership of item and the GstMiniObject contained in item if the push was successful. If false is returned, the caller is responsible for freeing item and its contents.

      Parameters:
      item - a GstDataQueueItem.
      Returns:
      true if the item was successfully pushed on the queue.
      Since:
      1.2
    • setFlushing

      public void setFlushing(boolean flushing)

      Sets the queue to flushing state if flushing is true. If set to flushing state, any incoming data on the this DataQueue will be discarded. Any call currently blocking on gst_data_queue_push or gst_data_queue_pop will return straight away with a return value of false. While the this DataQueue is in flushing state, all calls to those two functions will return false.

      MT Safe.

      Parameters:
      flushing - a gboolean stating if the queue will be flushing or not.
      Since:
      1.2
    • empty

      protected void empty()
    • full

      protected void full()
    • onEmpty

      Reports that the queue became empty (empty). A queue is empty if the total amount of visible items inside it (num-visible, time, size) is lower than the boundary values which can be set through the GObject properties.
      Parameters:
      handler - the signal handler
      Returns:
      a signal handler ID to keep track of the signal connection
      See Also:
    • emitEmpty

      public void emitEmpty()
      Emits the "empty" signal. See onEmpty(DataQueue.EmptyCallback).
    • onFull

      Reports that the queue became full (full). A queue is full if the total amount of data inside it (num-visible, time, size) is higher than the boundary values which can be set through the GObject properties.
      Parameters:
      handler - the signal handler
      Returns:
      a signal handler ID to keep track of the signal connection
      See Also:
    • emitFull

      public void emitFull()
      Emits the "full" signal. See onFull(DataQueue.FullCallback).
    • builder

      public static DataQueue.Builder<? extends DataQueue.Builder> builder()
      A DataQueue.Builder object constructs a DataQueue with the specified properties. Use the various set...() methods to set properties, and finish construction with DataQueue.Builder.build().
      Returns:
      the builder object