isobmff/boxes/
hint_media.rs1use std::io;
2
3use scuffle_bytes_util::zero_copy::{Deserialize, Serialize, ZeroCopyReader};
4
5use super::SampleEntry;
6use crate::{FullBoxHeader, IsoBox, IsoSized};
7
8#[derive(IsoBox, Debug, PartialEq, Eq)]
12#[iso_box(box_type = b"hmhd", crate_path = crate)]
13pub struct HintMediaHeaderBox {
14 pub full_header: FullBoxHeader,
16 pub max_pdu_size: u16,
18 pub avg_pdu_size: u16,
20 pub maxbitrate: u32,
22 pub avgbitrate: u32,
24 pub reserved: u32,
26}
27
28#[derive(Debug, PartialEq, Eq)]
36pub struct HintSampleEntry {
37 pub sample_entry: SampleEntry,
39}
40
41impl<'a> Deserialize<'a> for HintSampleEntry {
42 fn deserialize<R: ZeroCopyReader<'a>>(reader: R) -> io::Result<Self> {
43 let sample_entry = SampleEntry::deserialize(reader)?;
44 Ok(HintSampleEntry { sample_entry })
45 }
46}
47
48impl Serialize for HintSampleEntry {
49 fn serialize<W: io::Write>(&self, writer: W) -> io::Result<()> {
50 self.sample_entry.serialize(writer)
51 }
52}
53
54impl IsoSized for HintSampleEntry {
55 fn size(&self) -> usize {
56 self.sample_entry.size()
57 }
58}