gi-gstaudio-1.0.20: GStreamerAudio bindings

CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (inaki@blueleaf.cc)
Safe HaskellNone
LanguageHaskell2010

GI.GstAudio.Callbacks

Contents

Description

 
Synopsis

Signals

AudioBaseSinkCustomSlavingCallback

type AudioBaseSinkCustomSlavingCallback Source #

Arguments

 = AudioBaseSink

sink: a AudioBaseSink

-> Word64

etime: external clock time

-> Word64

itime: internal clock time

-> Int64

requestedSkew: skew amount requested by the callback

-> AudioBaseSinkDiscontReason

discontReason: reason for discontinuity (if any)

-> IO () 

This function is set with audioBaseSinkSetCustomSlavingCallback and is called during playback. It receives the current time of external and internal clocks, which the callback can then use to apply any custom slaving/synchronization schemes.

The external clock is the sink's element clock, the internal one is the internal audio clock. The internal audio clock's calibration is applied to the timestamps before they are passed to the callback. The difference between etime and itime is the skew; how much internal and external clock lie apart from each other. A skew of 0 means both clocks are perfectly in sync. itime > etime means the external clock is going slower, while itime < etime means it is going faster than the internal clock. etime and itime are always valid timestamps, except for when a discontinuity happens.

requested_skew is an output value the callback can write to. It informs the sink of whether or not it should move the playout pointer, and if so, by how much. This pointer is only NULL if a discontinuity occurs; otherwise, it is safe to write to *requested_skew. The default skew is 0.

The sink may experience discontinuities. If one happens, discont is TRUE, itime, etime are set to GST_CLOCK_TIME_NONE, and requested_skew is NULL. This makes it possible to reset custom clock slaving algorithms when a discontinuity happens.

Since: 1.6

type AudioBaseSinkCustomSlavingCallback_WithClosures Source #

Arguments

 = AudioBaseSink

sink: a AudioBaseSink

-> Word64

etime: external clock time

-> Word64

itime: internal clock time

-> Int64

requestedSkew: skew amount requested by the callback

-> AudioBaseSinkDiscontReason

discontReason: reason for discontinuity (if any)

-> Ptr ()

userData: user data

-> IO () 

This function is set with audioBaseSinkSetCustomSlavingCallback and is called during playback. It receives the current time of external and internal clocks, which the callback can then use to apply any custom slaving/synchronization schemes.

The external clock is the sink's element clock, the internal one is the internal audio clock. The internal audio clock's calibration is applied to the timestamps before they are passed to the callback. The difference between etime and itime is the skew; how much internal and external clock lie apart from each other. A skew of 0 means both clocks are perfectly in sync. itime > etime means the external clock is going slower, while itime < etime means it is going faster than the internal clock. etime and itime are always valid timestamps, except for when a discontinuity happens.

requested_skew is an output value the callback can write to. It informs the sink of whether or not it should move the playout pointer, and if so, by how much. This pointer is only NULL if a discontinuity occurs; otherwise, it is safe to write to *requested_skew. The default skew is 0.

The sink may experience discontinuities. If one happens, discont is TRUE, itime, etime are set to GST_CLOCK_TIME_NONE, and requested_skew is NULL. This makes it possible to reset custom clock slaving algorithms when a discontinuity happens.

Since: 1.6

type C_AudioBaseSinkCustomSlavingCallback = Ptr AudioBaseSink -> Word64 -> Word64 -> Int64 -> CUInt -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

dynamic_AudioBaseSinkCustomSlavingCallback Source #

Arguments

:: (HasCallStack, MonadIO m, IsAudioBaseSink a) 
=> FunPtr C_AudioBaseSinkCustomSlavingCallback 
-> a

sink: a AudioBaseSink

-> Word64

etime: external clock time

-> Word64

itime: internal clock time

-> Int64

requestedSkew: skew amount requested by the callback

-> AudioBaseSinkDiscontReason

discontReason: reason for discontinuity (if any)

-> Ptr ()

userData: user data

-> m () 

Given a pointer to a foreign C function, wrap it into a function callable from Haskell.

AudioClockGetTimeFunc

type AudioClockGetTimeFunc Source #

Arguments

 = Clock

clock: the AudioClock

-> IO Word64

Returns: the current time or CLOCK_TIME_NONE if the previous time should be used.

This function will be called whenever the current clock time needs to be calculated. If this function returns CLOCK_TIME_NONE, the last reported time will be returned by the clock.

type AudioClockGetTimeFunc_WithClosures Source #

Arguments

 = Clock

clock: the AudioClock

-> Ptr ()

userData: user data

-> IO Word64

Returns: the current time or CLOCK_TIME_NONE if the previous time should be used.

This function will be called whenever the current clock time needs to be calculated. If this function returns CLOCK_TIME_NONE, the last reported time will be returned by the clock.

type C_AudioClockGetTimeFunc = Ptr Clock -> Ptr () -> IO Word64 Source #

Type for the callback on the (unwrapped) C side.

dynamic_AudioClockGetTimeFunc Source #

Arguments

:: (HasCallStack, MonadIO m, IsClock a) 
=> FunPtr C_AudioClockGetTimeFunc 
-> a

clock: the AudioClock

-> Ptr ()

userData: user data

-> m Word64

Returns: the current time or CLOCK_TIME_NONE if the previous time should be used.

Given a pointer to a foreign C function, wrap it into a function callable from Haskell.

mk_AudioClockGetTimeFunc :: C_AudioClockGetTimeFunc -> IO (FunPtr C_AudioClockGetTimeFunc) Source #

Generate a function pointer callable from C code, from a C_AudioClockGetTimeFunc.

AudioFormatPack

type AudioFormatPack Source #

Arguments

 = AudioFormatInfo

info: a AudioFormatInfo

-> [AudioPackFlags]

flags: AudioPackFlags

-> Ptr Word8

src: a source array

-> Ptr Word8

data: pointer to the destination data

-> Int32

length: the amount of samples to pack.

-> IO () 

Packs length samples from src to the data array in format info. The samples from source have each channel interleaved and will be packed into data.

type C_AudioFormatPack = Ptr AudioFormatInfo -> CUInt -> Ptr Word8 -> Ptr Word8 -> Int32 -> IO () Source #

Type for the callback on the (unwrapped) C side.

dynamic_AudioFormatPack Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> FunPtr C_AudioFormatPack 
-> AudioFormatInfo

info: a AudioFormatInfo

-> [AudioPackFlags]

flags: AudioPackFlags

-> Ptr Word8

src: a source array

-> Ptr Word8

data: pointer to the destination data

-> Int32

length: the amount of samples to pack.

-> m () 

Given a pointer to a foreign C function, wrap it into a function callable from Haskell.

mk_AudioFormatPack :: C_AudioFormatPack -> IO (FunPtr C_AudioFormatPack) Source #

Generate a function pointer callable from C code, from a C_AudioFormatPack.

AudioFormatUnpack

type AudioFormatUnpack Source #

Arguments

 = AudioFormatInfo

info: a AudioFormatInfo

-> [AudioPackFlags]

flags: AudioPackFlags

-> Ptr Word8

dest: a destination array

-> Ptr Word8

data: pointer to the audio data

-> Int32

length: the amount of samples to unpack.

-> IO () 

Unpacks length samples from the given data of format info. The samples will be unpacked into dest which each channel interleaved. dest should at least be big enough to hold length * channels * size(unpack_format) bytes.

type C_AudioFormatUnpack = Ptr AudioFormatInfo -> CUInt -> Ptr Word8 -> Ptr Word8 -> Int32 -> IO () Source #

Type for the callback on the (unwrapped) C side.

dynamic_AudioFormatUnpack Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> FunPtr C_AudioFormatUnpack 
-> AudioFormatInfo

info: a AudioFormatInfo

-> [AudioPackFlags]

flags: AudioPackFlags

-> Ptr Word8

dest: a destination array

-> Ptr Word8

data: pointer to the audio data

-> Int32

length: the amount of samples to unpack.

-> m () 

Given a pointer to a foreign C function, wrap it into a function callable from Haskell.

mk_AudioFormatUnpack :: C_AudioFormatUnpack -> IO (FunPtr C_AudioFormatUnpack) Source #

Generate a function pointer callable from C code, from a C_AudioFormatUnpack.

AudioRingBufferCallback

type AudioRingBufferCallback Source #

Arguments

 = AudioRingBuffer

rbuf: a AudioRingBuffer

-> ByteString

data: target to fill

-> IO () 

This function is set with gst_audio_ring_buffer_set_callback() and is called to fill the memory at data with len bytes of samples.

type AudioRingBufferCallback_WithClosures Source #

Arguments

 = AudioRingBuffer

rbuf: a AudioRingBuffer

-> ByteString

data: target to fill

-> Ptr ()

userData: user data

-> IO () 

This function is set with gst_audio_ring_buffer_set_callback() and is called to fill the memory at data with len bytes of samples.

type C_AudioRingBufferCallback = Ptr AudioRingBuffer -> Ptr Word8 -> Word32 -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

dynamic_AudioRingBufferCallback Source #

Arguments

:: (HasCallStack, MonadIO m, IsAudioRingBuffer a) 
=> FunPtr C_AudioRingBufferCallback 
-> a

rbuf: a AudioRingBuffer

-> ByteString

data: target to fill

-> Ptr ()

userData: user data

-> m () 

Given a pointer to a foreign C function, wrap it into a function callable from Haskell.