GstAudio.AudioConverter¶
Fields¶
None
Methods¶
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class GstAudio.AudioConverter¶
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
New in version 1.8.
- classmethod new(flags, in_info, out_info, config)[source]¶
- Parameters:
flags (
GstAudio.AudioConverterFlags) – extraGstAudio.AudioConverterFlagsin_info (
GstAudio.AudioInfo) – a sourceGstAudio.AudioInfoout_info (
GstAudio.AudioInfo) – a destinationGstAudio.AudioInfoconfig (
Gst.StructureorNone) – aGst.Structurewith configuration options
- Returns:
a
GstAudio.AudioConverterorNoneif conversion is not possible.- Return type:
Create a new
GstAudio.AudioConverterthat 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.
- convert(flags, in_)[source]¶
- Parameters:
flags (
GstAudio.AudioConverterFlags) – extraGstAudio.AudioConverterFlagsin (
bytes) – input data
- Returns:
Trueis the conversion could be performed.- out:
a pointer where the output data will be written
- Return type:
Convenience wrapper around gst_audio_converter_samples(), which will perform allocation of the output buffer based on the result from
GstAudio.AudioConverter.get_out_frames().New in version 1.14.
- get_config()[source]¶
- Returns:
a
Gst.Structurethat remains valid for as long as self is valid or untilGstAudio.AudioConverter.update_config() is called.- in_rate:
result input rate
- out_rate:
result output rate
- Return type:
(
Gst.Structure, in_rate:int, out_rate:int)
Get the current configuration of self.
- get_in_frames(out_frames)[source]¶
- Parameters:
out_frames (
int) – number of output frames- Returns:
the number of input frames
- Return type:
Calculate how many input frames are currently needed by self to produce out_frames of output frames.
- get_max_latency()[source]¶
- Returns:
the latency of self as expressed in the number of frames.
- Return type:
Get the maximum number of input frames that the converter would need before producing output.
- get_out_frames(in_frames)[source]¶
- Parameters:
in_frames (
int) – number of input frames- Returns:
the number of output frames
- Return type:
Calculate how many output frames can be produced when in_frames input frames are given to self.
- is_passthrough()[source]¶
-
Returns whether the audio converter will operate in passthrough mode. The return value would be typically input to
GstBase.BaseTransform.set_passthrough()New in version 1.16.
- reset()[source]¶
Reset self to the state it was when it was first created, clearing any history it might currently have.
- supports_inplace()[source]¶
-
Returns whether the audio converter can perform the conversion in-place. The return value would be typically input to
GstBase.BaseTransform.set_in_place()New in version 1.12.
- update_config(in_rate, out_rate, config)[source]¶
- Parameters:
in_rate (
int) – input rateout_rate (
int) – output rateconfig (
Gst.StructureorNone) – aGst.StructureorNone
- Returns:
Truewhen the new parameters could be set- Return type:
Set in_rate, out_rate and config as extra configuration for self.
in_rate and out_rate specify the new sample rates of input and output formats. A value of 0 leaves the sample rate unchanged.
config can be
None, in which case, the current configuration is not changed.If the parameters in config can not be set exactly, this function returns
Falseand will try to update as much state as possible. The new state can then be retrieved and refined withGstAudio.AudioConverter.get_config().Look at the
GST_AUDIO_CONVERTER_OPT_*fields to check valid configuration option and values.