Package org.freedesktop.gstreamer.audio
Class AudioResampler
java.lang.Object
org.javagi.base.ProxyInstance
org.freedesktop.gstreamer.audio.AudioResampler
- All Implemented Interfaces:
Proxy
GstAudioResampler is a structure which holds the information
required to perform various kinds of resampling filtering.- Since:
- 1.10
-
Constructor Summary
ConstructorsConstructorDescriptionAudioResampler(MemorySegment address) Create a AudioResampler proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionvoidfree()Free a previously allocatedGstAudioResamplerresampler.longgetInFrames(long outFrames) Get the number of input frames that would currently be needed to produceoutFramesfromresampler.longGet the maximum number of input samples that the resampler would need before producing output.longgetOutFrames(long inFrames) Get the number of output frames that would be currently available wheninFramesare given toresampler.static AudioResamplernew_(AudioResamplerMethod method, Set<AudioResamplerFlags> flags, AudioFormat format, int channels, int inRate, int outRate, Structure options) Make a new resampler.static AudioResamplernew_(AudioResamplerMethod method, AudioResamplerFlags flags, AudioFormat format, int channels, int inRate, int outRate, Structure options) Make a new resampler.static voidoptionsSetQuality(AudioResamplerMethod method, int quality, int inRate, int outRate, Structure options) Set the parameters for resampling frominRatetooutRateusingmethodforqualityinoptions.voidresample(@Nullable MemorySegment in, long inFrames, @Nullable MemorySegment out, long outFrames) Perform resampling oninFramesframes ininand writeoutFramestoout.voidreset()Reset this AudioResampler to the state it was when it was first created, discarding all sample history.booleanUpdate the resampler parameters forresampler.This function should not be called concurrently with any other function onresampler.Methods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
AudioResampler
Create a AudioResampler proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
-
Method Details
-
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- aGstAudioResamplerMethodflags-GstAudioResamplerFlagsformat- theGstAudioFormatchannels- the number of channelsinRate- input rateoutRate- output rateoptions- 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- aGstAudioResamplerMethodflags-GstAudioResamplerFlagsformat- theGstAudioFormatchannels- the number of channelsinRate- input rateoutRate- output rateoptions- 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 frominRatetooutRateusingmethodforqualityinoptions.- Parameters:
method- aGstAudioResamplerMethodquality- the qualityinRate- the input rateoutRate- the output rateoptions- aGstStructure
-
free
public void free()Free a previously allocatedGstAudioResamplerresampler. -
getInFrames
public long getInFrames(long outFrames) Get the number of input frames that would currently be needed to produceoutFramesfromresampler.- Parameters:
outFrames- number of input frames- Returns:
- The number of input frames needed for producing
outFramesof data fromresampler.
-
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 wheninFramesare given toresampler.- Parameters:
inFrames- number of input frames- Returns:
- The number of frames that would be available after giving
inFramesas input toresampler.
-
resample
public void resample(@Nullable MemorySegment in, long inFrames, @Nullable MemorySegment out, long outFrames) Perform resampling oninFramesframes ininand writeoutFramestoout.In case the samples are interleaved,
inandoutmust point to an array with a single element pointing to a block of interleaved samples.If non-interleaved samples are used,
inandoutmust point to an array with pointers to memory blocks, one for each channel.inmay benull, in which caseinFramesof silence samples are pushed into the resampler.This function always produces
outFramesof output and consumesinFramesof input. Use gst_audio_resampler_get_out_frames() and gst_audio_resampler_get_in_frames() to make sureinFramesandoutFramesare matching andinandoutpoint to enough memory.- Parameters:
in- input samplesinFrames- number of input framesout- output samplesoutFrames- 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
Update the resampler parameters forresampler.This function should not be called concurrently with any other function onresampler.When
inRateoroutRateis 0, its value is unchanged.When
optionsisnull, the previously configured options are reused.- Parameters:
inRate- new input rateoutRate- new output rateoptions- new options ornull- Returns:
trueif the new parameters could be set
-