Skip to content

Commit df92ac8

Browse files
jensennalfg
andauthored
Fix some minor issues writing traf box (alfg#109)
Co-authored-by: Alfred Gutierrez <[email protected]>
1 parent 85b8209 commit df92ac8

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/mp4box/tfhd.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ impl TfhdBox {
2222
pub const FLAG_DEFAULT_SAMPLE_DURATION: u32 = 0x08;
2323
pub const FLAG_DEFAULT_SAMPLE_SIZE: u32 = 0x10;
2424
pub const FLAG_DEFAULT_SAMPLE_FLAGS: u32 = 0x20;
25+
pub const FLAG_DURATION_IS_EMPTY: u32 = 0x10000;
26+
pub const FLAG_DEFAULT_BASE_IS_MOOF: u32 = 0x20000;
2527

2628
pub fn get_type(&self) -> BoxType {
2729
BoxType::TfhdBox

src/mp4box/traf.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ impl TrafBox {
1919
pub fn get_size(&self) -> u64 {
2020
let mut size = HEADER_SIZE;
2121
size += self.tfhd.box_size();
22+
if let Some(ref tfdt) = self.tfdt {
23+
size += tfdt.box_size();
24+
}
2225
if let Some(ref trun) = self.trun {
2326
size += trun.box_size();
2427
}
@@ -104,6 +107,12 @@ impl<W: Write> WriteBox<&mut W> for TrafBox {
104107
BoxHeader::new(self.box_type(), size).write(writer)?;
105108

106109
self.tfhd.write_box(writer)?;
110+
if let Some(ref tfdt) = self.tfdt {
111+
tfdt.write_box(writer)?;
112+
}
113+
if let Some(ref trun) = self.trun {
114+
trun.write_box(writer)?;
115+
}
107116

108117
Ok(size)
109118
}

0 commit comments

Comments
 (0)