Membrane.MP4.Track.SampleTable (Membrane MP4 plugin v0.36.1)

View Source

A module that defines a structure and functions allowing to store samples, assemble them into chunks and flush when needed. Its public functions take care of recording information required to build a sample table.

For performance reasons, the module uses prepends when storing information about new samples. To compensate for it, use &Membrane.MP4.Track.SampleTable.reverse/1 when it's known that no more samples will be stored.

Summary

Types

t()

@type t() :: %Membrane.MP4.Track.SampleTable{
  chunk: [binary()],
  chunk_first_dts: non_neg_integer() | nil,
  chunk_offsets: [non_neg_integer()],
  composition_offsets: [
    %{sample_composition_offset: Ratio.t(), sample_count: pos_integer()}
  ],
  decoding_deltas: [%{sample_delta: Ratio.t(), sample_count: pos_integer()}],
  last_dts: non_neg_integer() | nil,
  sample_count: non_neg_integer(),
  sample_description: struct(),
  sample_sizes: [pos_integer()],
  samples_per_chunk: [
    %{first_chunk: pos_integer(), sample_count: pos_integer()}
  ],
  sync_samples: [pos_integer()],
  timescale: pos_integer()
}

Functions

chunk_duration(sample_table)

@spec chunk_duration(t()) :: non_neg_integer()

flush_chunk(sample_table, chunk_offset)

@spec flush_chunk(t(), non_neg_integer()) :: {binary(), t()}

reverse(sample_table)

@spec reverse(t()) :: t()

store_sample(sample_table, buffer)

@spec store_sample(t(), Membrane.Buffer.t()) :: t()