pub struct SampleTable {
pub time_to_sample: Vec<TimeToSampleEntry>,
pub sample_to_chunk: Vec<SampleToChunkEntry>,
pub sample_sizes: SampleSizeMode,
pub chunk_offsets: Vec<u64>,
pub sync_samples: Option<BTreeSet<u32>>,
pub timescale: u32,
}Expand description
Complete sample table for one track.
Fields§
§time_to_sample: Vec<TimeToSampleEntry>Time-to-sample entries from stts.
sample_to_chunk: Vec<SampleToChunkEntry>Sample-to-chunk entries from stsc.
sample_sizes: SampleSizeModePer-sample sizes from stsz.
chunk_offsets: Vec<u64>Chunk offsets from stco / co64.
sync_samples: Option<BTreeSet<u32>>Set of sync (key-frame) sample numbers (1-based) from stss.
If None, every sample is a sync sample.
timescale: u32Track timescale (ticks per second).
Implementations§
Source§impl SampleTable
impl SampleTable
Sourcepub fn sample_count_from_stts(&self) -> u64
pub fn sample_count_from_stts(&self) -> u64
Returns the total number of samples described by the stts entries.
Sourcepub fn sample_count(&self) -> u64
pub fn sample_count(&self) -> u64
Returns the total number of samples from the size table.
Sourcepub fn total_duration_ticks(&self) -> u64
pub fn total_duration_ticks(&self) -> u64
Returns the total media duration in timescale units.
Sourcepub fn duration_seconds(&self) -> f64
pub fn duration_seconds(&self) -> f64
Returns the total media duration in seconds.
Sourcepub fn sample_size(&self, sample_number: u32) -> Option<u32>
pub fn sample_size(&self, sample_number: u32) -> Option<u32>
Returns the size of the given sample (1-based index).
Sourcepub fn is_sync_sample(&self, sample_number: u32) -> bool
pub fn is_sync_sample(&self, sample_number: u32) -> bool
Returns true if the given sample (1-based) is a sync sample.
Sourcepub fn nearest_sync_before(&self, sample_number: u32) -> Option<u32>
pub fn nearest_sync_before(&self, sample_number: u32) -> Option<u32>
Finds the nearest sync sample at or before sample_number (1-based).
Sourcepub fn nearest_sync_after(&self, sample_number: u32) -> Option<u32>
pub fn nearest_sync_after(&self, sample_number: u32) -> Option<u32>
Finds the nearest sync sample at or after sample_number (1-based).
Sourcepub fn sample_at_time(&self, ticks: u64) -> Option<u32>
pub fn sample_at_time(&self, ticks: u64) -> Option<u32>
Converts a decode timestamp (in timescale ticks) to a sample number
(1-based). Returns None if the timestamp exceeds the track duration.
Sourcepub fn sample_time(&self, sample_number: u32) -> Option<u64>
pub fn sample_time(&self, sample_number: u32) -> Option<u64>
Returns the decode timestamp (in ticks) of a given sample (1-based).
Sourcepub fn total_data_size(&self) -> u64
pub fn total_data_size(&self) -> u64
Total data size of all samples.
Sourcepub fn average_sample_size(&self) -> f64
pub fn average_sample_size(&self) -> f64
Returns the average sample size in bytes.
Sourcepub fn chunk_count(&self) -> usize
pub fn chunk_count(&self) -> usize
Number of chunk offsets.
Trait Implementations§
Source§impl Clone for SampleTable
impl Clone for SampleTable
Source§fn clone(&self) -> SampleTable
fn clone(&self) -> SampleTable
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more