Class AudioBaseSink

All Implemented Interfaces:
Proxy
Direct Known Subclasses:
AudioSink

@Generated("org.javagi.JavaGI") public class AudioBaseSink extends BaseSink
This is the base class for audio sinks. Subclasses need to implement the ::create_ringbuffer vmethod. This base class will then take care of writing samples to the ringbuffer, synchronisation, clipping and flushing.
  • Constructor Details

    • AudioBaseSink

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

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

    • getType

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

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

      protected AudioBaseSink 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 BaseSink
      Returns:
      the instance as if it were its parent type
    • createRingbuffer

      public @Nullable AudioRingBuffer createRingbuffer()
      Create and return the GstAudioRingBuffer for sink. This function will call the ::create_ringbuffer vmethod and will set this AudioBaseSink as the parent of the returned buffer (see gst_object_set_parent()).
      Returns:
      The new ringbuffer of sink.
    • getAlignmentThreshold

      public ClockTime getAlignmentThreshold()
      Get the current alignment threshold, in nanoseconds, used by sink.
      Returns:
      The current alignment threshold used by sink.
    • getDiscontWait

      public ClockTime getDiscontWait()
      Get the current discont wait, in nanoseconds, used by sink.
      Returns:
      The current discont wait used by sink.
    • getDriftTolerance

      public long getDriftTolerance()
      Get the current drift tolerance, in microseconds, used by sink.
      Returns:
      The current drift tolerance used by sink.
    • getProvideClock

      public boolean getProvideClock()
      Queries whether this AudioBaseSink will provide a clock or not. See also gst_audio_base_sink_set_provide_clock.
      Returns:
      true if this AudioBaseSink will provide a clock.
    • getSlaveMethod

      public AudioBaseSinkSlaveMethod getSlaveMethod()
      Get the current slave method used by sink.
      Returns:
      The current slave method used by sink.
    • reportDeviceFailure

      public void reportDeviceFailure()
      Informs this base class that the audio output device has failed for some reason, causing a discontinuity (for example, because the device recovered from the error, but lost all contents of its ring buffer). This function is typically called by derived classes, and is useful for the custom slave method.
      Since:
      1.6
    • setAlignmentThreshold

      public void setAlignmentThreshold(ClockTime alignmentThreshold)
      Controls the sink's alignment threshold.
      Parameters:
      alignmentThreshold - the new alignment threshold in nanoseconds
    • setCustomSlavingCallback

      public void setCustomSlavingCallback(@Nullable AudioBaseSinkCustomSlavingCallback callback)

      Sets the custom slaving callback. This callback will be invoked if the slave-method property is set to GST_AUDIO_BASE_SINK_SLAVE_CUSTOM and the audio sink receives and plays samples.

      Setting the callback to NULL causes the sink to behave as if the GST_AUDIO_BASE_SINK_SLAVE_NONE method were used.

      Parameters:
      callback - a GstAudioBaseSinkCustomSlavingCallback
      Since:
      1.6
    • setDiscontWait

      public void setDiscontWait(ClockTime discontWait)
      Controls how long the sink will wait before creating a discontinuity.
      Parameters:
      discontWait - the new discont wait in nanoseconds
    • setDriftTolerance

      public void setDriftTolerance(long driftTolerance)
      Controls the sink's drift tolerance.
      Parameters:
      driftTolerance - the new drift tolerance in microseconds
    • setProvideClock

      public void setProvideClock(boolean provide)
      Controls whether this AudioBaseSink will provide a clock or not. If provide is true, gst_element_provide_clock() will return a clock that reflects the datarate of sink. If provide is false, gst_element_provide_clock() will return NULL.
      Parameters:
      provide - new state
    • setSlaveMethod

      public void setSlaveMethod(AudioBaseSinkSlaveMethod method)
      Controls how clock slaving will be performed in sink.
      Parameters:
      method - the new slave method
    • payload

      protected Buffer payload(Buffer buffer)
      payload data in a format suitable to write to the sink. If no payloading is required, returns a reffed copy of the original buffer, else returns the payloaded buffer with all other metadata copied.
    • builder

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