Class AudioSrc

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class AudioSrc extends AudioBaseSrc

This is the most simple base class for audio sources that only requires subclasses to implement a set of simple functions:

  • open() :Open the device.
  • prepare() :Configure the device with the specified format.
  • read() :Read samples from the device.
  • reset() :Unblock reads and flush the device.
  • delay() :Get the number of samples in the device but not yet read.
  • unprepare() :Undo operations done by prepare.
  • close() :Close the device.

All scheduling of samples and timestamps is done in this base class together with GstAudioBaseSrc using a default implementation of a GstAudioRingBuffer that uses threads.

  • Constructor Details

    • AudioSrc

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

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

    • getType

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

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

      protected AudioSrc 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 AudioBaseSrc
      Returns:
      the instance as if it were its parent type
    • close

      protected boolean close()
      close the device
    • delay

      protected int delay()
      the number of frames queued in the device
    • open

      protected boolean open()
      open the device with the specified caps
    • prepare

      protected boolean prepare(AudioRingBufferSpec spec)
      configure device with format
    • read

      protected int read(@Nullable byte @Nullable [] data, ClockTime timestamp)
      Read samples from the device.
      Parameters:
      data - the sample data
      timestamp - a GstClockTime
    • reset

      protected void reset()
      unblock a read to the device and reset.
    • unprepare

      protected boolean unprepare()
      undo the configuration
    • builder

      public static AudioSrc.Builder<? extends AudioSrc.Builder> builder()
      A AudioSrc.Builder object constructs a AudioSrc with the specified properties. Use the various set...() methods to set properties, and finish construction with AudioSrc.Builder.build().
      Returns:
      the builder object