MOQX.Catalog (moqx v0.8.1)

Copy Markdown View Source

A decoded Common Media Server Data Format catalog.

Unknown fields remain available in raw, allowing deployed catalog variants to evolve without forcing callers back to raw JSON.

Summary

Functions

Decodes one supported catalog into protocol-neutral values.

Returns H.264/AVC tracks ordered from highest to lowest advertised resolution.

Selects the highest-resolution advertised H.264/AVC track.

Builds the protocol-neutral address of one track in this catalog.

Types

decode_option()

@type decode_option() ::
  {:format, :cloudflare | :moqtail_cmsf} | {:namespace, [binary()]}

t()

@type t() :: %MOQX.Catalog{
  common_track_fields: map(),
  format: :cloudflare | :moqtail_cmsf,
  namespace: [binary()] | nil,
  raw: map(),
  streaming_format: non_neg_integer() | nil,
  streaming_format_version: binary() | nil,
  supports_delta_updates: boolean() | nil,
  tracks: [MOQX.Catalog.Track.t()],
  version: non_neg_integer() | nil
}

Functions

decode(payload, options \\ [])

@spec decode(binary(), [decode_option()]) ::
  {:ok, t()} | {:error, MOQX.Catalog.Error.t()}

Decodes one supported catalog into protocol-neutral values.

Protocol implementations pass their expected :format explicitly. Standalone callers may omit it and use shape inference.

h264_tracks(catalog)

@spec h264_tracks(t()) :: [MOQX.Catalog.Track.t()]

Returns H.264/AVC tracks ordered from highest to lowest advertised resolution.

select_h264(catalog)

@spec select_h264(t()) ::
  {:ok, MOQX.Catalog.Track.t()} | {:error, :h264_track_not_found}

Selects the highest-resolution advertised H.264/AVC track.

track_ref(catalog, track)

@spec track_ref(t(), MOQX.Catalog.Track.t()) :: MOQX.TrackRef.t()

Builds the protocol-neutral address of one track in this catalog.