isobmff/boxes/
haptic_media.rs

1use scuffle_bytes_util::zero_copy::{Deserialize, Serialize};
2
3use super::SampleEntry;
4use crate::IsoSized;
5
6/// Haptic sample entry
7///
8/// ISO/IEC 14496-12 - 12.11.3
9///
10/// Sub boxes:
11/// - [`btrt`](super::BitRateBox)
12/// - Any other boxes
13#[derive(Debug, PartialEq, Eq)]
14pub struct HapticSampleEntry {
15    /// The sample entry that this box inherits from.
16    pub sample_entry: SampleEntry,
17}
18
19impl<'a> Deserialize<'a> for HapticSampleEntry {
20    fn deserialize<R>(reader: R) -> std::io::Result<Self>
21    where
22        R: scuffle_bytes_util::zero_copy::ZeroCopyReader<'a>,
23    {
24        Ok(Self {
25            sample_entry: SampleEntry::deserialize(reader)?,
26        })
27    }
28}
29
30impl Serialize for HapticSampleEntry {
31    fn serialize<W>(&self, writer: W) -> std::io::Result<()>
32    where
33        W: std::io::Write,
34    {
35        self.sample_entry.serialize(writer)
36    }
37}
38
39impl IsoSized for HapticSampleEntry {
40    fn size(&self) -> usize {
41        self.sample_entry.size()
42    }
43}