ExMP4.Box.Traf (MP4 Reader and Writer v0.11.0)

View Source

A module representing an traf box.

Summary

Functions

Get the total duration of the track fragment.

Get the next sample from the fragment.

Get the count of samples of the track fragment.

Get the total size of the track fragment.

Types

t()

@type t() :: %ExMP4.Box.Traf{
  tfdt: ExMP4.Box.Tfdt.t() | nil,
  tfhd: ExMP4.Box.Tfhd.t(),
  trun: [ExMP4.Box.Trun.t()]
}

Functions

duration(traf, trex \\ nil)

@spec duration(t(), ExMP4.Box.Trex.t() | nil) :: integer()

Get the total duration of the track fragment.

finalize(traf, base_is_moof? \\ false)

@spec finalize(t(), boolean()) :: t()

next_sample(traf, trex, duration)

@spec next_sample(t(), ExMP4.Box.Trex.t(), integer()) ::
  {t(), ExMP4.SampleMetadata.t()}

Get the next sample from the fragment.

The trex argument is the trex box that contains global defaults.

The duration refers to the total duration of the extracted samples. This field should be updated by the caller and provided in each call.

It returns a tuple with the first element being the traf box after removing the sample entry and the second element as the sample metadata.

sample_count(traf)

@spec sample_count(t()) :: integer()

Get the count of samples of the track fragment.

store_sample(traf, sample)

@spec store_sample(t(), ExMP4.Sample.t()) :: t()

total_size(traf, trex \\ nil)

@spec total_size(t(), ExMP4.Box.Trex.t() | nil) :: integer()

Get the total size of the track fragment.

update_base_offset(traf, base_offset, trun_data_offset \\ 0)

@spec update_base_offset(t(), integer(), integer()) :: t()