Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (inaki@blueleaf.cc) |
Safe Haskell | None |
Language | Haskell2010 |
Utility struct to help handling FlowReturn
combination. Useful for
Element
<!-- -->s that have multiple source pads and need to combine
the different 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 flowCombinerAddPad
.
The new Pad
is stored with a default value of FlowReturnOk
.
In case you want a Pad
to be removed, use flowCombinerRemovePad
.
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 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:
FlowReturnEos
: only if all returns are EOS tooFlowReturnNotLinked
: only if all returns are NOT_LINKED tooFlowReturnError
or below: if at least one returns an error returnFlowReturnNotNegotiated
: if at least one returns a not-negotiated returnFlowReturnFlushing
: if at least one returns flushingFlowReturnOk
: otherwise
FlowReturnError
or below, GST_FLOW_NOT_NEGOTIATED and GST_FLOW_FLUSHING are
returned immediately from the flowCombinerUpdateFlow
function.
Since: 1.4
Synopsis
- newtype FlowCombiner = FlowCombiner (ManagedPtr FlowCombiner)
- noFlowCombiner :: Maybe FlowCombiner
- flowCombinerAddPad :: (HasCallStack, MonadIO m, IsPad a) => FlowCombiner -> a -> m ()
- flowCombinerClear :: (HasCallStack, MonadIO m) => FlowCombiner -> m ()
- flowCombinerFree :: (HasCallStack, MonadIO m) => FlowCombiner -> m ()
- flowCombinerNew :: (HasCallStack, MonadIO m) => m FlowCombiner
- flowCombinerRef :: (HasCallStack, MonadIO m) => FlowCombiner -> m FlowCombiner
- flowCombinerRemovePad :: (HasCallStack, MonadIO m, IsPad a) => FlowCombiner -> a -> m ()
- flowCombinerReset :: (HasCallStack, MonadIO m) => FlowCombiner -> m ()
- flowCombinerUnref :: (HasCallStack, MonadIO m) => FlowCombiner -> m ()
- flowCombinerUpdateFlow :: (HasCallStack, MonadIO m) => FlowCombiner -> FlowReturn -> m FlowReturn
- flowCombinerUpdatePadFlow :: (HasCallStack, MonadIO m, IsPad a) => FlowCombiner -> a -> FlowReturn -> m FlowReturn
Exported types
newtype FlowCombiner Source #
Memory-managed wrapper type.
Instances
BoxedObject FlowCombiner Source # | |
Defined in GI.GstBase.Structs.FlowCombiner boxedType :: FlowCombiner -> IO GType # |
noFlowCombiner :: Maybe FlowCombiner Source #
A convenience alias for Nothing
:: Maybe
FlowCombiner
.
Methods
addPad
:: (HasCallStack, MonadIO m, IsPad a) | |
=> FlowCombiner |
|
-> a |
|
-> m () |
Adds a new Pad
to the FlowCombiner
.
Since: 1.4
clear
:: (HasCallStack, MonadIO m) | |
=> FlowCombiner |
|
-> m () |
Removes all pads from a FlowCombiner
and resets it to its initial state.
Since: 1.6
free
:: (HasCallStack, MonadIO m) | |
=> FlowCombiner |
|
-> m () |
Frees a FlowCombiner
struct and all its internal data.
Since: 1.4
new
:: (HasCallStack, MonadIO m) | |
=> m FlowCombiner | Returns: A new |
Creates a new FlowCombiner
, use flowCombinerFree
to free it.
Since: 1.4
ref
:: (HasCallStack, MonadIO m) | |
=> FlowCombiner |
|
-> m FlowCombiner | Returns: the |
Increments the reference count on the FlowCombiner
.
Since: 1.12.1
removePad
flowCombinerRemovePad Source #
:: (HasCallStack, MonadIO m, IsPad a) | |
=> FlowCombiner |
|
-> a |
|
-> m () |
Removes a Pad
from the FlowCombiner
.
Since: 1.4
reset
:: (HasCallStack, MonadIO m) | |
=> FlowCombiner |
|
-> m () |
Reset flow combiner and all pads to their initial state without removing pads.
Since: 1.6
unref
:: (HasCallStack, MonadIO m) | |
=> FlowCombiner |
|
-> m () |
Decrements the reference count on the FlowCombiner
.
Since: 1.12.1
updateFlow
flowCombinerUpdateFlow Source #
:: (HasCallStack, MonadIO m) | |
=> FlowCombiner |
|
-> FlowReturn |
|
-> m FlowReturn | Returns: The combined |
Computes the combined flow return for the pads in it.
The FlowReturn
parameter should be the last flow return update for a pad
in this FlowCombiner
. 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 obtained FlowReturn
.
Since: 1.4
updatePadFlow
flowCombinerUpdatePadFlow Source #
:: (HasCallStack, MonadIO m, IsPad a) | |
=> FlowCombiner |
|
-> a |
|
-> FlowReturn |
|
-> m FlowReturn | Returns: The combined |
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 this FlowCombiner
. 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 obtained FlowReturn
.
Since: 1.6