ISOMedia.Boxes.TrackRun (ISOMedia v0.1.0)

Copy Markdown View Source

Typed view of the trun Track Run box (per-sample list).

Summary

Functions

Decode a trun box.

Encode a %TrackRun{} into a trun box. Always writes data-offset + per-sample duration/size/flags; writes composition offsets (v1, signed) iff any sample has a nonzero offset. Writes first_sample_flags (32-bit, after data_offset) when non-nil.

Types

sample()

@type sample() :: %{
  duration: non_neg_integer() | nil,
  size: non_neg_integer() | nil,
  flags: non_neg_integer() | nil,
  composition_offset: integer() | nil
}

t()

@type t() :: %ISOMedia.Boxes.TrackRun{
  data_offset: integer() | nil,
  first_sample_flags: non_neg_integer() | nil,
  sample_count: non_neg_integer(),
  samples: [sample()],
  version: 0 | 1 | nil
}

Functions

decode(box)

@spec decode(ISOMedia.Box.t()) :: t()

Decode a trun box.

encode(t)

@spec encode(t()) :: ISOMedia.Box.t()

Encode a %TrackRun{} into a trun box. Always writes data-offset + per-sample duration/size/flags; writes composition offsets (v1, signed) iff any sample has a nonzero offset. Writes first_sample_flags (32-bit, after data_offset) when non-nil.