View Source Membrane.MP4.Track.SampleTable (Membrane MP4 plugin v0.34.2)

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

@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

Link to this function

chunk_duration(sample_table)

View Source
@spec chunk_duration(t()) :: non_neg_integer()
Link to this function

flush_chunk(sample_table, chunk_offset)

View Source
@spec flush_chunk(t(), non_neg_integer()) :: {binary(), t()}
@spec reverse(t()) :: t()
Link to this function

store_sample(sample_table, buffer)

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