Package org.freedesktop.gstreamer.base
Class DataQueue
java.lang.Object
org.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
Nested ClassesModifier and TypeClassDescriptionstatic classDataQueue.Builder<B extends DataQueue.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static classstatic interfaceFunctional interface declaration of theEmptyCallbackcallback.static interfaceFunctional interface declaration of theFullCallbackcallback.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new DataQueue.DataQueue(MemorySegment address) Create a DataQueue proxy instance for the provided memory address.DataQueue(@Nullable DataQueueCheckFullFunction checkfull, @Nullable DataQueueFullCallback fullcallback, @Nullable DataQueueEmptyCallback emptycallback) Creates a newGstDataQueue. -
Method Summary
Modifier and TypeMethodDescriptionprotected DataQueueasParent()Returns this instance as if it were its parent type.static DataQueue.Builder<? extends DataQueue.Builder> builder()ADataQueue.Builderobject constructs aDataQueuewith the specified properties.booleanPop and unref the head-mostGstMiniObjectwith the givenGType.voidEmits the "empty" signal.voidemitFull()Emits the "full" signal.protected voidempty()voidflush()Flushes all the contents of thequeue.Any call togst_data_queue_pushandgst_data_queue_popwill be released.protected voidfull()voidgetLevel(DataQueueSize level) Get the current level of the queue.static MemoryLayoutThe memory layout of the native struct.static @Nullable TypegetType()Get the GType of the DataQueue classbooleanisEmpty()Queries if there are any items in thequeue.MT safe.booleanisFull()Queries if this DataQueue is full.voidInform 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).booleanpeek(Out<DataQueueItem> item) Retrieves the firstitemavailable on the this DataQueue without removing it.booleanpop(Out<DataQueueItem> item) Retrieves the firstitemavailable on thequeue.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.booleanpush(DataQueueItem item) Pushes aGstDataQueueItem(or a structure that begins with the same fields) on thequeue.If the this DataQueue is full, the call will block until space is available, OR the this DataQueue is set to flushing state.booleanpushForce(DataQueueItem item) Pushes aGstDataQueueItem(or a structure that begins with the same fields) on thequeue.It ignores if the this DataQueue is full or not and forces theitemto be pushed anyway.voidsetFlushing(boolean flushing) Sets the queue to flushing state ifflushingistrue.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, 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, withPropertiesMethods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.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(@Nullable DataQueueCheckFullFunction checkfull, @Nullable DataQueueFullCallback fullcallback, @Nullable DataQueueEmptyCallback emptycallback) Creates a newGstDataQueue. Iffullcallbackoremptycallbackare supplied, then theGstDataQueuewill call the respective callback to signal full or empty condition. If the callbacks are NULL theGstDataQueuewill 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()Creates a new DataQueue.
-
-
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 Javasuperkeyword, 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-mostGstMiniObjectwith the givenGType.- Parameters:
type- TheGTypeof the item to drop.- Returns:
trueif an element was removed.- Since:
- 1.2
-
flush
public void flush()Flushes all the contents of thequeue.Any call togst_data_queue_pushandgst_data_queue_popwill be released. MT safe.- Since:
- 1.2
-
getLevel
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 thequeue.MT safe.- Returns:
trueif this DataQueue is empty.- Since:
- 1.2
-
isFull
public boolean isFull()Queries if this DataQueue is full. This check will be done using theGstDataQueueCheckFullFunctionregistered withqueue.MT safe.- Returns:
trueif 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
Retrieves the firstitemavailable 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:
trueif anitemwas successfully retrieved from thequeue.- Since:
- 1.2
-
pop
Retrieves the firstitemavailable on thequeue.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:
trueif anitemwas successfully retrieved from thequeue.- Since:
- 1.2
-
push
Pushes aGstDataQueueItem(or a structure that begins with the same fields) on thequeue.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
itemand theGstMiniObjectcontained initemif the push was successful. Iffalseis returned, the caller is responsible for freeingitemand its contents.- Parameters:
item- aGstDataQueueItem.- Returns:
trueif theitemwas successfully pushed on thequeue.- Since:
- 1.2
-
pushForce
Pushes aGstDataQueueItem(or a structure that begins with the same fields) on thequeue.It ignores if the this DataQueue is full or not and forces theitemto 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
itemand theGstMiniObjectcontained initemif the push was successful. Iffalseis returned, the caller is responsible for freeingitemand its contents.- Parameters:
item- aGstDataQueueItem.- Returns:
trueif theitemwas successfully pushed on thequeue.- Since:
- 1.2
-
setFlushing
public void setFlushing(boolean flushing) Sets the queue to flushing state ifflushingistrue. If set to flushing state, any incoming data on the this DataQueue will be discarded. Any call currently blocking ongst_data_queue_pushorgst_data_queue_popwill 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- agbooleanstating 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. 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.Builderobject constructs aDataQueuewith the specified properties. Use the variousset...()methods to set properties, and finish construction withDataQueue.Builder.build().- Returns:
- the builder object
-