gi-gstaudio-1.0.27: GStreamerAudio bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.GstAudio.Functions

Description

 
Synopsis

Methods

audioChannelGetFallbackMask

audioChannelGetFallbackMask Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Int32

channels: the number of channels

-> m Word64

Returns: a fallback channel-mask for channels or 0 when there is no mask and mono.

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.

Since: 1.8

audioChannelPositionsFromMask

audioChannelPositionsFromMask Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word64

channelMask: The input channel_mask

-> [AudioChannelPosition]

position: The GstAudioChannelPositions

-> m Bool

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

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

audioChannelPositionsToMask

audioChannelPositionsToMask Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> [AudioChannelPosition]

position: The GstAudioChannelPositions

-> Bool

forceOrder: Only consider the GStreamer channel order.

-> m (Bool, Word64)

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

Convert the position array of channels channels to a bitmask.

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

audioChannelPositionsToString

audioChannelPositionsToString Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> [AudioChannelPosition]

position: The GstAudioChannelPositions to convert.

-> m Text

Returns: a newly allocated string representing position

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

Since: 1.10

audioChannelPositionsToValidOrder

audioChannelPositionsToValidOrder Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> [AudioChannelPosition]

position: The channel positions to reorder to.

-> m Bool

Returns: True if the channel positions are valid and reordering was successful.

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

audioCheckValidChannelPositions

audioCheckValidChannelPositions Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> [AudioChannelPosition]

position: The GstAudioChannelPositions to check.

-> Bool

forceOrder: Only consider the GStreamer channel order.

-> m Bool

Returns: True if the channel positions are valid.

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

audioClippingMetaApiGetType

audioClippingMetaApiGetType :: (HasCallStack, MonadIO m) => m GType Source #

No description available in the introspection data.

audioDownmixMetaApiGetType

audioDownmixMetaApiGetType :: (HasCallStack, MonadIO m) => m GType Source #

No description available in the introspection data.

audioFormatInfoGetType

audioFormatInfoGetType :: (HasCallStack, MonadIO m) => m GType Source #

No description available in the introspection data.

audioFormatsRaw

audioFormatsRaw Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m [AudioFormat]

Returns: an array of AudioFormat

Return all the raw audio formats supported by GStreamer.

Since: 1.18

audioGetChannelReorderMap

audioGetChannelReorderMap Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> [AudioChannelPosition]

from: The channel positions to reorder from.

-> [AudioChannelPosition]

to: The channel positions to reorder to.

-> [Int32]

reorderMap: Pointer to the reorder map.

-> m Bool

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

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 reorderMap can be used for reordering by assigning channel i of the input to channel reorder_map[i] of the output.

audioIec61937FrameSize

audioIec61937FrameSize Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AudioRingBufferSpec

spec: the ringbufer spec

-> m Word32

Returns: the size or 0 if the given type is not supported or cannot be payloaded.

Calculated the size of the buffer expected by audioIec61937Payload for payloading type from spec.

audioIec61937Payload

audioIec61937Payload Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> ByteString

src: a buffer containing the data to payload

-> ByteString

dst: the destination buffer to store the payloaded contents in. Should not overlap with src

-> AudioRingBufferSpec

spec: the ringbufer spec for src

-> Int32

endianness: the expected byte order of the payloaded data

-> m Bool

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

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.

audioLevelMetaApiGetType

audioLevelMetaApiGetType Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m GType

Returns: a GType

Return the GType associated with AudioLevelMeta.

Since: 1.20

audioMakeRawCaps

audioMakeRawCaps Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Maybe [AudioFormat]

formats: an array of raw AudioFormat, or Nothing

-> AudioLayout

layout: the layout of audio samples

-> m Caps

Returns: an audio gstCaps

Return a generic raw audio caps for formats defined in formats. If formats is Nothing returns a caps for all the supported raw audio formats, see audioFormatsRaw.

Since: 1.18

audioMetaApiGetType

audioMetaApiGetType :: (HasCallStack, MonadIO m) => m GType Source #

No description available in the introspection data.

audioReorderChannels

audioReorderChannels Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> ByteString

data: The pointer to the memory.

-> AudioFormat

format: The GstAudioFormat of the buffer.

-> [AudioChannelPosition]

from: The channel positions in the buffer.

-> [AudioChannelPosition]

to: The channel positions to convert to.

-> m Bool

Returns: True if the reordering was possible.

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.

Note: this function assumes the audio data is in interleaved layout

bufferAddAudioClippingMeta

bufferAddAudioClippingMeta Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer

-> Format

format: GstFormat of start and stop, GST_FORMAT_DEFAULT is samples

-> Word64

start: Amount of audio to clip from start of buffer

-> Word64

end: Amount of to clip from end of buffer

-> m AudioClippingMeta

Returns: the AudioClippingMeta on buffer.

Attaches AudioClippingMeta metadata to buffer with the given parameters.

Since: 1.8

bufferAddAudioDownmixMeta

bufferAddAudioDownmixMeta Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer

-> [AudioChannelPosition]

fromPosition: the channel positions of the source

-> [AudioChannelPosition]

toPosition: the channel positions of the destination

-> Float

matrix: The matrix coefficients.

-> m AudioDownmixMeta

Returns: the AudioDownmixMeta on buffer.

Attaches AudioDownmixMeta metadata to buffer with the given parameters.

matrix is an two-dimensional array of toChannels times fromChannels 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.

bufferAddAudioLevelMeta

bufferAddAudioLevelMeta Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer

-> Word8

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

-> Bool

voiceActivity: whether the buffer contains voice activity.

-> m (Maybe AudioLevelMeta)

Returns: the AudioLevelMeta on buffer.

Attaches audio level information to buffer. (RFC 6464)

Since: 1.20

bufferAddAudioMeta

bufferAddAudioMeta Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer

-> AudioInfo

info: the audio properties of the buffer

-> Word64

samples: the number of valid samples in the buffer

-> Word64

offsets: the offsets (in bytes) where each channel plane starts in the buffer or Nothing to calculate it (see below); must be Nothing also when info->layout is AudioLayoutInterleaved

-> m AudioMeta

Returns: the AudioMeta that was attached on the buffer

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

When info->layout is AudioLayoutNonInterleaved and offsets is Nothing, 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.

Since: 1.16

bufferGetAudioDownmixMetaForChannels

bufferGetAudioDownmixMetaForChannels Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer

-> [AudioChannelPosition]

toPosition: the channel positions of the destination

-> m AudioDownmixMeta

Returns: the AudioDownmixMeta on buffer.

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

bufferGetAudioLevelMeta

bufferGetAudioLevelMeta Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer

-> m (Maybe AudioLevelMeta)

Returns: the AudioLevelMeta or Nothing when there is no such metadata on buffer.

Find the AudioLevelMeta on buffer.

Since: 1.20