Skip to content

Commit 47db0c8

Browse files
committed
more docs
1 parent fc53d86 commit 47db0c8

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/reader.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,15 +424,25 @@ impl Mp4 {
424424
}
425425

426426
pub struct Track {
427+
/// Internal field used when decoding a fragmented MP4 file.
427428
first_traf_merged: bool,
428429

429430
pub width: u16,
430431
pub height: u16,
431432

432433
pub track_id: u32,
434+
435+
/// Timescale of the sample.
436+
///
437+
/// One time unit is equal to `1.0 / timescale` seconds.
433438
pub timescale: u64,
439+
440+
/// Duration of the track in time units.
434441
pub duration: u64,
442+
435443
pub kind: Option<TrackKind>,
444+
445+
/// List of samples in the track.
436446
pub samples: Vec<Sample>,
437447
}
438448

@@ -475,7 +485,11 @@ impl Track {
475485

476486
#[derive(Default, Clone, Copy)]
477487
pub struct Sample {
488+
/// Sample number.
478489
pub id: u32,
490+
491+
/// Whether or not an entire frame can be decoded from this one sample,
492+
/// or if it needs the context of other samples.
479493
pub is_sync: bool,
480494

481495
/// Size of the sample in bytes.
@@ -484,9 +498,20 @@ pub struct Sample {
484498
/// Offset of the sample in bytes from the start of the MP4 file.
485499
pub offset: u64,
486500

501+
/// Timescale of the sample.
502+
///
503+
/// One time unit is equal to `1.0 / timescale` seconds.
487504
pub timescale: u64,
505+
506+
/// Timestamp of the sample at which it should be decoded,
507+
/// in time units.
488508
pub decode_timestamp: u64,
509+
510+
/// Timestamp of the sample at which the sample should be displayed,
511+
/// in time units.
489512
pub composition_timestamp: u64,
513+
514+
/// Duration of the sample in time units.
490515
pub duration: u64,
491516
}
492517

0 commit comments

Comments
 (0)