mp4_atom/moov/trak/mdia/minf/
nmhd.rs

1use crate::*;
2
3#[derive(Debug, Clone, PartialEq, Eq, Default)]
4#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
5pub struct Nmhd {}
6
7impl AtomExt for Nmhd {
8    type Ext = ();
9
10    const KIND_EXT: FourCC = FourCC::new(b"nmhd");
11
12    fn decode_body_ext<B: Buf>(_buf: &mut B, _ext: ()) -> Result<Self> {
13        Ok(Nmhd {})
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_nmhd() {
27        let nmhd = Nmhd {};
28        let mut buf = Vec::new();
29        nmhd.encode(&mut buf).unwrap();
30        assert_eq!(
31            buf,
32            vec![0x00, 0x00, 0x00, 0x0c, 0x6e, 0x6d, 0x68, 0x64, 0x00, 0x00, 0x00, 0x00]
33        );
34
35        let mut buf = buf.as_ref();
36        let decoded = Nmhd::decode(&mut buf).unwrap();
37        assert_eq!(decoded, nmhd);
38    }
39}