View Source Membrane.RTP.H264.NAL.Header (Membrane RTP H264 Plugin v0.19.2)

Defines a structure representing Network Abstraction Layer Unit Header

Defined in RFC 6184

  +---------------+
  |0|1|2|3|4|5|6|7|
  +-+-+-+-+-+-+-+-+
  |F|NRI|  Type   |
  +---------------+

Summary

Types

NRI stands for nal_ref_idc. This value represents importance of frame that is being parsed.

t()

Specifies the type of RBSP data structure contained in the NAL unit.

Functions

Adds NAL header to payload

Parses type stored in NAL Header

Encodes given NAL type

Types

@type nri() :: 0..3

NRI stands for nal_ref_idc. This value represents importance of frame that is being parsed.

The higher the value the more important frame is (for example key frames have nri value of 3) and a value of 00 indicates that the content of the NAL unit is not used to reconstruct reference pictures for inter picture prediction. NAL units with NRI equal 0 can be discarded without risking the integrity of the reference pictures, although these payloads might contain metadata.

@type supported_types() :: :stap_a | :fu_a | :single_nalu
@type t() :: %Membrane.RTP.H264.NAL.Header{nal_ref_idc: nri(), type: type()}
@type type() :: 1..31

Specifies the type of RBSP data structure contained in the NAL unit.

Types are defined as follows.

IDRBSP Type
0Unspecified
1-23NAL unit types
24STAP-A
25STAP-B
26MTAP-16
27MTAP-24
28FU-A
29FU-B
Reserved30-31

RBSP stands for Raw Byte Sequence Payload

RBSP types are described in detail here

@type types() :: supported_types() | unsupported_types() | :reserved
@type unsupported_types() :: :stap_b | :mtap_16 | :mtap_24 | :fu_b

Functions

Link to this function

add_header(payload, f, nri, type)

View Source
@spec add_header(binary(), 0 | 1, nri(), type()) :: binary()

Adds NAL header to payload

@spec decode_type(t()) :: types()

Parses type stored in NAL Header

@spec encode_type(types()) :: type()

Encodes given NAL type

Link to this function

parse_unit_header(raw_nal)

View Source
@spec parse_unit_header(binary()) ::
  {:error, :malformed_data} | {:ok, {t(), binary()}}