Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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
- newtype AudioStreamAlign = AudioStreamAlign (ManagedPtr AudioStreamAlign)
- audioStreamAlignCopy :: (HasCallStack, MonadIO m) => AudioStreamAlign -> m AudioStreamAlign
- audioStreamAlignFree :: (HasCallStack, MonadIO m) => AudioStreamAlign -> m ()
- audioStreamAlignGetAlignmentThreshold :: (HasCallStack, MonadIO m) => AudioStreamAlign -> m Word64
- audioStreamAlignGetDiscontWait :: (HasCallStack, MonadIO m) => AudioStreamAlign -> m Word64
- audioStreamAlignGetRate :: (HasCallStack, MonadIO m) => AudioStreamAlign -> m Int32
- audioStreamAlignGetSamplesSinceDiscont :: (HasCallStack, MonadIO m) => AudioStreamAlign -> m Word64
- audioStreamAlignGetTimestampAtDiscont :: (HasCallStack, MonadIO m) => AudioStreamAlign -> m Word64
- audioStreamAlignMarkDiscont :: (HasCallStack, MonadIO m) => AudioStreamAlign -> m ()
- audioStreamAlignNew :: (HasCallStack, MonadIO m) => Int32 -> Word64 -> Word64 -> m AudioStreamAlign
- audioStreamAlignProcess :: (HasCallStack, MonadIO m) => AudioStreamAlign -> Bool -> Word64 -> Word32 -> m (Bool, Word64, Word64, Word64)
- audioStreamAlignSetAlignmentThreshold :: (HasCallStack, MonadIO m) => AudioStreamAlign -> Word64 -> m ()
- audioStreamAlignSetDiscontWait :: (HasCallStack, MonadIO m) => AudioStreamAlign -> Word64 -> m ()
- audioStreamAlignSetRate :: (HasCallStack, MonadIO m) => AudioStreamAlign -> Int32 -> m ()
Exported types
newtype AudioStreamAlign Source #
Memory-managed wrapper type.
AudioStreamAlign (ManagedPtr AudioStreamAlign) |
Instances
Eq AudioStreamAlign Source # | |
Defined in GI.GstAudio.Structs.AudioStreamAlign (==) :: AudioStreamAlign -> AudioStreamAlign -> Bool # (/=) :: AudioStreamAlign -> AudioStreamAlign -> Bool # | |
GBoxed AudioStreamAlign Source # | |
Defined in GI.GstAudio.Structs.AudioStreamAlign | |
ManagedPtrNewtype AudioStreamAlign Source # | |
Defined in GI.GstAudio.Structs.AudioStreamAlign toManagedPtr :: AudioStreamAlign -> ManagedPtr AudioStreamAlign | |
TypedObject AudioStreamAlign Source # | |
Defined in GI.GstAudio.Structs.AudioStreamAlign | |
HasParentTypes AudioStreamAlign Source # | |
Defined in GI.GstAudio.Structs.AudioStreamAlign | |
IsGValue (Maybe AudioStreamAlign) Source # | Convert |
Defined in GI.GstAudio.Structs.AudioStreamAlign gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe AudioStreamAlign -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe AudioStreamAlign) | |
type ParentTypes AudioStreamAlign Source # | |
Defined in GI.GstAudio.Structs.AudioStreamAlign |
Methods
Click to display all available methods, including inherited ones
Methods
copy, free, markDiscont, process.
Getters
getAlignmentThreshold, getDiscontWait, getRate, getSamplesSinceDiscont, getTimestampAtDiscont.
Setters
copy
:: (HasCallStack, MonadIO m) | |
=> AudioStreamAlign |
|
-> m AudioStreamAlign | Returns: a new |
Copy a GstAudioStreamAlign structure.
Since: 1.14
free
:: (HasCallStack, MonadIO m) | |
=> AudioStreamAlign |
|
-> m () |
Free a GstAudioStreamAlign structure previously allocated with audioStreamAlignNew
or audioStreamAlignCopy
.
Since: 1.14
getAlignmentThreshold
audioStreamAlignGetAlignmentThreshold Source #
:: (HasCallStack, MonadIO m) | |
=> AudioStreamAlign |
|
-> m Word64 | Returns: The currently configured alignment threshold |
Gets the currently configured alignment threshold.
Since: 1.14
getDiscontWait
audioStreamAlignGetDiscontWait Source #
:: (HasCallStack, MonadIO m) | |
=> AudioStreamAlign |
|
-> m Word64 | Returns: The currently configured discont wait |
Gets the currently configured discont wait.
Since: 1.14
getRate
audioStreamAlignGetRate Source #
:: (HasCallStack, MonadIO m) | |
=> AudioStreamAlign |
|
-> m Int32 | Returns: The currently configured sample rate |
Gets the currently configured sample rate.
Since: 1.14
getSamplesSinceDiscont
audioStreamAlignGetSamplesSinceDiscont Source #
:: (HasCallStack, MonadIO m) | |
=> 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 #
:: (HasCallStack, MonadIO m) | |
=> 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 #
:: (HasCallStack, MonadIO m) | |
=> AudioStreamAlign |
|
-> m () |
Marks the next buffer as discontinuous and resets timestamp tracking.
Since: 1.14
new
:: (HasCallStack, MonadIO m) | |
=> Int32 |
|
-> Word64 |
|
-> Word64 |
|
-> m AudioStreamAlign | Returns: a new |
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 #
:: (HasCallStack, MonadIO m) | |
=> AudioStreamAlign |
|
-> Bool |
|
-> Word64 |
|
-> Word32 |
|
-> m (Bool, Word64, Word64, Word64) | Returns: |
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 #
:: (HasCallStack, MonadIO m) | |
=> AudioStreamAlign |
|
-> Word64 |
|
-> m () |
Sets alignmentTreshold
as new alignment threshold for the following processing.
Since: 1.14
setDiscontWait
audioStreamAlignSetDiscontWait Source #
:: (HasCallStack, MonadIO m) | |
=> AudioStreamAlign |
|
-> Word64 |
|
-> m () |
Sets alignmentTreshold
as new discont wait for the following processing.
Since: 1.14
setRate
audioStreamAlignSetRate Source #
:: (HasCallStack, MonadIO m) | |
=> AudioStreamAlign |
|
-> Int32 |
|
-> m () |
Sets rate
as new sample rate for the following processing. If the sample
rate differs this implicitly marks the next data as discontinuous.
Since: 1.14