Class AudioConverter

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

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

This object is used to convert audio samples from one format to another. The object can perform conversion of:

  • audio format with optional dithering and noise shaping

  • audio samplerate

  • audio channels and channel layout

Since:
1.8
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a AudioConverter proxy instance for the provided memory address.
    AudioConverter(Set<AudioConverterFlags> flags, AudioInfo inInfo, AudioInfo outInfo, @Nullable Structure config)
    Create a new GstAudioConverter that is able to convert between in and out audio formats.
    AudioConverter(AudioConverterFlags flags, AudioInfo inInfo, AudioInfo outInfo, @Nullable Structure config)
    Create a new GstAudioConverter that is able to convert between in and out audio formats.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    convert(Set<AudioConverterFlags> flags, @Nullable byte @Nullable [] in, @Nullable Out<byte[]> out)
    Convenience wrapper around gst_audio_converter_samples(), which will perform allocation of the output buffer based on the result from gst_audio_converter_get_out_frames().
    boolean
    convert(AudioConverterFlags flags, @Nullable byte @Nullable [] in, @Nullable Out<byte[]> out)
    Convenience wrapper around gst_audio_converter_samples(), which will perform allocation of the output buffer based on the result from gst_audio_converter_get_out_frames().
    void
    Free a previously allocated this AudioConverter instance.
    getConfig(@Nullable Out<Integer> inRate, @Nullable Out<Integer> outRate)
    Get the current configuration of convert.
    long
    getInFrames(long outFrames)
    Calculate how many input frames are currently needed by this AudioConverter to produce outFrames of output frames.
    long
    Get the maximum number of input frames that the converter would need before producing output.
    The memory layout of the native struct.
    long
    getOutFrames(long inFrames)
    Calculate how many output frames can be produced when inFrames input frames are given to convert.
    static @Nullable Type
    Get the GType of the AudioConverter class.
    boolean
    Returns whether the audio converter will operate in passthrough mode.
    void
    Reset this AudioConverter to the state it was when it was first created, clearing any history it might currently have.
    boolean
    samples(Set<AudioConverterFlags> flags, @Nullable MemorySegment in, long inFrames, @Nullable MemorySegment out, long outFrames)
    Perform the conversion with inFrames in in to outFrames in out using convert.
    boolean
    samples(AudioConverterFlags flags, @Nullable MemorySegment in, long inFrames, @Nullable MemorySegment out, long outFrames)
    Perform the conversion with inFrames in in to outFrames in out using convert.
    boolean
    Returns whether the audio converter can perform the conversion in-place.
    boolean
    updateConfig(int inRate, int outRate, @Nullable Structure config)
    Set inRate, outRate and config as extra configuration for convert.

    Methods inherited from class ProxyInstance

    equals, handle, hashCode

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AudioConverter

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

      public AudioConverter(Set<AudioConverterFlags> flags, AudioInfo inInfo, AudioInfo outInfo, @Nullable Structure config)

      Create a new GstAudioConverter that is able to convert between in and out audio formats.

      config contains extra configuration options, see GST_AUDIO_CONVERTER_OPT_* parameters for details about the options and values.

      Parameters:
      flags - extra GstAudioConverterFlags
      inInfo - a source GstAudioInfo
      outInfo - a destination GstAudioInfo
      config - a GstStructure with configuration options
    • AudioConverter

      public AudioConverter(AudioConverterFlags flags, AudioInfo inInfo, AudioInfo outInfo, @Nullable Structure config)

      Create a new GstAudioConverter that is able to convert between in and out audio formats.

      config contains extra configuration options, see GST_AUDIO_CONVERTER_OPT_* parameters for details about the options and values.

      Parameters:
      flags - extra GstAudioConverterFlags
      inInfo - a source GstAudioInfo
      outInfo - a destination GstAudioInfo
      config - a GstStructure with configuration options
  • Method Details

    • getType

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

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

      public boolean convert(Set<AudioConverterFlags> flags, @Nullable byte @Nullable [] in, @Nullable Out<byte[]> out)
      Convenience wrapper around gst_audio_converter_samples(), which will perform allocation of the output buffer based on the result from gst_audio_converter_get_out_frames().
      Parameters:
      flags - extra GstAudioConverterFlags
      in - input data
      out - a pointer where the output data will be written
      Returns:
      true is the conversion could be performed.
      Since:
      1.14
    • convert

      public boolean convert(AudioConverterFlags flags, @Nullable byte @Nullable [] in, @Nullable Out<byte[]> out)
      Convenience wrapper around gst_audio_converter_samples(), which will perform allocation of the output buffer based on the result from gst_audio_converter_get_out_frames().
      Parameters:
      flags - extra GstAudioConverterFlags
      in - input data
      out - a pointer where the output data will be written
      Returns:
      true is the conversion could be performed.
      Since:
      1.14
    • free

      public void free()
      Free a previously allocated this AudioConverter instance.
    • getConfig

      public Structure getConfig(@Nullable Out<Integer> inRate, @Nullable Out<Integer> outRate)
      Get the current configuration of convert.
      Parameters:
      inRate - result input rate
      outRate - result output rate
      Returns:
      a GstStructure that remains valid for as long as this AudioConverter is valid or until gst_audio_converter_update_config() is called.
    • getInFrames

      public long getInFrames(long outFrames)
      Calculate how many input frames are currently needed by this AudioConverter to produce outFrames of output frames.
      Parameters:
      outFrames - number of output frames
      Returns:
      the number of input frames
    • getMaxLatency

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

      public long getOutFrames(long inFrames)
      Calculate how many output frames can be produced when inFrames input frames are given to convert.
      Parameters:
      inFrames - number of input frames
      Returns:
      the number of output frames
    • isPassthrough

      public boolean isPassthrough()
      Returns whether the audio converter will operate in passthrough mode. The return value would be typically input to gst_base_transform_set_passthrough()
      Returns:
      true when no conversion will actually occur.
      Since:
      1.16
    • reset

      public void reset()
      Reset this AudioConverter to the state it was when it was first created, clearing any history it might currently have.
    • samples

      public boolean samples(Set<AudioConverterFlags> flags, @Nullable MemorySegment in, long inFrames, @Nullable MemorySegment out, long outFrames)

      Perform the conversion with inFrames in in to outFrames in out using convert.

      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 processed by the converter.

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

      Parameters:
      flags - extra GstAudioConverterFlags
      in - input frames
      inFrames - number of input frames
      out - output frames
      outFrames - number of output frames
      Returns:
      true is the conversion could be performed.
    • samples

      public boolean samples(AudioConverterFlags flags, @Nullable MemorySegment in, long inFrames, @Nullable MemorySegment out, long outFrames)

      Perform the conversion with inFrames in in to outFrames in out using convert.

      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 processed by the converter.

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

      Parameters:
      flags - extra GstAudioConverterFlags
      in - input frames
      inFrames - number of input frames
      out - output frames
      outFrames - number of output frames
      Returns:
      true is the conversion could be performed.
    • supportsInplace

      public boolean supportsInplace()
      Returns whether the audio converter can perform the conversion in-place. The return value would be typically input to gst_base_transform_set_in_place()
      Returns:
      true when the conversion can be done in place.
      Since:
      1.12
    • updateConfig

      public boolean updateConfig(int inRate, int outRate, @Nullable Structure config)

      Set inRate, outRate and config as extra configuration for convert.

      inRate and outRate specify the new sample rates of input and output formats. A value of 0 leaves the sample rate unchanged.

      config can be null, in which case, the current configuration is not changed.

      If the parameters in config can not be set exactly, this function returns false and will try to update as much state as possible. The new state can then be retrieved and refined with gst_audio_converter_get_config().

      Look at the GST_AUDIO_CONVERTER_OPT_* fields to check valid configuration option and values.

      Parameters:
      inRate - input rate
      outRate - output rate
      config - a GstStructure or null
      Returns:
      true when the new parameters could be set