View Source Membrane.H264.Parser.NALuSplitter (Membrane H264 plugin v0.9.2)

A module with functions responsible for splitting the h264 stream into the NAL units.

The splitting is based on "Annex B" of the "ITU-T Rec. H.264 (01/2012)".

Summary

Types

t()

A structure holding the state of the NALu splitter.

Functions

Returns a structure holding a NALu splitter state.

Splits the binary into NALus sequence.

Types

@opaque t()

A structure holding the state of the NALu splitter.

Functions

Link to this function

new(input_stream_structure \\ :annexb, initial_binary \\ <<>>)

View Source
@spec new(Membrane.H264.Parser.stream_structure(), initial_binary :: binary()) :: t()

Returns a structure holding a NALu splitter state.

The input_stream_structure determines which prefix is considered as delimiting two NALUs. By default, the inner unparsed_payload of the state is clean, but can be set to a given binary.

Link to this function

split(payload, assume_nalu_aligned \\ false, state)

View Source
@spec split(payload :: binary(), assume_nalu_aligned :: boolean(), state :: t()) ::
  {[binary()], t()}

Splits the binary into NALus sequence.

Takes a binary h264 stream as an input and produces a list of binaries, where each binary is a complete NALu that can be passed to the Membrane.H264.Parser.NALuParser.parse/2.

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