diff --git a/src/mp4box/tfhd.rs b/src/mp4box/tfhd.rs index e67e5cb..5b529e6 100644 --- a/src/mp4box/tfhd.rs +++ b/src/mp4box/tfhd.rs @@ -22,6 +22,8 @@ impl TfhdBox { pub const FLAG_DEFAULT_SAMPLE_DURATION: u32 = 0x08; pub const FLAG_DEFAULT_SAMPLE_SIZE: u32 = 0x10; pub const FLAG_DEFAULT_SAMPLE_FLAGS: u32 = 0x20; + pub const FLAG_DURATION_IS_EMPTY: u32 = 0x10000; + pub const FLAG_DEFAULT_BASE_IS_MOOF: u32 = 0x20000; pub fn get_type(&self) -> BoxType { BoxType::TfhdBox diff --git a/src/mp4box/traf.rs b/src/mp4box/traf.rs index 51f812d..d53d713 100644 --- a/src/mp4box/traf.rs +++ b/src/mp4box/traf.rs @@ -19,6 +19,9 @@ impl TrafBox { pub fn get_size(&self) -> u64 { let mut size = HEADER_SIZE; size += self.tfhd.box_size(); + if let Some(ref tfdt) = self.tfdt { + size += tfdt.box_size(); + } if let Some(ref trun) = self.trun { size += trun.box_size(); } @@ -104,6 +107,12 @@ impl WriteBox<&mut W> for TrafBox { BoxHeader::new(self.box_type(), size).write(writer)?; self.tfhd.write_box(writer)?; + if let Some(ref tfdt) = self.tfdt { + tfdt.write_box(writer)?; + } + if let Some(ref trun) = self.trun { + trun.write_box(writer)?; + } Ok(size) }