Membrane.H26x.NALuParser.SchemeParser (Membrane H.264 and H.265 plugin v0.10.5)
View SourceThe module providing functions to parse the binary, based on the given Scheme.
Summary
Types
A type describing the field types which can be used in NALu scheme definition.
A type defining the state of the scheme parser.
This type defines a value provider which provides values used in further processing of a parser.
Functions
Returns the local part of the state.
Returns a new SchemeParser.State struct instance.
Parses the binary stream representing a NALu, based on the scheme definition.
Types
@type field() :: :u1 | :u2 | :u3 | :u4 | :u5 | :u8 | :u16 | :u16 | {:uv, value_provider(integer())} | :ue | :se
A type describing the field types which can be used in NALu scheme definition.
Defined as in: "7.2 Specification of syntax functions, categories, and descriptors" of the "ITU-T Rec. H.264 (01/2012)".
@opaque t()
A type defining the state of the scheme parser.
The parser preserves its state in the map, which consists of two parts:
- a map under the
:__global__key - it contains information fetched from a NALu, which might be needed during the parsing of the following NALus. - a map under the
:__local__key - it holds information valid during a time of a single NALu processing, and it's cleaned after the NALu is completely parsed. All information fetched from binary part is put into the:__local__map. If some information needs to be available when other binary part is parsed, it needs to be stored in the map under the:__global__key of the parser's state, which can be done i.e. with thesave_as_global_statestatements of the scheme syntax.
@type value_provider(return_type) :: return_type | {(... -> return_type), [any()]}
This type defines a value provider which provides values used in further processing of a parser.
A value provider can be either a hardcoded value, known at the compilation time, or a tuple consisting of a lambda expression and the list of keys mapping to some values in the parser's state. If the value provider is a tuple, then it's first element - the lambda expression- is invoked with the arguments being the values of the fields which are available in the parser's state under the key names given in the parser's state, and the value used in the further processing is the value returned by that lambda expression.
Functions
Returns the local part of the state.
Returns a new SchemeParser.State struct instance.
The new state's local state is clear. If the State is provided
as an argument, the new state's __global__ state is copied from
the argument. Otherwise, it is set to the clear state.
Parses the binary stream representing a NALu, based on the scheme definition.
Returns the remaining bitstring and the stated updated with the information fetched from the NALu.