FlowCombiner
Added in version 1.4.
- class FlowCombiner(**kwargs)
Utility struct to help handling FlowReturn
combination. Useful for
FlowReturn
for those pads.
FlowCombiner
works by using the last FlowReturn
for all Pad
it has in its list and computes the combined return value and provides
it to the caller.
To add a new pad to the FlowCombiner
use add_pad()
.
The new Pad
is stored with a default value of %GST_FLOW_OK
.
In case you want a Pad
to be removed, use 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 :obj:`~gi.repository.Gst.Pad`<!– –>s.
Aside from reducing the user’s code size, the main advantage of using this
helper struct is to follow the standard rules for FlowReturn
combination.
These rules are:
%GST_FLOW_EOS
: only if all returns are EOS too%GST_FLOW_NOT_LINKED
: only if all returns are NOT_LINKED too%GST_FLOW_ERROR
or below: if at least one returns an error return%GST_FLOW_NOT_NEGOTIATED
: if at least one returns a not-negotiated return%GST_FLOW_FLUSHING
: if at least one returns flushing%GST_FLOW_OK
: otherwise
%GST_FLOW_ERROR
or below, GST_FLOW_NOT_NEGOTIATED and GST_FLOW_FLUSHING are
returned immediately from the update_flow()
function.
Constructors
- class FlowCombiner
- classmethod new() FlowCombiner
Creates a new
FlowCombiner
, usefree()
to free it.Added in version 1.4.
Methods
- class FlowCombiner
- add_pad(pad: Pad) None
Adds a new
Pad
to theFlowCombiner
.Added in version 1.4.
- Parameters:
pad – the
Pad
that is being added
- clear() None
Removes all pads from a
FlowCombiner
and resets it to its initial state.Added in version 1.6.
- free() None
Frees a
FlowCombiner
struct and all its internal data.Added in version 1.4.
- remove_pad(pad: Pad) None
Removes a
Pad
from theFlowCombiner
.Added in version 1.4.
- Parameters:
pad – the
Pad
to remove
- reset() None
Reset flow combiner and all pads to their initial state without removing pads.
Added in version 1.6.
- update_flow(fret: FlowReturn) FlowReturn
Computes the combined flow return for the pads in it.
The
FlowReturn
parameter should be the last flow return update for a pad in thisFlowCombiner
. 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 obtainedFlowReturn
.Added in version 1.4.
- Parameters:
fret – the latest
FlowReturn
received for a pad in thisFlowCombiner
- update_pad_flow(pad: Pad, fret: FlowReturn) FlowReturn
Sets the provided pad’s last flow return to provided value and computes the combined flow return for the pads in it.
The
FlowReturn
parameter should be the last flow return update for a pad in thisFlowCombiner
. 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 obtainedFlowReturn
.Added in version 1.6.
- Parameters:
pad – the
Pad
whoseFlowReturn
to updatefret – the latest
FlowReturn
received for a pad in thisFlowCombiner