AudioAggregator

Subclasses must use (a subclass of) #GstAudioAggregatorPad for both their source and sink pads, gst.element_class.ElementClass.addStaticPadTemplateWithGtype is a convenient helper.

#GstAudioAggregator can perform conversion on the data arriving on its sink pads, based on the format expected downstream: in order to enable that behaviour, the GType of the sink pads must either be a (subclass of) #GstAudioAggregatorConvertPad to use the default #GstAudioConverter implementation, or a subclass of #GstAudioAggregatorPad implementing #GstAudioAggregatorPadClass.convert_buffer.

To allow for the output caps to change, the mechanism is the same as above, with the GType of the source pad.

See #GstAudioMixer for an example.

When conversion is enabled, #GstAudioAggregator will accept any type of raw audio caps and perform conversion on the data arriving on its sink pads, with whatever downstream expects as the target format.

In case downstream caps are not fully fixated, it will use the first configured sink pad to finish fixating its source pad caps.

A notable exception for now is the sample rate, sink pads must have the same sample rate as either the downstream requirement, or the first configured pad, or a combination of both (when downstream specifies a range or a set of acceptable rates).

The #GstAggregator::samples-selected signal is provided with some additional information about the output buffer:

  • "offset" G_TYPE_UINT64 Offset in samples since segment start for the position that is next to be filled in the output buffer.
  • "frames" G_TYPE_UINT Number of frames per output buffer.

In addition the gstbase.aggregator.Aggregator.peekNextSample function returns additional information in the info #GstStructure of the returned sample:

  • "output-offset" G_TYPE_UINT64 Sample offset in output segment relative to the output segment's start where the current position of this input buffer would be placed
  • "position" G_TYPE_UINT current position in the input buffer in samples
  • "size" G_TYPE_UINT size of the input buffer in samples

Members

Functions

setSinkCaps
void setSinkCaps(gstaudio.audio_aggregator_pad.AudioAggregatorPad pad, gst.caps.Caps caps)

Inherited Members

From Aggregator

finishBuffer
gst.types.FlowReturn finishBuffer(gst.buffer.Buffer buffer)

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
gst.types.FlowReturn finishBufferList(gst.buffer_list.BufferList bufferlist)

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.

getAllocator
void getAllocator(gst.allocator.Allocator allocator, gst.allocation_params.AllocationParams params)

Lets #GstAggregator sub-classes get the memory allocator acquired by the base class and its params.

getBufferPool
gst.buffer_pool.BufferPool getBufferPool()
getForceLive
bool getForceLive()

Subclasses may use the return value to inform whether they should return gst.types.FlowReturn.Eos from their aggregate implementation.

getIgnoreInactivePads
bool getIgnoreInactivePads()
getLatency
gst.types.ClockTime getLatency()

Retrieves the latency values reported by self in response to the latency query, or GST_CLOCK_TIME_NONE if there is not live source connected and the element will not wait for the clock.

negotiate
bool negotiate()

Negotiates src pad caps with downstream elements. Unmarks GST_PAD_FLAG_NEED_RECONFIGURE in any case. But marks it again if #GstAggregatorClass::negotiate fails.

peekNextSample
gst.sample.Sample peekNextSample(gstbase.aggregator_pad.AggregatorPad pad)

Use this function to determine what input buffers will be aggregated to produce the next output buffer. This should only be called from a #GstAggregator::samples-selected handler, and can be used to precisely control aggregating parameters for a given set of input samples.

selectedSamples
void selectedSamples(gst.types.ClockTime pts, gst.types.ClockTime dts, gst.types.ClockTime duration, gst.structure.Structure info)

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.

setForceLive
void setForceLive(bool forceLive)

Subclasses should call this at construction time in order for self to aggregate on a timeout even when no live source is connected.

setIgnoreInactivePads
void setIgnoreInactivePads(bool ignore)

Subclasses should call this when they don't want to time out waiting for a pad that hasn't yet received any buffers in live mode.

setLatency
void setLatency(gst.types.ClockTime minLatency, gst.types.ClockTime maxLatency)

Lets #GstAggregator 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 if the values changed.

setSrcCaps
void setSrcCaps(gst.caps.Caps caps)

Sets the caps to be used on the src pad.

simpleGetNextTime
gst.types.ClockTime simpleGetNextTime()

This is a simple #GstAggregatorClass::get_next_time implementation that just looks at the #GstSegment on the srcpad of the aggregator and bases the next time on the running time there.

updateSegment
void updateSegment(gst.segment.Segment segment)

Subclasses should use this to update the segment on their source pad, instead of directly pushing new segment events downstream.

connectSamplesSelected
ulong connectSamplesSelected(T callback, Flag!"After" after)

Connect to SamplesSelected signal.