MPEG.TS.Muxer (MPEG.TS v3.2.3)

View Source

Module responsible for muxing acces units into mpeg-ts packets.

Summary

Functions

Mux the PAT table into a packet.

Mux a PCR packet.

Mux the PMT table into a packet.

Mux a generic PSI into a packet.

Create a new muxer.

Types

t()

@type t() :: %MPEG.TS.Muxer{
  continuity_counters: %{required(MPEG.TS.Packet.pid_t()) => 0..15},
  pat: MPEG.TS.PAT.t(),
  pat_version: pos_integer(),
  pid_to_stream_id: %{required(MPEG.TS.Packet.pid_t()) => non_neg_integer()},
  pmt: MPEG.TS.PMT.t(),
  pmt_version: pos_integer()
}

Functions

add_elementary_stream(muxer, stream_type, opts \\ [])

@spec add_elementary_stream(t(), atom(), Keyword.t()) :: {MPEG.TS.Packet.pid_t(), t()}

Add a new elementary stream.

mux_pat(muxer)

@spec mux_pat(t()) :: {MPEG.TS.Packet.t(), t()}

Mux the PAT table into a packet.

mux_pcr(muxer, pcr)

@spec mux_pcr(t(), MPEG.TS.timestamp_ns()) :: {MPEG.TS.Packet.t(), t()}

Mux a PCR packet.

mux_pmt(muxer)

@spec mux_pmt(t()) :: {MPEG.TS.Packet.t(), t()}

Mux the PMT table into a packet.

mux_psi(muxer, pid, psi)

@spec mux_psi(t(), MPEG.TS.Packet.pid_t(), MPEG.TS.PSI.t()) ::
  {MPEG.TS.Packet.t(), t()}

Mux a generic PSI into a packet.

mux_sample(muxer, pid, payload, pts, opts \\ [])

@spec mux_sample(
  t(),
  MPEG.TS.Packet.pid_t(),
  iodata(),
  MPEG.TS.timestamp_ns(),
  keyword()
) :: {[MPEG.TS.Packet.t()], t()}

Mux a media sample.

The following optional options may be provided:

  • :sync? - whether the sample is a sync sample (keyframe). Default: false
  • :send_pcr? - whether to send a PCR with this sample. Default: false
  • :dts - the decoding timestamp of the sample (in nanoseconds). Default: nil

Timestamps are in nanoseconds.

new()

@spec new() :: t()

Create a new muxer.