Class AudioStreamAlign

java.lang.Object
org.javagi.base.ProxyInstance
org.freedesktop.gstreamer.audio.AudioStreamAlign
All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class AudioStreamAlign extends ProxyInstance

GstAudioStreamAlign provides a helper object that helps tracking audio stream alignment and discontinuities, and detects discontinuities if possible.

See gst_audio_stream_align_new() for a description of its parameters and gst_audio_stream_align_process() for the details of the processing.

Since:
1.14
  • Constructor Details

    • AudioStreamAlign

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

      public AudioStreamAlign(int rate, ClockTime alignmentThreshold, ClockTime discontWait)

      Allocate a new GstAudioStreamAlign with the given configuration. All processing happens according to sample rate rate, until gst_audio_stream_align_set_rate() is called with a new rate. A negative rate can be used for reverse playback.

      alignmentThreshold gives the tolerance in nanoseconds after which a timestamp difference is considered a discontinuity. Once detected, discontWait nanoseconds have to pass without going below the threshold again until the output buffer is marked as a discontinuity. These can later be re-configured with gst_audio_stream_align_set_alignment_threshold() and gst_audio_stream_align_set_discont_wait().

      Parameters:
      rate - a sample rate
      alignmentThreshold - a alignment threshold in nanoseconds
      discontWait - discont wait in nanoseconds
      Since:
      1.14
  • Method Details

    • getType

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

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

      public AudioStreamAlign copy()
      Copy a GstAudioStreamAlign structure.
      Returns:
      a new GstAudioStreamAlign. free with gst_audio_stream_align_free.
      Since:
      1.14
    • free

      public void free()
      Free a GstAudioStreamAlign structure previously allocated with gst_audio_stream_align_new() or gst_audio_stream_align_copy().
      Since:
      1.14
    • getAlignmentThreshold

      public ClockTime getAlignmentThreshold()
      Gets the currently configured alignment threshold.
      Returns:
      The currently configured alignment threshold
      Since:
      1.14
    • getDiscontWait

      public ClockTime getDiscontWait()
      Gets the currently configured discont wait.
      Returns:
      The currently configured discont wait
      Since:
      1.14
    • getRate

      public int getRate()
      Gets the currently configured sample rate.
      Returns:
      The currently configured sample rate
      Since:
      1.14
    • getSamplesSinceDiscont

      public long getSamplesSinceDiscont()
      Returns the number of samples that were processed since the last discontinuity was detected.
      Returns:
      The number of samples processed since the last discontinuity.
      Since:
      1.14
    • getTimestampAtDiscont

      public ClockTime getTimestampAtDiscont()
      Timestamp that was passed when a discontinuity was detected, i.e. the first timestamp after the discontinuity.
      Returns:
      The last timestamp at when a discontinuity was detected
      Since:
      1.14
    • markDiscont

      public void markDiscont()
      Marks the next buffer as discontinuous and resets timestamp tracking.
      Since:
      1.14
    • process

      public boolean process(boolean discont, ClockTime timestamp, int nSamples, ClockTime outTimestamp, ClockTime outDuration, Out<Long> outSamplePosition)

      Processes data with timestamp and nSamples, and returns the output timestamp, duration and sample position together with a boolean to signal whether a discontinuity was detected or not. All non-discontinuous data will have perfect timestamps and durations.

      A discontinuity is detected once the difference between the actual timestamp and the timestamp calculated from the sample count since the last discontinuity differs by more than the alignment threshold for a duration longer than discont wait.

      Note: In reverse playback, every buffer is considered discontinuous in the context of buffer flags because the last sample of the previous buffer is discontinuous with the first sample of the current one. However for this function they are only considered discontinuous in reverse playback if the first sample of the previous buffer is discontinuous with the last sample of the current one.

      Parameters:
      discont - if this data is considered to be discontinuous
      timestamp - a GstClockTime of the start of the data
      nSamples - number of samples to process
      outTimestamp - output timestamp of the data
      outDuration - output duration of the data
      outSamplePosition - output sample position of the start of the data
      Returns:
      true if a discontinuity was detected, false otherwise.
      Since:
      1.14
    • setAlignmentThreshold

      public void setAlignmentThreshold(ClockTime alignmentThreshold)
      Sets alignmentTreshold as new alignment threshold for the following processing.
      Parameters:
      alignmentThreshold - a new alignment threshold
      Since:
      1.14
    • setDiscontWait

      public void setDiscontWait(ClockTime discontWait)
      Sets alignmentTreshold as new discont wait for the following processing.
      Parameters:
      discontWait - a new discont wait
      Since:
      1.14
    • setRate

      public void setRate(int rate)
      Sets rate as new sample rate for the following processing. If the sample rate differs this implicitly marks the next data as discontinuous.
      Parameters:
      rate - a new sample rate
      Since:
      1.14