View Source Membrane.H26x.NALuSplitter (Membrane H.264 and H.265 plugin v0.10.2)

A module with functions responsible for splitting the H26x streams into the NAL units.

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.NALuParser.parse/4.

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.