mirror of
https://github.com/alfg/mp4-rust.git
synced 2025-01-03 00:48:40 +00:00
Fix some minor issues writing traf box (#109)
Co-authored-by: Alfred Gutierrez <alfg@users.noreply.github.com>
This commit is contained in:
parent
85b8209d5e
commit
df92ac893c
2 changed files with 11 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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<W: Write> 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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue