Safe Haskell | None |
---|---|
Language | Haskell2010 |
A single-track AAC audio streaming utility wrapping AudioFile
for
streaming via e.g. DASH.
- data Segment = Segment !Word32 !Word64 !ByteString
- newtype InitSegment = InitSegment ByteString
- data StreamingContext
- data AacMp4StreamConfig = AacMp4StreamConfig !(TS32 "creation_time") !String !Bool !SamplingFreqTable !ChannelConfigTable
- data AacMp4TrackFragment = AacMp4TrackFragment !Word32 !Word64 ![(Word32, ByteString)]
- numberOfChannels :: Num a => StreamingContext -> a
- buildAacMp4TrackFragment :: AacMp4TrackFragment -> Builder
- buildAacMp4StreamInit :: AacMp4StreamConfig -> Builder
- getStreamConfig :: StreamingContext -> AacMp4StreamConfig
- getStreamBaseTime :: StreamingContext -> Word64
- getStreamSequence :: StreamingContext -> Word32
- addToBaseTime :: StreamingContext -> NominalDiffTime -> StreamingContext
- getSegmentDuration :: StreamingContext -> NominalDiffTime
- streamInitINTERNAL_TESTING :: String -> NominalDiffTime -> Bool -> SamplingFreqTable -> ChannelConfigTable -> IO (InitSegment, StreamingContext)
- streamInitUtc :: String -> UTCTime -> UTCTime -> NominalDiffTime -> Bool -> SamplingFreqTable -> ChannelConfigTable -> (InitSegment, StreamingContext)
- streamNextSample :: Word32 -> ByteString -> StreamingContext -> (Maybe Segment, StreamingContext)
- streamFlush :: StreamingContext -> (Maybe Segment, StreamingContext)
Documentation
data StreamingContext Source #
Contains a sample in the ISO14496 style interpretation, i.e. a smallish buffer of e.g. 20ms audio data or a single video frame. A sample has some kind of time or at least order associated to it. TODO not right now, add it
Also a sample has a duration measured as the sampleCount. TODO make this a real data type, and possible refactor this to be a seperate issue from filling stream gaps and determining the offsets and the decoding time stamp.
Contains the configuration and state for the creation of a DASH audio stream.
data AacMp4StreamConfig Source #
Initialisation segment parameters of an aac audio stream mp4 file.
AacMp4StreamConfig !(TS32 "creation_time") !String !Bool !SamplingFreqTable !ChannelConfigTable |
data AacMp4TrackFragment Source #
Media fragment segment parameters of an aac audio stream mp4 file.
AacMp4TrackFragment !Word32 !Word64 ![(Word32, ByteString)] |
numberOfChannels :: Num a => StreamingContext -> a Source #
buildAacMp4TrackFragment :: AacMp4TrackFragment -> Builder Source #
Convert a 'AacMp4TrackFragment record to a generic Boxes
collection.
buildAacMp4StreamInit :: AacMp4StreamConfig -> Builder Source #
Convert a AacMp4StreamConfig
record to a generic Boxes
collection.
getStreamConfig :: StreamingContext -> AacMp4StreamConfig Source #
Return the AacMp4StreamConfig
from an StreamingContext
getStreamBaseTime :: StreamingContext -> Word64 Source #
Return the current base decoding time
getStreamSequence :: StreamingContext -> Word32 Source #
Return the current sequence number
streamInitINTERNAL_TESTING :: String -> NominalDiffTime -> Bool -> SamplingFreqTable -> ChannelConfigTable -> IO (InitSegment, StreamingContext) Source #
Initiate the StreamingContext
and create the MP4 init segment.
This lives in IO
because it read the current time from the real world.
streamInitUtc :: String -> UTCTime -> UTCTime -> NominalDiffTime -> Bool -> SamplingFreqTable -> ChannelConfigTable -> (InitSegment, StreamingContext) Source #
Initiate the StreamingContext
and create the MP4 init segment.
This lives in IO
because it read the current time from the real world.
streamNextSample :: Word32 -> ByteString -> StreamingContext -> (Maybe Segment, StreamingContext) Source #
Enqueue a sample, if enough samples are accumulated, generate the next segment
streamFlush :: StreamingContext -> (Maybe Segment, StreamingContext) Source #
Enqueue a sample, if enough samples are accumulated, generate the next segment