| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Data.MediaBus.Conduit.SyncStream
Description
Conduits that remove or set the sequence numbers and time stamps in
Streams. The functions in this module lift the functions in SyncStreams
to conduits.
- assumeSynchronizedC :: (Monad m, KnownRate r, HasDuration d, Num s, CanBeTicks r t) => ConduitM (SyncStream i p d) (Stream i s (Ticks r t) p d) m ()
- setSequenceNumberAndTimestampC :: (Monad m, KnownRate r, HasDuration d, Num s, CanBeTicks r t) => ConduitM (SyncStream i p d) (Stream i s (Ticks r t) p d) m ()
- convertTimestampC :: forall proxy0 proxy1 m r t r' t' i s c p. (NFData t, NFData t', CanBeTicks r t, CanBeTicks r' t', Monad m, NFData t') => proxy0 '(r, t) -> proxy1 '(r', t') -> Conduit (Stream i s (Ticks r t) p c) m (Stream i s (Ticks r' t') p c)
- setTimestampFromDurationsC :: forall m r t a. (Monad m, CanBeTicks r t, HasDuration a, HasTimestamp a, GetTimestamp a ~ ()) => Ticks r t -> Conduit a m (SetTimestamp a (Ticks r t))
- removeTimestampC :: (Monad m, HasTimestamp a) => Conduit a m (SetTimestamp a ())
Documentation
assumeSynchronizedC :: (Monad m, KnownRate r, HasDuration d, Num s, CanBeTicks r t) => ConduitM (SyncStream i p d) (Stream i s (Ticks r t) p d) m () Source #
Remove the sequence numbers and time stamps from a Stream.
It's much more explicit to use a SyncStream instead of a Stream.
For example, when a library function aggregates Frames but doesn't regard
the sequence numbers and time stamps, using SyncStream indicates to users
of that library, that the function does not handle any gaps and/or out of order
packages or discrepancies in the time stamps and e.g. frame durations.
The user then knows, that she has to add functions to that conduit to accomodate for that.
This functions is strict and uses assumeSynchronized
under the hood.
setSequenceNumberAndTimestampC :: (Monad m, KnownRate r, HasDuration d, Num s, CanBeTicks r t) => ConduitM (SyncStream i p d) (Stream i s (Ticks r t) p d) m () Source #
Assign sequence numbers and timestamps to the Frames in a SyncStream,
starting both the sequence number and timestamp at 0.
This functions is strict and uses setSequenceNumberAndTimestamp
under the hood.
Inorder to calculate only the timestamp of a stream use
setTimestampFromDurationsC.
convertTimestampC :: forall proxy0 proxy1 m r t r' t' i s c p. (NFData t, NFData t', CanBeTicks r t, CanBeTicks r' t', Monad m, NFData t') => proxy0 '(r, t) -> proxy1 '(r', t') -> Conduit (Stream i s (Ticks r t) p c) m (Stream i s (Ticks r' t') p c) Source #
Recalculate all timestamps in a Stream. This function is strict in its arguments.
setTimestampFromDurationsC :: forall m r t a. (Monad m, CanBeTicks r t, HasDuration a, HasTimestamp a, GetTimestamp a ~ ()) => Ticks r t -> Conduit a m (SetTimestamp a (Ticks r t)) Source #
Set the timestamp of each element in the conduit.
The timestamp of each element is calculated from the sum of the durations of
the previous elements and the start time stamp t0.
The input elements must be instances of HasTimestamp but with the important
condition, that the input timestamp is always unit i.e. ().
This prevents meaningful timestamps from being overwritten.
Use removeTimestampC to explicitly remove a timestamp.
removeTimestampC :: (Monad m, HasTimestamp a) => Conduit a m (SetTimestamp a ()) Source #
Explicitly remove a timestamp, by setting the timestamp to ().