Class FlowCombiner
- All Implemented Interfaces:
Proxy
GstFlowReturn
combination. Useful for
GstElement
<!-- -->s that have multiple source pads and need to combine
the different GstFlowReturn
for those pads.
GstFlowCombiner
works by using the last GstFlowReturn
for all GstPad
it has in its list and computes the combined return value and provides
it to the caller.
To add a new pad to the GstFlowCombiner
use gst_flow_combiner_add_pad().
The new GstPad
is stored with a default value of FlowReturn.OK
.
In case you want a GstPad
to be removed, use gst_flow_combiner_remove_pad().
Please be aware that this struct isn't thread safe as its designed to be used by demuxers, those usually will have a single thread operating it.
These functions will take refs on the passed GstPad
<!-- -->s.
Aside from reducing the user's code size, the main advantage of using this
helper struct is to follow the standard rules for GstFlowReturn
combination.
These rules are:
FlowReturn.EOS
: only if all returns are EOS tooFlowReturn.NOT_LINKED
: only if all returns are NOT_LINKED tooFlowReturn.ERROR
or below: if at least one returns an error returnFlowReturn.NOT_NEGOTIATED
: if at least one returns a not-negotiated returnFlowReturn.FLUSHING
: if at least one returns flushingFlowReturn.OK
: otherwise
FlowReturn.ERROR
or below, GST_FLOW_NOT_NEGOTIATED and GST_FLOW_FLUSHING are
returned immediately from the gst_flow_combiner_update_flow() function.
-
Constructor Summary
ConstructorDescriptionCreates a newGstFlowCombiner
, use gst_flow_combiner_free() to free it.FlowCombiner
(MemorySegment address) Create a FlowCombiner proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a newGstPad
to theGstFlowCombiner
.void
clear()
Removes all pads from aGstFlowCombiner
and resets it to its initial state.void
free()
Frees aGstFlowCombiner
struct and all its internal data.static Type
getType()
Get the GType of the FlowCombiner classref()
Increments the reference count on theGstFlowCombiner
.void
Removes aGstPad
from theGstFlowCombiner
.void
reset()
Reset flow combiner and all pads to their initial state without removing pads.void
unref()
Decrements the reference count on theGstFlowCombiner
.updateFlow
(FlowReturn fret) Computes the combined flow return for the pads in it.updatePadFlow
(Pad pad, FlowReturn fret) Sets the provided pad's last flow return to provided value and computes the combined flow return for the pads in it.Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
FlowCombiner
Create a FlowCombiner proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
FlowCombiner
public FlowCombiner()Creates a newGstFlowCombiner
, use gst_flow_combiner_free() to free it.
-
-
Method Details
-
getType
-
addPad
Adds a newGstPad
to theGstFlowCombiner
.- Parameters:
pad
- theGstPad
that is being added
-
clear
public void clear()Removes all pads from aGstFlowCombiner
and resets it to its initial state. -
free
public void free()Frees aGstFlowCombiner
struct and all its internal data. -
ref
Increments the reference count on theGstFlowCombiner
.- Returns:
- the
GstFlowCombiner
.
-
removePad
Removes aGstPad
from theGstFlowCombiner
.- Parameters:
pad
- theGstPad
to remove
-
reset
public void reset()Reset flow combiner and all pads to their initial state without removing pads. -
unref
public void unref()Decrements the reference count on theGstFlowCombiner
. -
updateFlow
Computes the combined flow return for the pads in it.The
GstFlowReturn
parameter should be the last flow return update for a pad in thisGstFlowCombiner
. It will use this value to be able to shortcut some combinations and avoid looking over all pads again. e.g. The last combined return is the same as the latest obtainedGstFlowReturn
.- Parameters:
fret
- the latestGstFlowReturn
received for a pad in thisGstFlowCombiner
- Returns:
- The combined
GstFlowReturn
-
updatePadFlow
Sets the provided pad's last flow return to provided value and computes the combined flow return for the pads in it.The
GstFlowReturn
parameter should be the last flow return update for a pad in thisGstFlowCombiner
. It will use this value to be able to shortcut some combinations and avoid looking over all pads again. e.g. The last combined return is the same as the latest obtainedGstFlowReturn
.- Parameters:
pad
- theGstPad
whoseGstFlowReturn
to updatefret
- the latestGstFlowReturn
received for a pad in thisGstFlowCombiner
- Returns:
- The combined
GstFlowReturn
-