Class AudioResampler

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

@Generated("org.javagi.JavaGI") public class AudioResampler extends ProxyInstance
GstAudioResampler is a structure which holds the information required to perform various kinds of resampling filtering.
Since:
1.10
  • Constructor Details

    • AudioResampler

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

    • getMemoryLayout

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

      public static AudioResampler new_(AudioResamplerMethod method, Set<AudioResamplerFlags> flags, AudioFormat format, int channels, int inRate, int outRate, Structure options)
      Make a new resampler.
      Parameters:
      method - a GstAudioResamplerMethod
      flags - GstAudioResamplerFlags
      format - the GstAudioFormat
      channels - the number of channels
      inRate - input rate
      outRate - output rate
      options - extra options
      Returns:
      The new GstAudioResampler.
    • new_

      public static AudioResampler new_(AudioResamplerMethod method, AudioResamplerFlags flags, AudioFormat format, int channels, int inRate, int outRate, Structure options)
      Make a new resampler.
      Parameters:
      method - a GstAudioResamplerMethod
      flags - GstAudioResamplerFlags
      format - the GstAudioFormat
      channels - the number of channels
      inRate - input rate
      outRate - output rate
      options - extra options
      Returns:
      The new GstAudioResampler.
    • optionsSetQuality

      public static void optionsSetQuality(AudioResamplerMethod method, int quality, int inRate, int outRate, Structure options)
      Set the parameters for resampling from inRate to outRate using method for quality in options.
      Parameters:
      method - a GstAudioResamplerMethod
      quality - the quality
      inRate - the input rate
      outRate - the output rate
      options - a GstStructure
    • free

      public void free()
      Free a previously allocated GstAudioResampler resampler.
    • getInFrames

      public long getInFrames(long outFrames)
      Get the number of input frames that would currently be needed to produce outFrames from resampler.
      Parameters:
      outFrames - number of input frames
      Returns:
      The number of input frames needed for producing outFrames of data from resampler.
    • getMaxLatency

      public long getMaxLatency()
      Get the maximum number of input samples that the resampler would need before producing output.
      Returns:
      the latency of this AudioResampler as expressed in the number of frames.
    • getOutFrames

      public long getOutFrames(long inFrames)
      Get the number of output frames that would be currently available when inFrames are given to resampler.
      Parameters:
      inFrames - number of input frames
      Returns:
      The number of frames that would be available after giving inFrames as input to resampler.
    • resample

      public void resample(@Nullable MemorySegment in, long inFrames, @Nullable MemorySegment out, long outFrames)

      Perform resampling on inFrames frames in in and write outFrames to out.

      In case the samples are interleaved, in and out must point to an array with a single element pointing to a block of interleaved samples.

      If non-interleaved samples are used, in and out must point to an array with pointers to memory blocks, one for each channel.

      in may be null, in which case inFrames of silence samples are pushed into the resampler.

      This function always produces outFrames of output and consumes inFrames of input. Use gst_audio_resampler_get_out_frames() and gst_audio_resampler_get_in_frames() to make sure inFrames and outFrames are matching and in and out point to enough memory.

      Parameters:
      in - input samples
      inFrames - number of input frames
      out - output samples
      outFrames - number of output frames
    • reset

      public void reset()
      Reset this AudioResampler to the state it was when it was first created, discarding all sample history.
    • update

      public boolean update(int inRate, int outRate, Structure options)

      Update the resampler parameters for resampler. This function should not be called concurrently with any other function on resampler.

      When inRate or outRate is 0, its value is unchanged.

      When options is null, the previously configured options are reused.

      Parameters:
      inRate - new input rate
      outRate - new output rate
      options - new options or null
      Returns:
      true if the new parameters could be set