mp4_atom/moov/trak/mdia/minf/
sthd.rs1use crate::*;
2
3#[derive(Debug, Clone, PartialEq, Eq, Default)]
4#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
5pub struct Sthd {}
6
7impl AtomExt for Sthd {
8 type Ext = ();
9
10 const KIND_EXT: FourCC = FourCC::new(b"sthd");
11
12 fn decode_body_ext<B: Buf>(_buf: &mut B, _ext: ()) -> Result<Self> {
13 Ok(Sthd {})
14 }
15
16 fn encode_body_ext<B: BufMut>(&self, _buf: &mut B) -> Result<()> {
17 Ok(())
18 }
19}
20
21#[cfg(test)]
22mod tests {
23 use super::*;
24
25 #[test]
26 fn test_sthd() {
27 let sthd = Sthd {};
28 let mut buf = Vec::new();
29 sthd.encode(&mut buf).unwrap();
30 assert_eq!(
31 buf,
32 vec![0x00, 0x00, 0x00, 0x0c, b's', b't', b'h', b'd', 0x00, 0x00, 0x00, 0x00]
33 );
34
35 let mut buf = buf.as_ref();
36 let decoded = Sthd::decode(&mut buf).unwrap();
37 assert_eq!(decoded, sthd);
38 }
39}