ebml-0.1.0.0: A pure EBML parser
Safe HaskellSafe-Inferred
LanguageGHC2021

Codec.EBML

Description

This module is intended to be imported qualified:

import qualified Codec.EBML as EBML

Decode a webm file with:

EBML.decodeWebMFile "path/file.webm"

Split a webm stream segments with:

let streamReader = EBML.newStreamReader
buf <- acquire data
EBML.feedReader buf streamReader

References:

Synopsis

WebM decoder

data WebMDocument Source #

A WebM document.

Constructors

WebMDocument 

Fields

  • timestampScale :: Word64

    Base unit for Segment Ticks and Track Ticks, in nanoseconds. A TimestampScale of 1_000_000 means segments' timestamps are expressed in milliseconds;

  • clusters :: [WebMCluster]

    The list of clusters.

data WebMCluster Source #

A WebM cluster, e.g. a media segment.

Constructors

WebMCluster 

Fields

Raw EBML decoder

webmSchemas :: [EBMLSchema] Source #

The webm document schemas.

EBML stream reader

data StreamReader Source #

Create a stream reader with newStreamReader, and decode media segments with feedReader.

newStreamReader :: StreamReader Source #

Initialize a stream reader.

data StreamFrame Source #

A valid frame that can be served.

Constructors

StreamFrame 

Fields

feedReader :: ByteString -> StreamReader -> Either Text (Maybe StreamFrame, StreamReader) Source #

Feed data into a stream reader. Returns either an error, or maybe a new StreamFrame and an updated StreamReader.

EBML data types

newtype EBMLDocument Source #

EBML document structure, including the Header and Body Root.

Constructors

EBMLDocument [EBMLElement] 

data EBMLElement Source #

EBML element.

Constructors

EBMLElement 

Instances

Instances details
Show EBMLElement Source # 
Instance details

Defined in Codec.EBML.Element

Eq EBMLElement Source # 
Instance details

Defined in Codec.EBML.Element

data EBMLValue Source #

EBML element value.

Instances

Instances details
Show EBMLValue Source # 
Instance details

Defined in Codec.EBML.Element

Eq EBMLValue Source # 
Instance details

Defined in Codec.EBML.Element

data EBMLElementHeader Source #

EBML element header.

Constructors

EBMLElementHeader 

Fields

newtype EBMLID Source #

EBML element id.

Constructors

EBMLID Word32 

Instances

Instances details
Num EBMLID Source # 
Instance details

Defined in Codec.EBML.Element

Show EBMLID Source # 
Instance details

Defined in Codec.EBML.Element

Eq EBMLID Source # 
Instance details

Defined in Codec.EBML.Element

Methods

(==) :: EBMLID -> EBMLID -> Bool #

(/=) :: EBMLID -> EBMLID -> Bool #

Ord EBMLID Source # 
Instance details

Defined in Codec.EBML.Element

EBML schema data types

data EBMLSchema Source #

EBML schema definition.

Note that this is missing:

  • min/max occurrence constraint.
  • default value.
  • element path.

Constructors

EBMLSchema 

Fields

Helpers

decodeEBMLFile :: [EBMLSchema] -> FilePath -> IO (Either Text EBMLDocument) Source #

Decode a raw EBML file.

Low-level API, mostly for testing

compileSchemas :: [EBMLSchema] -> EBMLSchemas Source #

Combine a list of schema for decoder.