gi-gstaudio-1.0.22: GStreamerAudio bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.GstAudio.Structs.AudioConverter

Description

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
Synopsis

Exported types

newtype AudioConverter Source #

Memory-managed wrapper type.

Constructors

AudioConverter (ManagedPtr AudioConverter) 

Instances

Instances details
Eq AudioConverter Source # 
Instance details

Defined in GI.GstAudio.Structs.AudioConverter

GBoxed AudioConverter Source # 
Instance details

Defined in GI.GstAudio.Structs.AudioConverter

ManagedPtrNewtype AudioConverter Source # 
Instance details

Defined in GI.GstAudio.Structs.AudioConverter

TypedObject AudioConverter Source # 
Instance details

Defined in GI.GstAudio.Structs.AudioConverter

Methods

glibType :: IO GType

IsGValue AudioConverter Source #

Convert AudioConverter to and from GValue with toGValue and fromGValue.

Instance details

Defined in GI.GstAudio.Structs.AudioConverter

Methods

toGValue :: AudioConverter -> IO GValue

fromGValue :: GValue -> IO AudioConverter

HasParentTypes AudioConverter Source # 
Instance details

Defined in GI.GstAudio.Structs.AudioConverter

type ParentTypes AudioConverter Source # 
Instance details

Defined in GI.GstAudio.Structs.AudioConverter

type ParentTypes AudioConverter = '[] :: [Type]

Methods

Overloaded methods

convert

audioConverterConvert Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AudioConverter

convert: a AudioConverter

-> [AudioConverterFlags]

flags: extra AudioConverterFlags

-> ByteString

in: input data

-> m (Bool, ByteString)

Returns: True is the conversion could be performed.

Convenience wrapper around audioConverterSamples, which will perform allocation of the output buffer based on the result from audioConverterGetOutFrames.

Since: 1.14

free

audioConverterFree Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AudioConverter

convert: a AudioConverter

-> m () 

Free a previously allocated convert instance.

getConfig

audioConverterGetConfig Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AudioConverter

convert: a AudioConverter

-> m (Structure, Int32, Int32)

Returns: a Structure that remains valid for as long as convert is valid or until audioConverterUpdateConfig is called.

Get the current configuration of convert.

getInFrames

audioConverterGetInFrames Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AudioConverter

convert: a AudioConverter

-> Word64

outFrames: number of output frames

-> m Word64

Returns: the number of input frames

Calculate how many input frames are currently needed by convert to produce outFrames of output frames.

getMaxLatency

audioConverterGetMaxLatency Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AudioConverter

convert: a AudioConverter

-> m Word64

Returns: the latency of convert as expressed in the number of frames.

Get the maximum number of input frames that the converter would need before producing output.

getOutFrames

audioConverterGetOutFrames Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AudioConverter

convert: a AudioConverter

-> Word64

inFrames: number of input frames

-> m Word64

Returns: the number of output frames

Calculate how many output frames can be produced when inFrames input frames are given to convert.

isPassthrough

audioConverterIsPassthrough Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AudioConverter 
-> m Bool

Returns: True when no conversion will actually occur.

Returns whether the audio converter will operate in passthrough mode. The return value would be typically input to baseTransformSetPassthrough

Since: 1.16

new

audioConverterNew Source #

Arguments

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

flags: extra AudioConverterFlags

-> AudioInfo

inInfo: a source AudioInfo

-> AudioInfo

outInfo: a destination AudioInfo

-> Maybe Structure

config: a Structure with configuration options

-> m AudioConverter

Returns: a AudioConverter or Nothing if conversion is not possible.

Create a new AudioConverter that 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.

reset

audioConverterReset Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AudioConverter

convert: a AudioConverter

-> m () 

Reset convert to the state it was when it was first created, clearing any history it might currently have.

samples

audioConverterSamples Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AudioConverter

convert: a AudioConverter

-> [AudioConverterFlags]

flags: extra AudioConverterFlags

-> Ptr ()

in: input frames

-> Word64

inFrames: number of input frames

-> Ptr ()

out: output frames

-> Word64

outFrames: number of output frames

-> m Bool

Returns: True is the conversion could be performed.

Perform the conversion with inFrames in in to outFrames in out using convert.

In case the samples are interleaved, in and out must point to an array with a single element pointing to a block of interleaved samples.

If non-interleaved samples are used, in and out must point to an array with pointers to memory blocks, one for each channel.

in may be Nothing, in which case inFrames of silence samples are processed by the converter.

This function always produces outFrames of output and consumes inFrames of input. Use audioConverterGetOutFrames and audioConverterGetInFrames to make sure inFrames and outFrames are matching and in and out point to enough memory.

supportsInplace

audioConverterSupportsInplace Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AudioConverter

convert: a AudioConverter

-> m Bool

Returns: True when the conversion can be done in place.

Returns whether the audio converter can perform the conversion in-place. The return value would be typically input to baseTransformSetInPlace

updateConfig

audioConverterUpdateConfig Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AudioConverter

convert: a AudioConverter

-> Int32

inRate: input rate

-> Int32

outRate: output rate

-> Maybe Structure

config: a Structure or Nothing

-> m Bool

Returns: True when the new parameters could be set

Set inRate, outRate and config as extra configuration for convert.

inRate and outRate specify the new sample rates of input and output formats. A value of 0 leaves the sample rate unchanged.

config can be Nothing, in which case, the current configuration is not changed.

If the parameters in config can not be set exactly, this function returns False and will try to update as much state as possible. The new state can then be retrieved and refined with audioConverterGetConfig.

Look at the GST_AUDIO_CONVERTER_OPT_* fields to check valid configuration option and values.