Skip to main content

mp4_edit/atom/
container.rs

1/*!
2 * Atoms with children.
3 */
4
5pub mod edts;
6pub mod gmhd;
7pub mod mdia;
8pub mod meta;
9pub mod minf;
10pub mod moov;
11pub mod stbl;
12pub mod trak;
13pub mod udta;
14
15pub use edts::*;
16pub use gmhd::*;
17pub use mdia::*;
18pub use meta::*;
19pub use minf::*;
20pub use moov::*;
21pub use stbl::*;
22pub use trak::*;
23pub use udta::*;
24
25use crate::FourCC;
26
27pub const MFRA: FourCC = FourCC::new(b"mfra");
28pub const DINF: FourCC = FourCC::new(b"dinf");
29pub const MOOF: FourCC = FourCC::new(b"moof");
30pub const TRAF: FourCC = FourCC::new(b"traf");
31pub const SINF: FourCC = FourCC::new(b"sinf");
32pub const SCHI: FourCC = FourCC::new(b"schi");
33
34/// Determines whether a given atom type (fourcc) should be treated as a container for other atoms.
35pub fn is_container_atom(atom_type: FourCC) -> bool {
36    // Common container types in MP4
37    matches!(
38        atom_type,
39        MOOV | MFRA
40            | UDTA
41            | TRAK
42            | EDTS
43            | MDIA
44            | MINF
45            | GMHD
46            | DINF
47            | STBL
48            | MOOF
49            | TRAF
50            | SINF
51            | SCHI
52            | META
53    )
54}