View Source Membrane.RTP.PayloadFormat (Membrane RTP format v0.11.0)

This module contains utilities for resolving RTP default payload types, encoding names, clock rates and (de)payloaders.

Summary

Functions

Returns payload format registered for given encoding name.

Returns encoding name and clock rate for given payload type, if registered.

Registers payload format.

Registers default encoding name and clock rate for a dynamic payload_type

Quality of life function that makes best effort resolution of PayloadFormat, payload type and clock rate based on provided arguments. Prefers provided values over registered defaults.

Types

payload_type_mapping()

@type payload_type_mapping() :: %{
  required(Membrane.RTP.payload_type()) => %{
    encoding_name: Membrane.RTP.encoding_name(),
    clock_rate: Membrane.RTP.clock_rate()
  }
}

t()

@type t() :: %Membrane.RTP.PayloadFormat{
  depayloader: module() | nil,
  encoding_name: Membrane.RTP.encoding_name(),
  frame_detector: (binary() -> boolean()) | nil,
  keyframe_detector: (binary() -> boolean()) | nil,
  payload_type: Membrane.RTP.payload_type() | nil,
  payloader: module() | nil
}

Functions

get(encoding_name)

@spec get(Membrane.RTP.encoding_name()) :: t()

Returns payload format registered for given encoding name.

get_payload_type_mapping(payload_type)

@spec get_payload_type_mapping(Membrane.RTP.payload_type()) :: %{
  optional(:encoding_name) => Membrane.RTP.encoding_name(),
  optional(:clock_rate) => Membrane.RTP.clock_rate()
}

Returns encoding name and clock rate for given payload type, if registered.

register(payload_format)

@spec register(t()) :: :ok | no_return()

Registers payload format.

Raises if some payload format field was already registered and set to different value.

register_payload_type_mapping(payload_type, encoding_name, clock_rate)

@spec register_payload_type_mapping(
  Membrane.RTP.dynamic_payload_type(),
  Membrane.RTP.encoding_name(),
  Membrane.RTP.clock_rate()
) :: :ok | no_return()

Registers default encoding name and clock rate for a dynamic payload_type

resolve(args)

@spec resolve(
  encoding_name: Membrane.RTP.encoding_name() | nil,
  payload_type: Membrane.RTP.payload_type() | nil,
  clock_rate: Membrane.RTP.clock_rate() | nil,
  payload_type_mapping: payload_type_mapping() | nil
) :: %{
  payload_format: t() | nil,
  payload_type: Membrane.RTP.payload_type() | nil,
  clock_rate: Membrane.RTP.clock_rate() | nil
}

Quality of life function that makes best effort resolution of PayloadFormat, payload type and clock rate based on provided arguments. Prefers provided values over registered defaults.