gi-gstaudio-1.0.15: GStreamerAudio bindings

CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.GstAudio.Functions

Contents

Description

 
Synopsis

Methods

audioBufferClip

audioBufferClip Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: The buffer to clip.

-> Segment

segment: Segment in FormatTime or FormatDefault to which the buffer should be clipped.

-> Int32

rate: sample rate.

-> Int32

bpf: size of one audio frame in bytes. This is the size of one sample * number of channels.

-> m Buffer

Returns: Nothing 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

Clip the buffer to the given GstSegment.

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

audioBufferReorderChannels

audioBufferReorderChannels Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: The buffer to reorder.

-> AudioFormat

format: The GstAudioFormat of the buffer.

-> Int32

channels: The number of channels.

-> [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 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.

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 GstAudioChannelPosition<!-- -->s

-> 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

Since 1.10

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

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.

audioGetChannelReorderMap

audioGetChannelReorderMap Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Int32

channels: The number of channels.

-> [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.

audioReorderChannels

audioReorderChannels Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> ByteString

data: The pointer to the memory.

-> AudioFormat

format: The GstAudioFormat of the buffer.

-> Int32

channels: The number of channels.

-> [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.

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.

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.