mp4_atom/
styp.rs

1use crate::*;
2
3#[derive(Debug, Clone, PartialEq, Eq)]
4#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
5pub struct Styp {
6    pub major_brand: FourCC,
7    pub minor_version: u32,
8    pub compatible_brands: Vec<FourCC>,
9}
10
11impl Atom for Styp {
12    const KIND: FourCC = FourCC::new(b"styp");
13
14    fn decode_body<B: Buf>(buf: &mut B) -> Result<Self> {
15        Ok(Styp {
16            major_brand: FourCC::decode(buf)?,
17            minor_version: u32::decode(buf)?,
18            compatible_brands: Vec::<FourCC>::decode(buf)?,
19        })
20    }
21
22    fn encode_body<B: BufMut>(&self, buf: &mut B) -> Result<()> {
23        self.major_brand.encode(buf)?;
24        self.minor_version.encode(buf)?;
25        self.compatible_brands.encode(buf)?;
26        Ok(())
27    }
28}