mediabus-0.3.2.1: Multimedia streaming on top of Conduit

Safe HaskellNone
LanguageHaskell2010

Data.MediaBus.Media.Reframe

Description

This module contains functions and types for reframing the sequence number and timestamps of Frames.

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.

Synopsis

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.

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 ReframerSt s d Source #

Reframer state.

Instances

(Show s, Show d) => Show (ReframerSt s d) Source # 

Methods

showsPrec :: Int -> ReframerSt s d -> ShowS #

show :: ReframerSt s d -> String #

showList :: [ReframerSt s d] -> ShowS #

data ReframeError s d Source #

The exception type for encodeLinearToAacC

Constructors

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.