Copyright | Will Thompson, Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
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 immediatelly from the flowCombinerUpdateFlow
function.
- newtype FlowCombiner = FlowCombiner (ManagedPtr FlowCombiner)
- noFlowCombiner :: Maybe FlowCombiner
- data FlowCombinerAddPadMethodInfo
- flowCombinerAddPad :: (HasCallStack, MonadIO m, IsPad a) => FlowCombiner -> a -> m ()
- data FlowCombinerClearMethodInfo
- flowCombinerClear :: (HasCallStack, MonadIO m) => FlowCombiner -> m ()
- data FlowCombinerFreeMethodInfo
- flowCombinerFree :: (HasCallStack, MonadIO m) => FlowCombiner -> m ()
- flowCombinerNew :: (HasCallStack, MonadIO m) => m FlowCombiner
- data FlowCombinerRemovePadMethodInfo
- flowCombinerRemovePad :: (HasCallStack, MonadIO m, IsPad a) => FlowCombiner -> a -> m ()
- data FlowCombinerResetMethodInfo
- flowCombinerReset :: (HasCallStack, MonadIO m) => FlowCombiner -> m ()
- data FlowCombinerUpdateFlowMethodInfo
- flowCombinerUpdateFlow :: (HasCallStack, MonadIO m) => FlowCombiner -> FlowReturn -> m FlowReturn
- data FlowCombinerUpdatePadFlowMethodInfo
- flowCombinerUpdatePadFlow :: (HasCallStack, MonadIO m, IsPad a) => FlowCombiner -> a -> FlowReturn -> m FlowReturn
Exported types
newtype FlowCombiner Source #
Methods
addPad
data FlowCombinerAddPadMethodInfo Source #
((~) * signature (a -> m ()), MonadIO m, IsPad a) => MethodInfo * FlowCombinerAddPadMethodInfo FlowCombiner signature Source # | |
:: (HasCallStack, MonadIO m, IsPad a) | |
=> FlowCombiner |
|
-> a |
|
-> m () |
Adds a new Pad
to the FlowCombiner
.
Since: 1.4
clear
data FlowCombinerClearMethodInfo Source #
((~) * signature (m ()), MonadIO m) => MethodInfo * FlowCombinerClearMethodInfo FlowCombiner signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> FlowCombiner |
|
-> m () |
Removes all pads from a FlowCombiner
and resets it to its initial state.
Since: 1.6
free
data FlowCombinerFreeMethodInfo Source #
((~) * signature (m ()), MonadIO m) => MethodInfo * FlowCombinerFreeMethodInfo FlowCombiner signature Source # | |
:: (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
removePad
data FlowCombinerRemovePadMethodInfo Source #
((~) * signature (a -> m ()), MonadIO m, IsPad a) => MethodInfo * FlowCombinerRemovePadMethodInfo FlowCombiner signature Source # | |
flowCombinerRemovePad Source #
:: (HasCallStack, MonadIO m, IsPad a) | |
=> FlowCombiner |
|
-> a |
|
-> m () |
Removes a Pad
from the FlowCombiner
.
Since: 1.4
reset
data FlowCombinerResetMethodInfo Source #
((~) * signature (m ()), MonadIO m) => MethodInfo * FlowCombinerResetMethodInfo FlowCombiner signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> FlowCombiner |
|
-> m () |
Reset flow combiner and all pads to their initial state without removing pads.
Since: 1.6
updateFlow
data FlowCombinerUpdateFlowMethodInfo Source #
((~) * signature (FlowReturn -> m FlowReturn), MonadIO m) => MethodInfo * FlowCombinerUpdateFlowMethodInfo FlowCombiner signature Source # | |
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
data FlowCombinerUpdatePadFlowMethodInfo Source #
((~) * signature (a -> FlowReturn -> m FlowReturn), MonadIO m, IsPad a) => MethodInfo * FlowCombinerUpdatePadFlowMethodInfo FlowCombiner signature Source # | |
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