GstAudio.AudioResampler¶
Fields¶
None
Methods¶
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class GstAudio.AudioResampler¶
GstAudio.AudioResampler
is a structure which holds the information required to perform various kinds of resampling filtering.New in version 1.10.
- classmethod new(method, flags, format, channels, in_rate, out_rate, options)[source]¶
- Parameters:
method (
GstAudio.AudioResamplerMethod
) – aGstAudio.AudioResamplerMethod
flags (
GstAudio.AudioResamplerFlags
) –GstAudio.AudioResamplerFlags
format (
GstAudio.AudioFormat
) – theGstAudio.AudioFormat
channels (
int
) – the number of channelsin_rate (
int
) – input rateout_rate (
int
) – output rateoptions (
Gst.Structure
) – extra options
- Returns:
The new
GstAudio.AudioResampler
.- Return type:
Make a new resampler.
- classmethod options_set_quality(method, quality, in_rate, out_rate, options)[source]¶
- Parameters:
method (
GstAudio.AudioResamplerMethod
) – aGstAudio.AudioResamplerMethod
quality (
int
) – the qualityin_rate (
int
) – the input rateout_rate (
int
) – the output rateoptions (
Gst.Structure
) – aGst.Structure
Set the parameters for resampling from in_rate to out_rate using method for quality in options.
- free()[source]¶
Free a previously allocated
GstAudio.AudioResampler
self.
- get_in_frames(out_frames)[source]¶
- Parameters:
out_frames (
int
) – number of input frames- Returns:
The number of input frames needed for producing out_frames of data from self.
- Return type:
Get the number of input frames that would currently be needed to produce out_frames from self.
- get_max_latency()[source]¶
- Returns:
the latency of self as expressed in the number of frames.
- Return type:
Get the maximum number of input samples that the resampler would need before producing output.
- get_out_frames(in_frames)[source]¶
- Parameters:
in_frames (
int
) – number of input frames- Returns:
The number of frames that would be available after giving in_frames as input to self.
- Return type:
Get the number of output frames that would be currently available when in_frames are given to self.
- resample(in_, in_frames, out, out_frames)[source]¶
- Parameters:
Perform resampling on in_frames frames in in and write out_frames 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
None
, in which case in_frames of silence samples are pushed into the resampler.This function always produces out_frames of output and consumes in_frames of input. Use
GstAudio.AudioResampler.get_out_frames
() andGstAudio.AudioResampler.get_in_frames
() to make sure in_frames and out_frames are matching and in and out point to enough memory.
- reset()[source]¶
Reset self to the state it was when it was first created, discarding all sample history.
- update(in_rate, out_rate, options)[source]¶
- Parameters:
in_rate (
int
) – new input rateout_rate (
int
) – new output rateoptions (
Gst.Structure
) – new options orNone
- Returns:
True
if the new parameters could be set- Return type:
Update the resampler parameters for self. This function should not be called concurrently with any other function on self.
When in_rate or out_rate is 0, its value is unchanged.
When options is
None
, the previously configured options are reused.