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.ERRORor 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.
- Since:
- 1.4
-
Constructor Summary
ConstructorsConstructorDescriptionCreates 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 TypeMethodDescriptionvoidAdds a newGstPadto theGstFlowCombiner.voidclear()Removes all pads from aGstFlowCombinerand resets it to its initial state.voidfree()Frees aGstFlowCombinerstruct and all its internal data.static @Nullable TypegetType()Get the GType of the FlowCombiner classref()Increments the reference count on theGstFlowCombiner.voidRemoves aGstPadfrom theGstFlowCombiner.voidreset()Reset flow combiner and all pads to their initial state without removing pads.voidunref()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 org.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.- Since:
- 1.4
-
-
Method Details
-
getType
-
addPad
Adds a newGstPadto theGstFlowCombiner.- Parameters:
pad- theGstPadthat is being added- Since:
- 1.4
-
clear
public void clear()Removes all pads from aGstFlowCombinerand resets it to its initial state.- Since:
- 1.6
-
free
public void free()Frees aGstFlowCombinerstruct and all its internal data.- Since:
- 1.4
-
ref
Increments the reference count on theGstFlowCombiner.- Returns:
- the
GstFlowCombiner. - Since:
- 1.12.1
-
removePad
Removes aGstPadfrom theGstFlowCombiner.- Parameters:
pad- theGstPadto remove- Since:
- 1.4
-
reset
public void reset()Reset flow combiner and all pads to their initial state without removing pads.- Since:
- 1.6
-
unref
public void unref()Decrements the reference count on theGstFlowCombiner.- Since:
- 1.12.1
-
updateFlow
Computes the combined flow return for the pads in it.The
GstFlowReturnparameter 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 latestGstFlowReturnreceived for a pad in thisGstFlowCombiner- Returns:
- The combined
GstFlowReturn - Since:
- 1.4
-
updatePadFlow
Sets the provided pad's last flow return to provided value and computes the combined flow return for the pads in it.The
GstFlowReturnparameter 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- theGstPadwhoseGstFlowReturnto updatefret- the latestGstFlowReturnreceived for a pad in thisGstFlowCombiner- Returns:
- The combined
GstFlowReturn - Since:
- 1.6
-