diff options
| author | Felix Kaaman <tmtu@tmtu.ee> | 2021-01-07 20:32:49 +0100 |
|---|---|---|
| committer | Felix Kaaman <tmtu@tmtu.ee> | 2021-01-07 20:32:49 +0100 |
| commit | 9e6e4962f2346a3fbd96ab3e6c331858ef6ec0d1 (patch) | |
| tree | 14b580295f71243def9c8df9c242c33f9f2c66a8 /src/boxes/stbl.rs | |
| download | fmp4-9e6e4962f2346a3fbd96ab3e6c331858ef6ec0d1.tar.gz fmp4-9e6e4962f2346a3fbd96ab3e6c331858ef6ec0d1.zip | |
Diffstat (limited to 'src/boxes/stbl.rs')
| -rw-r--r-- | src/boxes/stbl.rs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/boxes/stbl.rs b/src/boxes/stbl.rs new file mode 100644 index 0000000..1ea41ae --- /dev/null +++ b/src/boxes/stbl.rs @@ -0,0 +1,36 @@ +use four_cc::FourCC; + +use bytes::BytesMut; + +use crate::Mp4Box; +use crate::Mp4BoxError; + +use super::{ + ChunkLargeOffsetBox, SampleDescriptionBox, SampleSizeBox, SampleToChunkBox, TimeToSampleBox, +}; + +pub struct SampleTableBox { + pub stsd: SampleDescriptionBox, + pub stts: TimeToSampleBox, + pub stsc: SampleToChunkBox, + pub stsz: SampleSizeBox, + pub co64: ChunkLargeOffsetBox, +} + +impl Mp4Box for SampleTableBox { + const NAME: FourCC = FourCC(*b"stbl"); + + fn content_size(&self) -> u64 { + self.stsd.size() + self.stts.size() + self.stsc.size() + self.stsz.size() + self.co64.size() + } + + fn write_box_contents(&self, writer: &mut BytesMut) -> Result<(), Mp4BoxError> { + self.stsd.write(writer)?; + self.stts.write(writer)?; + self.stsc.write(writer)?; + self.stsz.write(writer)?; + self.co64.write(writer)?; + + Ok(()) + } +} |
