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.Structs.AudioStreamAlign

Contents

Description

AudioStreamAlign provides a helper object that helps tracking audio stream alignment and discontinuities, and detects discontinuities if possible.

See audioStreamAlignNew for a description of its parameters and audioStreamAlignProcess for the details of the processing.

Since: 1.14

Synopsis

Exported types

newtype AudioStreamAlign Source #

Memory-managed wrapper type.

Methods

copy

audioStreamAlignCopy Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AudioStreamAlign

align: a AudioStreamAlign

-> m AudioStreamAlign

Returns: a new AudioStreamAlign. free with gst_audio_stream_align_free.

Copy a GstAudioStreamAlign structure.

Since: 1.14

free

audioStreamAlignFree Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AudioStreamAlign

align: a AudioStreamAlign

-> m () 

Free a GstAudioStreamAlign structure previously allocated with audioStreamAlignNew or audioStreamAlignCopy.

Since: 1.14

getAlignmentThreshold

audioStreamAlignGetAlignmentThreshold Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AudioStreamAlign

align: a AudioStreamAlign

-> m Word64

Returns: The currently configured alignment threshold

Gets the currently configured alignment threshold.

Since: 1.14

getDiscontWait

audioStreamAlignGetDiscontWait Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AudioStreamAlign

align: a AudioStreamAlign

-> m Word64

Returns: The currently configured discont wait

Gets the currently configured discont wait.

Since: 1.14

getRate

audioStreamAlignGetRate Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AudioStreamAlign

align: a AudioStreamAlign

-> m Int32

Returns: The currently configured sample rate

Gets the currently configured sample rate.

Since: 1.14

getSamplesSinceDiscont

audioStreamAlignGetSamplesSinceDiscont Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AudioStreamAlign

align: a AudioStreamAlign

-> m Word64

Returns: The number of samples processed since the last discontinuity.

Returns the number of samples that were processed since the last discontinuity was detected.

Since: 1.14

getTimestampAtDiscont

audioStreamAlignGetTimestampAtDiscont Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AudioStreamAlign

align: a AudioStreamAlign

-> m Word64

Returns: The last timestamp at when a discontinuity was detected

Timestamp that was passed when a discontinuity was detected, i.e. the first timestamp after the discontinuity.

Since: 1.14

markDiscont

audioStreamAlignMarkDiscont Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AudioStreamAlign

align: a AudioStreamAlign

-> m () 

Marks the next buffer as discontinuous and resets timestamp tracking.

Since: 1.14

new

audioStreamAlignNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Int32

rate: a sample rate

-> Word64

alignmentThreshold: a alignment threshold in nanoseconds

-> Word64

discontWait: discont wait in nanoseconds

-> m AudioStreamAlign

Returns: a new AudioStreamAlign. free with audioStreamAlignFree.

Allocate a new AudioStreamAlign with the given configuration. All processing happens according to sample rate rate, until audioStreamAlignSetRate is called with a new rate. A negative rate can be used for reverse playback.

alignmentThreshold gives the tolerance in nanoseconds after which a timestamp difference is considered a discontinuity. Once detected, discontWait nanoseconds have to pass without going below the threshold again until the output buffer is marked as a discontinuity. These can later be re-configured with audioStreamAlignSetAlignmentThreshold and audioStreamAlignSetDiscontWait.

Since: 1.14

process

audioStreamAlignProcess Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AudioStreamAlign

align: a AudioStreamAlign

-> Bool

discont: if this data is considered to be discontinuous

-> Word64

timestamp: a GstClockTime of the start of the data

-> Word32

nSamples: number of samples to process

-> m (Bool, Word64, Word64, Word64)

Returns: True if a discontinuity was detected, False otherwise.

Processes data with timestamp and nSamples, and returns the output timestamp, duration and sample position together with a boolean to signal whether a discontinuity was detected or not. All non-discontinuous data will have perfect timestamps and durations.

A discontinuity is detected once the difference between the actual timestamp and the timestamp calculated from the sample count since the last discontinuity differs by more than the alignment threshold for a duration longer than discont wait.

Note: In reverse playback, every buffer is considered discontinuous in the context of buffer flags because the last sample of the previous buffer is discontinuous with the first sample of the current one. However for this function they are only considered discontinuous in reverse playback if the first sample of the previous buffer is discontinuous with the last sample of the current one.

Since: 1.14

setAlignmentThreshold

audioStreamAlignSetAlignmentThreshold Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AudioStreamAlign

align: a AudioStreamAlign

-> Word64

alignmentThreshold: a new alignment threshold

-> m () 

Sets alignmentTreshold as new alignment threshold for the following processing.

Since: 1.14

setDiscontWait

audioStreamAlignSetDiscontWait Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AudioStreamAlign

align: a AudioStreamAlign

-> Word64

discontWait: a new discont wait

-> m () 

Sets alignmentTreshold as new discont wait for the following processing.

Since: 1.14

setRate

audioStreamAlignSetRate Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AudioStreamAlign

align: a AudioStreamAlign

-> Int32

rate: a new sample rate

-> m () 

Sets rate as new sample rate for the following processing. If the sample rate differs this implicitely marks the next data as discontinuous.

Since: 1.14