blob: 1ea41ae2639502a2c652bb41e4f02b1d979b8803 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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(())
}
}
|