View Source Membrane.H264.Parser.AUSplitter (Membrane H264 plugin v0.9.3)

Module providing functionalities to divide the binary h264 stream into access units.

The access unit splitter's behaviour is based on "7.4.1.2.3 Order of NAL units and coded pictures and association to access units" of the "ITU-T Rec. H.264 (01/2012)" specification. The most crucial part of the access unit splitter is the mechanism to detect new primary coded video picture.

WARNING: Our implementation of that mechanism is based on: "7.4.1.2.4 Detection of the first VCL NAL unit of a primary coded picture" of the "ITU-T Rec. H.264 (01/2012)", however it adds one more additional condition which, when satisfied, says that the given VCL NALu is a new primary coded picture. That condition is whether the picture is a keyframe or not.

Summary

Types

A type representing an access unit - a list of logically associated NAL units.

t()

A structure holding a state of the access unit splitter.

Functions

Returns a structure holding a clear state of the access unit splitter.

Splits the given list of NAL units into the access units.

Types

@type access_unit() :: [Membrane.H264.Parser.NALu.t()]

A type representing an access unit - a list of logically associated NAL units.

@opaque t()

A structure holding a state of the access unit splitter.

Functions

@spec new() :: t()

Returns a structure holding a clear state of the access unit splitter.

Link to this function

split(nalus, assume_au_aligned \\ false, state)

View Source
@spec split([Membrane.H264.Parser.NALu.t()], boolean(), t()) :: {[access_unit()], t()}

Splits the given list of NAL units into the access units.

It can be used for a stream which is not completely available at the time of function invocation, as the function updates the state of the access unit splitter - the function can be invoked once more, with new NAL units and the updated state. Under the hood, split/2 defines a finite state machine with two states: :first and :second. The state :first describes the state before reaching the primary coded picture NALu of a given access unit. The state :second describes the state after processing the primary coded picture NALu of a given access unit.

If assume_au_aligned flag is set to true, input is assumed to form a complete set of access units and therefore all of them are returned. Otherwise, the last access unit is not returned until another access unit starts, as it's the only way to prove that the access unit is complete.