Functions

  audio_buffer_clip (buffer, segment, rate, bpf)
  audio_buffer_reorder_channels (buffer, format, from_, to)
  audio_channel_get_fallback_mask (channels)
  audio_channel_positions_from_mask (channel_mask, position)
  audio_channel_positions_to_mask (position, force_order)
  audio_channel_positions_to_string (position)
  audio_channel_positions_to_valid_order (position)
  audio_check_valid_channel_positions (position, force_order)
  audio_clipping_meta_api_get_type ()
  audio_clipping_meta_get_info ()
  audio_downmix_meta_api_get_type ()
  audio_downmix_meta_get_info ()
  audio_format_build_integer (sign, endianness, width, depth)
  audio_format_fill_silence (info, dest)
  audio_format_from_string (format)
  audio_format_get_info (format)
  audio_format_info_get_type ()
  audio_format_to_string (format)
  audio_get_channel_reorder_map (from_, to, reorder_map)
  audio_iec61937_frame_size (spec)
  audio_iec61937_payload (src, dst, spec, endianness)
  audio_reorder_channels (data, format, from_, to)
  audio_resampler_new (method, flags, format, channels, in_rate, out_rate, options)
  audio_resampler_options_set_quality (method, quality, in_rate, out_rate, options)
  buffer_add_audio_clipping_meta (buffer, format, start, end)
  buffer_add_audio_downmix_meta (buffer, from_position, to_position, matrix)
  buffer_get_audio_downmix_meta_for_channels (buffer, to_position)
  stream_volume_convert_volume (from_, to, val)

Details

GstAudio.audio_buffer_clip(buffer, segment, rate, bpf)[source]
Parameters:
Returns:

None if the buffer is completely outside the configured segment, otherwise the clipped buffer is returned.

If the buffer has no timestamp, it is assumed to be inside the segment and is not clipped

Return type:

Gst.Buffer

Clip the buffer to the given Gst.Segment.

After calling this function the caller does not own a reference to buffer anymore.

GstAudio.audio_buffer_reorder_channels(buffer, format, from_, to)[source]
Parameters:
Returns:

True if the reordering was possible.

Return type:

bool

Reorders buffer from the channel positions from to the channel positions to. from and to must contain the same number of positions and the same positions, only in a different order. buffer must be writable.

GstAudio.audio_channel_get_fallback_mask(channels)[source]
Parameters:channels (int) – the number of channels
Returns:a fallback channel-mask for channels or 0 when there is no mask and mono.
Return type:int

Get the fallback channel-mask for the given number of channels.

This function returns a reasonable fallback channel-mask and should be called as a last resort when the specific channel map is unknown.

New in version 1.8.

GstAudio.audio_channel_positions_from_mask(channel_mask, position)[source]
Parameters:
Returns:

True if channel and channel mask are valid and could be converted

Return type:

bool

Convert the channels present in channel_mask to a position array (which should have at least channels entries ensured by caller). If channel_mask is set to 0, it is considered as ‘not present’ for purpose of conversion. A partially valid channel_mask with less bits set than the number of channels is considered valid.

GstAudio.audio_channel_positions_to_mask(position, force_order)[source]
Parameters:
Returns:

True if the channel positions are valid and could be converted.

channel_mask:the output channel mask

Return type:

(bool, channel_mask: int)

Convert the position array of channels channels to a bitmask.

If force_order is True it additionally checks if the channels are in the order required by GStreamer.

GstAudio.audio_channel_positions_to_string(position)[source]
Parameters:position ([GstAudio.AudioChannelPosition]) – The GstAudio.AudioChannelPositions to convert.
Returns:a newly allocated string representing position
Return type:str

Converts position to a human-readable string representation for debugging purposes.

GstAudio.audio_channel_positions_to_valid_order(position)[source]
Parameters:position ([GstAudio.AudioChannelPosition]) – The channel positions to reorder to.
Returns:True if the channel positions are valid and reordering was successful.
Return type:bool

Reorders the channel positions in position from any order to the GStreamer channel order.

GstAudio.audio_check_valid_channel_positions(position, force_order)[source]
Parameters:
Returns:

True if the channel positions are valid.

Return type:

bool

Checks if position contains valid channel positions for channels channels. If force_order is True it additionally checks if the channels are in the order required by GStreamer.

GstAudio.audio_clipping_meta_api_get_type()[source]
Return type:GObject.GType
GstAudio.audio_clipping_meta_get_info()[source]
Return type:Gst.MetaInfo
GstAudio.audio_downmix_meta_api_get_type()[source]
Return type:GObject.GType
GstAudio.audio_downmix_meta_get_info()[source]
Return type:Gst.MetaInfo
GstAudio.audio_format_build_integer(sign, endianness, width, depth)[source]
Parameters:
Returns:

a GstAudio.AudioFormat or GstAudio.AudioFormat.UNKNOWN when no audio format exists with the given parameters.

Return type:

GstAudio.AudioFormat

Construct a GstAudio.AudioFormat with given parameters.

GstAudio.audio_format_fill_silence(info, dest)[source]
Parameters:

Fill length bytes in dest with silence samples for info.

GstAudio.audio_format_from_string(format)[source]
Parameters:format (str) – a format string
Returns:the GstAudio.AudioFormat for format or GstAudio.AudioFormat.UNKNOWN when the string is not a known format.
Return type:GstAudio.AudioFormat

Convert the format string to its GstAudio.AudioFormat.

GstAudio.audio_format_get_info(format)[source]
Parameters:format (GstAudio.AudioFormat) – a GstAudio.AudioFormat
Returns:The GstAudio.AudioFormatInfo for format.
Return type:GstAudio.AudioFormatInfo

Get the GstAudio.AudioFormatInfo for format

GstAudio.audio_format_info_get_type()[source]
Return type:GObject.GType
GstAudio.audio_format_to_string(format)[source]
Parameters:format (GstAudio.AudioFormat) –
Return type:str
GstAudio.audio_get_channel_reorder_map(from_, to, reorder_map)[source]
Parameters:
Returns:

True if the channel positions are valid and reordering is possible.

Return type:

bool

Returns a reorder map for from to to that can be used in custom channel reordering code, e.g. to convert from or to the GStreamer channel order. from and to must contain the same number of positions and the same positions, only in a different order.

The resulting reorder_map can be used for reordering by assigning channel i of the input to channel reorder_map[i] of the output.

GstAudio.audio_iec61937_frame_size(spec)[source]
Parameters:spec (GstAudio.AudioRingBufferSpec) – the ringbufer spec
Returns:the size or 0 if the given type is not supported or cannot be payloaded.
Return type:int

Calculated the size of the buffer expected by GstAudio.audio_iec61937_payload() for payloading type from spec.

GstAudio.audio_iec61937_payload(src, dst, spec, endianness)[source]
Parameters:
  • src (bytes) – a buffer containing the data to payload
  • dst (bytes) – the destination buffer to store the payloaded contents in. Should not overlap with src
  • spec (GstAudio.AudioRingBufferSpec) – the ringbufer spec for src
  • endianness (int) – the expected byte order of the payloaded data
Returns:

transfer-full: True if the payloading was successful, False otherwise.

Return type:

bool

Payloads src in the form specified by IEC 61937 for the type from spec and stores the result in dst. src must contain exactly one frame of data and the frame is not checked for errors.

GstAudio.audio_reorder_channels(data, format, from_, to)[source]
Parameters:
Returns:

True if the reordering was possible.

Return type:

bool

Reorders data from the channel positions from to the channel positions to. from and to must contain the same number of positions and the same positions, only in a different order.

GstAudio.audio_resampler_new(method, flags, format, channels, in_rate, out_rate, options)[source]
Parameters:
Returns:

True on success

Return type:

GstAudio.AudioResampler

Make a new resampler.

GstAudio.audio_resampler_options_set_quality(method, quality, in_rate, out_rate, options)[source]
Parameters:

Set the parameters for resampling from in_rate to out_rate using method for quality in options.

GstAudio.buffer_add_audio_clipping_meta(buffer, format, start, end)[source]
Parameters:
Returns:

the GstAudio.AudioClippingMeta on buffer.

Return type:

GstAudio.AudioClippingMeta

Attaches GstAudio.AudioClippingMeta metadata to buffer with the given parameters.

New in version 1.8.

GstAudio.buffer_add_audio_downmix_meta(buffer, from_position, to_position, matrix)[source]
Parameters:
Returns:

the GstAudio.AudioDownmixMeta on buffer.

Return type:

GstAudio.AudioDownmixMeta

Attaches GstAudio.AudioDownmixMeta metadata to buffer with the given parameters.

matrix is an two-dimensional array of to_channels times from_channels coefficients, i.e. the i-th output channels is constructed by multiplicating the input channels with the coefficients in matrix[i] and taking the sum of the results.

GstAudio.buffer_get_audio_downmix_meta_for_channels(buffer, to_position)[source]
Parameters:
Returns:

the GstAudio.AudioDownmixMeta on buffer.

Return type:

GstAudio.AudioDownmixMeta

Find the GstAudio.AudioDownmixMeta on buffer for the given destination channel positions.

GstAudio.stream_volume_convert_volume(from_, to, val)[source]
Parameters:
Returns:

the converted volume

Return type:

float