MediaCodecs.H265.NALU (MediCodecs v0.7.0)

View Source

Struct describing an h265 nalu.

Summary

Functions

Checks if the NALU is a keyframe (IRAP NALU).

Parses a NALU bitstring and returns a NALU struct.

Parses the NALU header.

Gets NALu type.

Checks if the NALU is a Video Coding Layer (VCL) NALU.

Types

nalu_type()

@type nalu_type() ::
  :trail_n
  | :trail_r
  | :tsa_n
  | :tsa_r
  | :stsa_n
  | :stsa_r
  | :radl_n
  | :radl_r
  | :rasl_n
  | :rasl_r
  | :bla_w_lp
  | :bla_w_radl
  | :bla_n_lp
  | :idr_w_radl
  | :idr_n_lp
  | :cra
  | :aud
  | :eos
  | :eob
  | :fd
  | :prefix_sei
  | :suffix_sei
  | :reserved_irap
  | :reserved_nvcl
  | :unspecified

t()

@type t() :: %MediaCodecs.H265.NALU{
  content: struct() | nil,
  nuh_layer_id: non_neg_integer(),
  nuh_temporal_id_plus1: non_neg_integer(),
  type: nalu_type()
}

Functions

keyframe?(nalu)

@spec keyframe?(nalu :: binary() | t()) :: boolean()

Checks if the NALU is a keyframe (IRAP NALU).

iex> MediaCodecs.H265.NALU.keyframe?(%MediaCodecs.H265.NALU{type: :idr_n_lp})
true

iex> MediaCodecs.H265.NALU.keyframe?(%MediaCodecs.H265.NALU{type: :sps})
false

parse(nalu, opts \\ [])

@spec parse(
  nalu :: binary(),
  keyword()
) :: t()

Parses a NALU bitstring and returns a NALU struct.

An optional keyword can be provided to completely parse the NAL unit:

  • :sps - provide the parsed sps NAL unit. Needed for slice parsing.
  • :pps - provide the parsed pps NAL unit. Needed for slice parsing.

parse_header(nalu)

@spec parse_header(nalu :: binary()) :: t()

Parses the NALU header.

type(nalu)

@spec type(nalu :: binary()) :: nalu_type()

Gets NALu type.

vcl?(nalu)

@spec vcl?(nalu :: binary()) :: boolean()

Checks if the NALU is a Video Coding Layer (VCL) NALU.