Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Manages a set of pads with the purpose of aggregating their buffers. Control is given to the subclass when all pads have data.
- Base class for mixers and muxers. Subclasses should at least implement
the
AggregatorClass
::aggregate
virtual method. - Installs a
PadChainFunction
, aPadEventFullFunction
and aPadQueryFunction
to queue all serialized data packets per sink pad. Subclasses should not overwrite those, but instead implementAggregatorClass
::sink_event
andAggregatorClass
::sink_query
as needed. - When data is queued on all pads, the aggregate vmethod is called.
- One can peek at the data on any given GstAggregatorPad with the
aggregatorPadPeekBuffer
method, and remove it from the pad with the gst_aggregator_pad_pop_buffer () method. When a buffer has been taken with pop_buffer (), a new buffer can be queued on that pad. - When
aggregatorPadPeekBuffer
oraggregatorPadHasBuffer
are called, a reference is taken to the returned buffer, which stays valid until either: aggregatorPadPopBuffer
is called, in which case the caller is guaranteed that the buffer they receive is the same as the peeked buffer.aggregatorPadDropBuffer
is called, in which case the caller is guaranteed that the dropped buffer is the one that was peeked.- the subclass implementation of
AggregatorClass
.aggregate
returns.
Subsequent calls to aggregatorPadPeekBuffer
or
aggregatorPadHasBuffer
return / check the same buffer that was
returned / checked, until one of the conditions listed above is met.
Subclasses are only allowed to call these methods from the aggregate thread.
- If the subclass wishes to push a buffer downstream in its aggregate
implementation, it should do so through the
aggregatorFinishBuffer
method. This method will take care of sending and ordering mandatory events such as stream start, caps and segment. Buffer lists can also be pushed out withaggregatorFinishBufferList
. - Same goes for EOS events, which should not be pushed directly by the subclass, it should instead return GST_FLOW_EOS in its aggregate implementation.
- Note that the aggregator logic regarding gap event handling is to turn these into gap buffers with matching PTS and duration. It will also flag these buffers with GST_BUFFER_FLAG_GAP and GST_BUFFER_FLAG_DROPPABLE to ease their identification and subsequent processing.
- Subclasses must use (a subclass of)
AggregatorPad
for both their sink and source pads. SeeelementClassAddStaticPadTemplateWithGtype
.
This class used to live in gst-plugins-bad and was moved to core.
Since: 1.14
Synopsis
- newtype Aggregator = Aggregator (ManagedPtr Aggregator)
- class (GObject o, IsDescendantOf Aggregator o) => IsAggregator o
- toAggregator :: (MonadIO m, IsAggregator o) => o -> m Aggregator
- aggregatorFinishBuffer :: (HasCallStack, MonadIO m, IsAggregator a) => a -> Buffer -> m FlowReturn
- aggregatorFinishBufferList :: (HasCallStack, MonadIO m, IsAggregator a) => a -> BufferList -> m FlowReturn
- aggregatorGetAllocator :: (HasCallStack, MonadIO m, IsAggregator a) => a -> m (Maybe Allocator, AllocationParams)
- aggregatorGetBufferPool :: (HasCallStack, MonadIO m, IsAggregator a) => a -> m (Maybe BufferPool)
- aggregatorGetLatency :: (HasCallStack, MonadIO m, IsAggregator a) => a -> m Word64
- aggregatorNegotiate :: (HasCallStack, MonadIO m, IsAggregator a) => a -> m Bool
- aggregatorPeekNextSample :: (HasCallStack, MonadIO m, IsAggregator a, IsAggregatorPad b) => a -> b -> m (Maybe Sample)
- aggregatorSelectedSamples :: (HasCallStack, MonadIO m, IsAggregator a) => a -> Word64 -> Word64 -> Word64 -> Maybe Structure -> m ()
- aggregatorSetLatency :: (HasCallStack, MonadIO m, IsAggregator a) => a -> Word64 -> Word64 -> m ()
- aggregatorSetSrcCaps :: (HasCallStack, MonadIO m, IsAggregator a) => a -> Caps -> m ()
- aggregatorSimpleGetNextTime :: (HasCallStack, MonadIO m, IsAggregator a) => a -> m Word64
- aggregatorUpdateSegment :: (HasCallStack, MonadIO m, IsAggregator a) => a -> Segment -> m ()
- constructAggregatorEmitSignals :: (IsAggregator o, MonadIO m) => Bool -> m (GValueConstruct o)
- getAggregatorEmitSignals :: (MonadIO m, IsAggregator o) => o -> m Bool
- setAggregatorEmitSignals :: (MonadIO m, IsAggregator o) => o -> Bool -> m ()
- constructAggregatorLatency :: (IsAggregator o, MonadIO m) => Word64 -> m (GValueConstruct o)
- getAggregatorLatency :: (MonadIO m, IsAggregator o) => o -> m Word64
- setAggregatorLatency :: (MonadIO m, IsAggregator o) => o -> Word64 -> m ()
- constructAggregatorMinUpstreamLatency :: (IsAggregator o, MonadIO m) => Word64 -> m (GValueConstruct o)
- getAggregatorMinUpstreamLatency :: (MonadIO m, IsAggregator o) => o -> m Word64
- setAggregatorMinUpstreamLatency :: (MonadIO m, IsAggregator o) => o -> Word64 -> m ()
- constructAggregatorStartTime :: (IsAggregator o, MonadIO m) => Word64 -> m (GValueConstruct o)
- getAggregatorStartTime :: (MonadIO m, IsAggregator o) => o -> m Word64
- setAggregatorStartTime :: (MonadIO m, IsAggregator o) => o -> Word64 -> m ()
- constructAggregatorStartTimeSelection :: (IsAggregator o, MonadIO m) => AggregatorStartTimeSelection -> m (GValueConstruct o)
- getAggregatorStartTimeSelection :: (MonadIO m, IsAggregator o) => o -> m AggregatorStartTimeSelection
- setAggregatorStartTimeSelection :: (MonadIO m, IsAggregator o) => o -> AggregatorStartTimeSelection -> m ()
- type AggregatorSamplesSelectedCallback = Segment -> Word64 -> Word64 -> Word64 -> Maybe Structure -> IO ()
- afterAggregatorSamplesSelected :: (IsAggregator a, MonadIO m) => a -> ((?self :: a) => AggregatorSamplesSelectedCallback) -> m SignalHandlerId
- onAggregatorSamplesSelected :: (IsAggregator a, MonadIO m) => a -> ((?self :: a) => AggregatorSamplesSelectedCallback) -> m SignalHandlerId
Exported types
newtype Aggregator Source #
Memory-managed wrapper type.
Instances
Eq Aggregator Source # | |
Defined in GI.GstBase.Objects.Aggregator (==) :: Aggregator -> Aggregator -> Bool # (/=) :: Aggregator -> Aggregator -> Bool # | |
GObject Aggregator Source # | |
Defined in GI.GstBase.Objects.Aggregator | |
ManagedPtrNewtype Aggregator Source # | |
Defined in GI.GstBase.Objects.Aggregator | |
TypedObject Aggregator Source # | |
Defined in GI.GstBase.Objects.Aggregator | |
HasParentTypes Aggregator Source # | |
Defined in GI.GstBase.Objects.Aggregator | |
IsGValue (Maybe Aggregator) Source # | Convert |
Defined in GI.GstBase.Objects.Aggregator gvalueGType_ :: IO GType # gvalueSet_ :: Ptr GValue -> Maybe Aggregator -> IO () # gvalueGet_ :: Ptr GValue -> IO (Maybe Aggregator) # | |
type ParentTypes Aggregator Source # | |
Defined in GI.GstBase.Objects.Aggregator |
class (GObject o, IsDescendantOf Aggregator o) => IsAggregator o Source #
Type class for types which can be safely cast to Aggregator
, for instance with toAggregator
.
Instances
(GObject o, IsDescendantOf Aggregator o) => IsAggregator o Source # | |
Defined in GI.GstBase.Objects.Aggregator |
toAggregator :: (MonadIO m, IsAggregator o) => o -> m Aggregator Source #
Cast to Aggregator
, for types for which this is known to be safe. For general casts, use castTo
.
Methods
Click to display all available methods, including inherited ones
Methods
abortState, addControlBinding, addPad, addPropertyDeepNotifyWatch, addPropertyNotifyWatch, bindProperty, bindPropertyFull, callAsync, changeState, continueState, createAllPads, defaultError, finishBuffer, finishBufferList, forceFloating, foreachPad, foreachSinkPad, foreachSrcPad, freezeNotify, getv, hasActiveControlBindings, hasAncestor, hasAsAncestor, hasAsParent, isFloating, isLockedState, iteratePads, iterateSinkPads, iterateSrcPads, link, linkFiltered, linkPads, linkPadsFiltered, linkPadsFull, lostState, messageFull, messageFullWithDetails, negotiate, noMorePads, notify, notifyByPspec, peekNextSample, postMessage, provideClock, query, queryConvert, queryDuration, queryPosition, ref, refSink, releaseRequestPad, removeControlBinding, removePad, removePropertyNotifyWatch, requestPad, requestPadSimple, runDispose, seek, seekSimple, selectedSamples, sendEvent, simpleGetNextTime, stealData, stealQdata, suggestNextSync, syncStateWithParent, syncValues, thawNotify, unlink, unlinkPads, unparent, unref, updateSegment, watchClosure.
Getters
getAllocator, getBaseTime, getBufferPool, getBus, getClock, getCompatiblePad, getCompatiblePadTemplate, getContext, getContextUnlocked, getContexts, getControlBinding, getControlRate, getCurrentClockTime, getCurrentRunningTime, getData, getFactory, getGValueArray, getLatency, getMetadata, getName, getPadTemplate, getPadTemplateList, getParent, getPathString, getProperty, getQdata, getRequestPad, getStartTime, getState, getStaticPad, getValue.
Setters
setBaseTime, setBus, setClock, setContext, setControlBindingDisabled, setControlBindingsDisabled, setControlRate, setData, setDataFull, setLatency, setLockedState, setName, setParent, setProperty, setSrcCaps, setStartTime, setState.
finishBuffer
aggregatorFinishBuffer Source #
:: (HasCallStack, MonadIO m, IsAggregator a) | |
=> a |
|
-> Buffer |
|
-> m FlowReturn |
This method will push the provided output buffer downstream. If needed, mandatory events such as stream-start, caps, and segment events will be sent before pushing the buffer.
finishBufferList
aggregatorFinishBufferList Source #
:: (HasCallStack, MonadIO m, IsAggregator a) | |
=> a |
|
-> BufferList |
|
-> m FlowReturn |
This method will push the provided output buffer list downstream. If needed, mandatory events such as stream-start, caps, and segment events will be sent before pushing the buffer.
Since: 1.18
getAllocator
aggregatorGetAllocator Source #
:: (HasCallStack, MonadIO m, IsAggregator a) | |
=> a |
|
-> m (Maybe Allocator, AllocationParams) |
Lets Aggregator
sub-classes get the memory allocator
acquired by the base class and its params
.
Unref the allocator
after use it.
getBufferPool
aggregatorGetBufferPool Source #
:: (HasCallStack, MonadIO m, IsAggregator a) | |
=> a |
|
-> m (Maybe BufferPool) | Returns: the instance of the |
No description available in the introspection data.
getLatency
:: (HasCallStack, MonadIO m, IsAggregator a) | |
=> a |
|
-> m Word64 | Returns: The latency or |
Retrieves the latency values reported by self
in response to the latency
query, or CLOCK_TIME_NONE
if there is not live source connected and the element
will not wait for the clock.
Typically only called by subclasses.
negotiate
:: (HasCallStack, MonadIO m, IsAggregator a) | |
=> a |
|
-> m Bool |
Negotiates src pad caps with downstream elements.
Unmarks GST_PAD_FLAG_NEED_RECONFIGURE in any case. But marks it again
if AggregatorClass
::negotiate
fails.
Since: 1.18
peekNextSample
aggregatorPeekNextSample Source #
:: (HasCallStack, MonadIO m, IsAggregator a, IsAggregatorPad b) | |
=> a | |
-> b | |
-> m (Maybe Sample) | Returns: The sample that is about to be aggregated. It may hold a |
Use this function to determine what input buffers will be aggregated to produce the next output buffer. This should only be called from a samplesSelected handler, and can be used to precisely control aggregating parameters for a given set of input samples.
Since: 1.18
selectedSamples
aggregatorSelectedSamples Source #
:: (HasCallStack, MonadIO m, IsAggregator a) | |
=> a | |
-> Word64 |
|
-> Word64 |
|
-> Word64 |
|
-> Maybe Structure |
|
-> m () |
Subclasses should call this when they have prepared the buffers they will aggregate for each of their sink pads, but before using any of the properties of the pads that govern *how* aggregation should be performed, for example z-index for video aggregators.
If aggregatorUpdateSegment
is used by the subclass,
it MUST be called before aggregatorSelectedSamples
.
This function MUST only be called from the AggregatorClass
::aggregate
()
function.
Since: 1.18
setLatency
:: (HasCallStack, MonadIO m, IsAggregator a) | |
=> a |
|
-> Word64 |
|
-> Word64 |
|
-> m () |
Lets Aggregator
sub-classes tell the baseclass what their internal
latency is. Will also post a LATENCY message on the bus so the pipeline
can reconfigure its global latency.
setSrcCaps
:: (HasCallStack, MonadIO m, IsAggregator a) | |
=> a |
|
-> Caps |
|
-> m () |
Sets the caps to be used on the src pad.
simpleGetNextTime
aggregatorSimpleGetNextTime Source #
:: (HasCallStack, MonadIO m, IsAggregator a) | |
=> a |
|
-> m Word64 | Returns: The running time based on the position |
This is a simple AggregatorClass
::get_next_time
implementation that
just looks at the Segment
on the srcpad of the aggregator and bases
the next time on the running time there.
This is the desired behaviour in most cases where you have a live source and you have a dead line based aggregator subclass.
Since: 1.16
updateSegment
aggregatorUpdateSegment :: (HasCallStack, MonadIO m, IsAggregator a) => a -> Segment -> m () Source #
Subclasses should use this to update the segment on their source pad, instead of directly pushing new segment events downstream.
Subclasses MUST call this before aggregatorSelectedSamples
,
if it is used at all.
Since: 1.18
Properties
emitSignals
Enables the emission of signals such as samplesSelected
Since: 1.18
constructAggregatorEmitSignals :: (IsAggregator o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “emit-signals
” property. This is rarely needed directly, but it is used by new
.
getAggregatorEmitSignals :: (MonadIO m, IsAggregator o) => o -> m Bool Source #
Get the value of the “emit-signals
” property.
When overloading is enabled, this is equivalent to
get
aggregator #emitSignals
setAggregatorEmitSignals :: (MonadIO m, IsAggregator o) => o -> Bool -> m () Source #
Set the value of the “emit-signals
” property.
When overloading is enabled, this is equivalent to
set
aggregator [ #emitSignals:=
value ]
latency
No description available in the introspection data.
constructAggregatorLatency :: (IsAggregator o, MonadIO m) => Word64 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “latency
” property. This is rarely needed directly, but it is used by new
.
getAggregatorLatency :: (MonadIO m, IsAggregator o) => o -> m Word64 Source #
Get the value of the “latency
” property.
When overloading is enabled, this is equivalent to
get
aggregator #latency
setAggregatorLatency :: (MonadIO m, IsAggregator o) => o -> Word64 -> m () Source #
Set the value of the “latency
” property.
When overloading is enabled, this is equivalent to
set
aggregator [ #latency:=
value ]
minUpstreamLatency
Force minimum upstream latency (in nanoseconds). When sources with a higher latency are expected to be plugged in dynamically after the aggregator has started playing, this allows overriding the minimum latency reported by the initial source(s). This is only taken into account when larger than the actually reported minimum latency.
Since: 1.16
constructAggregatorMinUpstreamLatency :: (IsAggregator o, MonadIO m) => Word64 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “min-upstream-latency
” property. This is rarely needed directly, but it is used by new
.
getAggregatorMinUpstreamLatency :: (MonadIO m, IsAggregator o) => o -> m Word64 Source #
Get the value of the “min-upstream-latency
” property.
When overloading is enabled, this is equivalent to
get
aggregator #minUpstreamLatency
setAggregatorMinUpstreamLatency :: (MonadIO m, IsAggregator o) => o -> Word64 -> m () Source #
Set the value of the “min-upstream-latency
” property.
When overloading is enabled, this is equivalent to
set
aggregator [ #minUpstreamLatency:=
value ]
startTime
No description available in the introspection data.
constructAggregatorStartTime :: (IsAggregator o, MonadIO m) => Word64 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “start-time
” property. This is rarely needed directly, but it is used by new
.
getAggregatorStartTime :: (MonadIO m, IsAggregator o) => o -> m Word64 Source #
Get the value of the “start-time
” property.
When overloading is enabled, this is equivalent to
get
aggregator #startTime
setAggregatorStartTime :: (MonadIO m, IsAggregator o) => o -> Word64 -> m () Source #
Set the value of the “start-time
” property.
When overloading is enabled, this is equivalent to
set
aggregator [ #startTime:=
value ]
startTimeSelection
No description available in the introspection data.
constructAggregatorStartTimeSelection :: (IsAggregator o, MonadIO m) => AggregatorStartTimeSelection -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “start-time-selection
” property. This is rarely needed directly, but it is used by new
.
getAggregatorStartTimeSelection :: (MonadIO m, IsAggregator o) => o -> m AggregatorStartTimeSelection Source #
Get the value of the “start-time-selection
” property.
When overloading is enabled, this is equivalent to
get
aggregator #startTimeSelection
setAggregatorStartTimeSelection :: (MonadIO m, IsAggregator o) => o -> AggregatorStartTimeSelection -> m () Source #
Set the value of the “start-time-selection
” property.
When overloading is enabled, this is equivalent to
set
aggregator [ #startTimeSelection:=
value ]
Signals
samplesSelected
type AggregatorSamplesSelectedCallback Source #
= Segment |
|
-> Word64 |
|
-> Word64 |
|
-> Word64 |
|
-> Maybe Structure |
|
-> IO () |
Signals that the Aggregator
subclass has selected the next set
of input samples it will aggregate. Handlers may call
aggregatorPeekNextSample
at that point.
Since: 1.18
afterAggregatorSamplesSelected :: (IsAggregator a, MonadIO m) => a -> ((?self :: a) => AggregatorSamplesSelectedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the samplesSelected signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
aggregator #samplesSelected callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onAggregatorSamplesSelected :: (IsAggregator a, MonadIO m) => a -> ((?self :: a) => AggregatorSamplesSelectedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the samplesSelected signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
aggregator #samplesSelected callback