GstAudio meta

GstAudio.AudioDownmixMeta defines an audio downmix matrix to be send along with audio buffers. These functions in this module help to create and attach the meta as well as extracting it.

GstAudio.AudioClippingMeta

Extra buffer metadata describing how much audio has to be clipped from the start or end of a buffer. This is used for compressed formats, where the first frame usually has some additional samples due to encoder and decoder delays, and the last frame usually has some additional samples to be able to fill the complete last frame.

This is used to ensure that decoded data in the end has the same amount of samples, and multiply decoded streams can be gaplessly concatenated.

Note: If clipping of the start is done by adjusting the segment, this meta has to be dropped from buffers as otherwise clipping could happen twice.

Members

meta (Gst.Meta) –

parent Gst.Meta

format (Gst.Format) –

GstFormat of start and stop, GST_FORMAT_DEFAULT is samples

start (int) –

Amount of audio to clip from start of buffer

end (int) –

Amount of to clip from end of buffer

Since : 1.8


Functions

GstAudio.audio_clipping_meta_get_info

def GstAudio.audio_clipping_meta_get_info ():
    #python wrapper for 'gst_audio_clipping_meta_get_info'
Returns (Gst.MetaInfo)
No description available

GstAudio.AudioDownmixMeta

Extra buffer metadata describing audio downmixing matrix. This metadata is attached to audio buffers and contains a matrix to downmix the buffer number of channels to channels.

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.

Members

meta (Gst.Meta) –

parent Gst.Meta

from_position (GstAudio.AudioChannelPosition) –

the channel positions of the source

to_position (GstAudio.AudioChannelPosition) –

the channel positions of the destination

from_channels (int) –

the number of channels of the source

to_channels (int) –

the number of channels of the destination

matrix (float) –

the matrix coefficients.


Functions

GstAudio.audio_downmix_meta_get_info

def GstAudio.audio_downmix_meta_get_info ():
    #python wrapper for 'gst_audio_downmix_meta_get_info'
Returns (Gst.MetaInfo)
No description available

GstAudio.AudioLevelMeta

Meta containing Audio Level Indication: https://tools.ietf.org/html/rfc6464

Members

meta (Gst.Meta) –

parent Gst.Meta

level (int) –

the -dBov from 0-127 (127 is silence).

voice_activity (bool) –

whether the buffer contains voice activity

Since : 1.20


Functions

GstAudio.audio_level_meta_get_info

def GstAudio.audio_level_meta_get_info ():
    #python wrapper for 'gst_audio_level_meta_get_info'

Return the Gst.MetaInfo associated with GstAudio.AudioLevelMeta.

Returns (Gst.MetaInfo)

a Gst.MetaInfo

Since : 1.20


GstAudio.AudioMeta

Buffer metadata describing how data is laid out inside the buffer. This is useful for non-interleaved (planar) buffers, where it is necessary to have a place to store where each plane starts and how long each plane is.

It is a requirement for non-interleaved buffers to have this metadata attached and to be mapped with GstAudio.audio_buffer_map in order to ensure correct handling of clipping and channel reordering.

The different channels in offsets are always in the GStreamer channel order. Zero-copy channel reordering can be implemented by swapping the values in offsets.

It is not allowed for channels to overlap in memory, i.e. for each i in [0, channels), the range [@offsets[i], offsets[i] + samples * sample_stride) must not overlap with any other such range.

It is, however, allowed to have parts of the buffer memory unused, by using offsets and samples in such a way that leave gaps on it. This is used to implement zero-copy clipping in non-interleaved buffers.

Obviously, due to the above, it is not safe to infer the number of valid samples from the size of the buffer. You should always use the samples variable of this metadata.

Note that for interleaved audio it is not a requirement to have this metadata attached and at the moment of writing, there is actually no use case to do so. It is, however, allowed to attach it, for some potential future use case.

Since 1.24 it can be serialized using Gst.Meta.serialize and Gst.meta_deserialize.

Members

meta (Gst.Meta) –

parent Gst.Meta

info (GstAudio.AudioInfo) –

the audio properties of the buffer

samples (int) –

the number of valid samples in the buffer

offsets (int) –

the offsets (in bytes) where each channel plane starts in the buffer or None if the buffer has interleaved layout; if not None, this is guaranteed to be an array of info.channels elements

Since : 1.16


Functions

GstAudio.audio_meta_get_info

def GstAudio.audio_meta_get_info ():
    #python wrapper for 'gst_audio_meta_get_info'
Returns (Gst.MetaInfo)
No description available

Functions

GstAudio.audio_clipping_meta_api_get_type

def GstAudio.audio_clipping_meta_api_get_type ():
    #python wrapper for 'gst_audio_clipping_meta_api_get_type'
Returns (GObject.Type)
No description available

GstAudio.audio_downmix_meta_api_get_type

def GstAudio.audio_downmix_meta_api_get_type ():
    #python wrapper for 'gst_audio_downmix_meta_api_get_type'
Returns (GObject.Type)
No description available

GstAudio.audio_level_meta_api_get_type

def GstAudio.audio_level_meta_api_get_type ():
    #python wrapper for 'gst_audio_level_meta_api_get_type'

Return the GObject.Type associated with GstAudio.AudioLevelMeta.

Returns (GObject.Type)

a GObject.Type

Since : 1.20


GstAudio.audio_meta_api_get_type

def GstAudio.audio_meta_api_get_type ():
    #python wrapper for 'gst_audio_meta_api_get_type'
Returns (GObject.Type)
No description available

GstAudio.buffer_add_audio_clipping_meta

def GstAudio.buffer_add_audio_clipping_meta (buffer, format, start, end):
    #python wrapper for 'gst_buffer_add_audio_clipping_meta'

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

Parameters:

buffer (Gst.Buffer)

a Gst.Buffer

format (Gst.Format)

GstFormat of start and stop, GST_FORMAT_DEFAULT is samples

start (int)

Amount of audio to clip from start of buffer

end (int)

Amount of to clip from end of buffer

Since : 1.8


GstAudio.buffer_add_audio_downmix_meta

def GstAudio.buffer_add_audio_downmix_meta (buffer, from_position, from_channels, to_position, to_channels, matrix):
    #python wrapper for 'gst_buffer_add_audio_downmix_meta'

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.

Parameters:

buffer (Gst.Buffer)

a Gst.Buffer

from_position ([ GstAudio.AudioChannelPosition ])

the channel positions of the source

from_channels (int)

The number of channels of the source

to_position ([ GstAudio.AudioChannelPosition ])

the channel positions of the destination

to_channels (int)

The number of channels of the destination

matrix (float)

The matrix coefficients.


GstAudio.buffer_add_audio_level_meta

def GstAudio.buffer_add_audio_level_meta (buffer, level, voice_activity):
    #python wrapper for 'gst_buffer_add_audio_level_meta'

Attaches audio level information to buffer. (RFC 6464)

Parameters:

buffer (Gst.Buffer)

a Gst.Buffer

level (int)

the -dBov from 0-127 (127 is silence).

voice_activity (bool)

whether the buffer contains voice activity.

Returns (GstAudio.AudioLevelMeta)

the GstAudio.AudioLevelMeta on buffer.

Since : 1.20


GstAudio.buffer_add_audio_meta

def GstAudio.buffer_add_audio_meta (buffer, info, samples, offsets):
    #python wrapper for 'gst_buffer_add_audio_meta'

Allocates and attaches a GstAudio.AudioMeta on buffer, which must be writable for that purpose. The fields of the GstAudio.AudioMeta are directly populated from the arguments of this function.

When info->layout is GstAudio.AudioLayout.NON_INTERLEAVED and offsets is None, the offsets are calculated with a formula that assumes the planes are tightly packed and in sequence: offsets[channel] = channel * samples * sample_stride

It is not allowed for channels to overlap in memory, i.e. for each i in [0, channels), the range [@offsets[i], offsets[i] + samples * sample_stride) must not overlap with any other such range. This function will assert if the parameters specified cause this restriction to be violated.

It is, obviously, also not allowed to specify parameters that would cause out-of-bounds memory access on buffer. This is also checked, which means that you must add enough memory on the buffer before adding this meta.

Parameters:

buffer (Gst.Buffer)

a Gst.Buffer

info (GstAudio.AudioInfo)

the audio properties of the buffer

samples (int)

the number of valid samples in the buffer

offsets (int)

the offsets (in bytes) where each channel plane starts in the buffer or None to calculate it (see below); must be None also when info->layout is GstAudio.AudioLayout.INTERLEAVED

Returns (GstAudio.AudioMeta)

the GstAudio.AudioMeta that was attached on the buffer

Since : 1.16


GstAudio.buffer_get_audio_downmix_meta_for_channels

def GstAudio.buffer_get_audio_downmix_meta_for_channels (buffer, to_position, to_channels):
    #python wrapper for 'gst_buffer_get_audio_downmix_meta_for_channels'

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

Parameters:

buffer (Gst.Buffer)

a Gst.Buffer

to_position ([ GstAudio.AudioChannelPosition ])

the channel positions of the destination

to_channels (int)

The number of channels of the destination


GstAudio.buffer_get_audio_level_meta

def GstAudio.buffer_get_audio_level_meta (buffer):
    #python wrapper for 'gst_buffer_get_audio_level_meta'

Find the GstAudio.AudioLevelMeta on buffer.

Parameters:

buffer (Gst.Buffer)

a Gst.Buffer

Returns (GstAudio.AudioLevelMeta)

the GstAudio.AudioLevelMeta or None when there is no such metadata on buffer.

Since : 1.20


Function Macros

Constants

The results of the search are