Package org.freedesktop.gstreamer.base
Class DataQueue
java.lang.Object
io.github.jwharm.javagi.base.ProxyInstance
org.gnome.gobject.TypeInstance
org.gnome.gobject.GObject
org.freedesktop.gstreamer.base.DataQueue
- All Implemented Interfaces:
Proxy
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.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
DataQueue.Builder<B extends DataQueue.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static class
static interface
Functional interface declaration of theEmptyCallback
callback.static interface
Functional interface declaration of theFullCallback
callback.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionDataQueue
(MemorySegment address) Create a DataQueue proxy instance for the provided memory address.DataQueue
(DataQueueCheckFullFunction checkfull, DataQueueFullCallback fullcallback, DataQueueEmptyCallback emptycallback) Creates a newGstDataQueue
. -
Method Summary
Modifier and TypeMethodDescriptionprotected DataQueue
asParent()
Returns this instance as if it were its parent type.static DataQueue.Builder
<? extends DataQueue.Builder> builder()
ADataQueue.Builder
object constructs aDataQueue
with the specified properties.boolean
Pop and unref the head-mostGstMiniObject
with the givenGType
.void
Emits the "empty" signal.void
emitFull()
Emits the "full" signal.protected void
empty()
void
flush()
Flushes all the contents of the this DataQueue.protected void
full()
void
getLevel
(DataQueueSize level) Get the current level of the queue.static MemoryLayout
The memory layout of the native struct.static Type
getType()
Get the GType of the DataQueue classboolean
isEmpty()
Queries if there are any items in the this DataQueue.boolean
isFull()
Queries if this DataQueue is full.void
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.onEmpty
(DataQueue.EmptyCallback handler) Reports that the queue became empty (empty).onFull
(DataQueue.FullCallback handler) Reports that the queue became full (full).boolean
peek
(Out<DataQueueItem> item) Retrieves the firstitem
available on the this DataQueue without removing it.boolean
pop
(Out<DataQueueItem> item) Retrieves the firstitem
available on the this DataQueue.boolean
push
(DataQueueItem item) Pushes aGstDataQueueItem
(or a structure that begins with the same fields) on the this DataQueue.boolean
pushForce
(DataQueueItem item) Pushes aGstDataQueueItem
(or a structure that begins with the same fields) on the this DataQueue.void
setFlushing
(boolean flushing) Sets the queue to flushing state ifflushing
istrue
.Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newInstance, newInstance, newv, notify_, notify_, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
DataQueue
Create a DataQueue proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
DataQueue
public DataQueue(DataQueueCheckFullFunction checkfull, DataQueueFullCallback fullcallback, DataQueueEmptyCallback emptycallback) Creates a newGstDataQueue
. Iffullcallback
oremptycallback
are supplied, then theGstDataQueue
will call the respective callback to signal full or empty condition. If the callbacks are NULL theGstDataQueue
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.
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuper
keyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()
doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName()
. This will call the native function pointer of this virtual method in the typeclass of the parent type. -
dropHead
Pop and unref the head-mostGstMiniObject
with the givenGType
.- Parameters:
type
- TheGType
of the item to drop.- Returns:
true
if an element was removed.
-
flush
public void flush()Flushes all the contents of the this DataQueue. Any call togst_data_queue_push
andgst_data_queue_pop
will be released. MT safe. -
getLevel
Get the current level of the queue.- Parameters:
level
- the location to store the result
-
isEmpty
public boolean isEmpty()Queries if there are any items in the this DataQueue. MT safe.- Returns:
true
if this DataQueue is empty.
-
isFull
public boolean isFull()Queries if this DataQueue is full. This check will be done using theGstDataQueueCheckFullFunction
registered with this DataQueue. MT safe.- Returns:
true
if this DataQueue is full.
-
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. -
peek
Retrieves the firstitem
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 returnedGstDataQueueItem
.- Returns:
true
if anitem
was successfully retrieved from the this DataQueue.
-
pop
Retrieves the firstitem
available on the this DataQueue. 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 returnedGstDataQueueItem
.- Returns:
true
if anitem
was successfully retrieved from the this DataQueue.
-
push
Pushes aGstDataQueueItem
(or a structure that begins with the same fields) on the this DataQueue. 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 theGstMiniObject
contained initem
if the push was successful. Iffalse
is returned, the caller is responsible for freeingitem
and its contents.- Parameters:
item
- aGstDataQueueItem
.- Returns:
true
if theitem
was successfully pushed on the this DataQueue.
-
pushForce
Pushes aGstDataQueueItem
(or a structure that begins with the same fields) on the this DataQueue. It ignores if the this DataQueue is full or not and forces theitem
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 theGstMiniObject
contained initem
if the push was successful. Iffalse
is returned, the caller is responsible for freeingitem
and its contents.- Parameters:
item
- aGstDataQueueItem
.- Returns:
true
if theitem
was successfully pushed on the this DataQueue.
-
setFlushing
public void setFlushing(boolean flushing) Sets the queue to flushing state ifflushing
istrue
. If set to flushing state, any incoming data on the this DataQueue will be discarded. Any call currently blocking ongst_data_queue_push
orgst_data_queue_pop
will return straight away with a return value offalse
. While the this DataQueue is in flushing state, all calls to those two functions will returnfalse
.MT Safe.
- Parameters:
flushing
- agboolean
stating if the queue will be flushing or not.
-
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. SeeonEmpty(org.freedesktop.gstreamer.base.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. SeeonFull(org.freedesktop.gstreamer.base.DataQueue.FullCallback)
. -
builder
ADataQueue.Builder
object constructs aDataQueue
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withDataQueue.Builder.build()
.
-