Class AudioAggregator

All Implemented Interfaces:
Proxy
Direct Known Subclasses:
AudioAggregator.AudioAggregator$Impl

@Generated("org.javagi.JavaGI") public abstract class AudioAggregator extends Aggregator

Subclasses must use (a subclass of) GstAudioAggregatorPad for both their source and sink pads, gst_element_class_add_static_pad_template_with_gtype() 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 gst_aggregator_peek_next_sample() 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
Since:
1.14
  • Constructor Details

    • AudioAggregator

      public AudioAggregator(MemorySegment address)
      Create a AudioAggregator instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • AudioAggregator

      public AudioAggregator()
      Create a new AudioAggregator.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the AudioAggregator class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected AudioAggregator asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class Aggregator
      Returns:
      the instance as if it were its parent type
    • setSinkCaps

      public void setSinkCaps(AudioAggregatorPad pad, Caps caps)
    • aggregateOneBuffer

      protected boolean aggregateOneBuffer(AudioAggregatorPad pad, Buffer inbuf, int inOffset, Buffer outbuf, int outOffset, int numFrames)
      Aggregates one input buffer to the output buffer. The in_offset and out_offset are in "frames", which is the size of a sample times the number of channels. Returns TRUE if any non-silence was added to the buffer
    • createOutputBuffer

      protected Buffer createOutputBuffer(int numFrames)
      Create a new output buffer contains num_frames frames.