View Source ExMP4.Track.SampleTable (MP4 Reader and Writer v0.1.0)
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 &ExMP4.Track.SampleTable.reverse/1
when it's known that no more samples will be stored.
Summary
Types
@type t() :: %ExMP4.Track.SampleTable{ chunk: [binary()], chunk_first_dts: non_neg_integer() | nil, chunk_offsets: [non_neg_integer()], chunk_sample_index: non_neg_integer(), composition_offsets: [ %{sample_composition_offset: Ratio.t(), sample_count: pos_integer()} ], decoding_deltas: [%{sample_delta: Ratio.t(), sample_count: pos_integer()}], elapsed_duration: non_neg_integer(), last_dts: non_neg_integer() | nil, sample_count: non_neg_integer(), sample_index: non_neg_integer(), sample_size: non_neg_integer(), sample_sizes: [pos_integer()], samples_per_chunk: [ %{first_chunk: pos_integer(), sample_count: pos_integer()} ], sync_samples: [pos_integer()] }
Functions
@spec chunk_duration(t()) :: ExMP4.duration()
@spec flush_chunk(t(), non_neg_integer()) :: {binary(), t()}
@spec store_sample(t(), ExMP4.Sample.t()) :: t()