Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module contains functions and types for reframing the sequence number
and timestamps of Frame
s.
This means that this module will allow you to record a set of incoming
frames using pushFrame
. Whenever you want to extract the timing and
sequence number information of the next frame with a given duration,
use generateFrame
.
- initialReframerState :: (Num d, Num s) => ReframerSt s d
- runReframer :: Monad m => ReframerT m s d a -> ReframerSt s d -> m (a, ReframerSt s d)
- pushStartFrame :: (Num d, Monad m) => d -> ReframerT m s d ()
- pushFrame :: (Num d, Monad m, Eq d, Ord d) => Frame s d d -> ReframerT m s d (Maybe PushFrameError)
- data PushFrameError
- nextFrameAvailableDuration :: (Num d, Monad m) => ReframerT m s d d
- nextFrameTimestamp :: (Num d, Monad m) => ReframerT m s d d
- generateFrame :: (Num s, Num d, Monad m, Eq d, Ord d, Show d) => d -> ReframerT m s d (Frame s d d)
- type ReframerT m s d a = StateT (ReframerSt s d) m a
- data ReframerSt s d
- data ReframeError s d = MkReframeError String (Maybe d) (ReframerSt s d)
- mkReFrameError :: Monad m => String -> Maybe d -> ReframerT m s d (ReframeError s d)
Documentation
initialReframerState :: (Num d, Num s) => ReframerSt s d Source #
Create an empty initial state.
runReframer :: Monad m => ReframerT m s d a -> ReframerSt s d -> m (a, ReframerSt s d) Source #
Run state ReframerSt
state transformer.
pushStartFrame :: (Num d, Monad m) => d -> ReframerT m s d () Source #
Reset the current timing and sequence number, and start with the given start time.
pushFrame :: (Num d, Monad m, Eq d, Ord d) => Frame s d d -> ReframerT m s d (Maybe PushFrameError) Source #
Increase the available duration by the duration in the frame, iff the
timestamp of the given frame matches exactly the timestamp after the end
of the available period, otherwise do nothing with the state and return
True
.
data PushFrameError Source #
Specifies in what way pushFrame
failed
InputFrameIsLate | The input frame ends before |
InputFrameOverlaps | The input frame starts before, and ends after |
InputFrameIsEarly | The input frame begins after |
nextFrameAvailableDuration :: (Num d, Monad m) => ReframerT m s d d Source #
Return the duration of the frames recorded with pushFrame
.
nextFrameTimestamp :: (Num d, Monad m) => ReframerT m s d d Source #
Return the timestamp of the frame being build. .
generateFrame :: (Num s, Num d, Monad m, Eq d, Ord d, Show d) => d -> ReframerT m s d (Frame s d d) Source #
Try to create a frame with the given duration, and update the state
accordingly, the actual duration, that was available is
put into the payload field of the frame returned.
The start time stamp of the next frame
is always incremented by the wantedDureation
regardless of wether it was
available.
type ReframerT m s d a = StateT (ReframerSt s d) m a Source #
The ReframerSt
StateT
transformer
data ReframeError s d Source #
The exception type for encodeLinearToAacC
MkReframeError String (Maybe d) (ReframerSt s d) |
mkReFrameError :: Monad m => String -> Maybe d -> ReframerT m s d (ReframeError s d) Source #
Utility function to generate a ReframeError
with the current state.