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

Defines a structure representing Network Abstraction Layer Unit Header

Defined in RFC 6184

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

Link to this section 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

Link to this section Types

Specs

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.

Specs

supported_types() :: :stap_a | :fu_a | :single_nalu

Specs

t() :: %Membrane.RTP.H264.NAL.Header{nal_ref_idc: nri(), type: type()}

Specs

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

Specs

types() :: supported_types() | unsupported_types() | :reserved

Specs

unsupported_types() :: :stap_b | :mtap_16 | :mtap_24 | :fu_b

Link to this section Functions

Link to this function

add_header(payload, reserved, nri, type)

View Source

Specs

add_header(binary(), 0 | 1, nri(), type()) :: binary()

Adds NAL header to payload

Specs

decode_type(t()) :: types()

Parses type stored in NAL Header

Specs

encode_type(types()) :: type()

Encodes given NAL type

Link to this function

parse_unit_header(raw_nal)

View Source

Specs

parse_unit_header(binary()) ::
  {:error, :malformed_data} | {:ok, {t(), binary()}}