isobmff/boxes/
text_media.rs1use scuffle_bytes_util::zero_copy::{Deserialize, Serialize, ZeroCopyReader};
2
3use super::{BitRateBox, SampleEntry, TextConfigBox};
4use crate::{IsoBox, IsoSized, UnknownBox, Utf8String};
5
6#[derive(Debug, PartialEq, Eq)]
14pub struct PlainTextSampleEntry {
15 pub sample_entry: SampleEntry,
17}
18
19impl<'a> Deserialize<'a> for PlainTextSampleEntry {
20 fn deserialize<R: ZeroCopyReader<'a>>(reader: R) -> std::io::Result<Self> {
21 Ok(Self {
22 sample_entry: SampleEntry::deserialize(reader)?,
23 })
24 }
25}
26
27impl Serialize for PlainTextSampleEntry {
28 fn serialize<W>(&self, writer: W) -> std::io::Result<()>
29 where
30 W: std::io::Write,
31 {
32 self.sample_entry.serialize(writer)
33 }
34}
35
36impl IsoSized for PlainTextSampleEntry {
37 fn size(&self) -> usize {
38 self.sample_entry.size()
39 }
40}
41
42#[derive(IsoBox, Debug, PartialEq, Eq)]
46#[iso_box(box_type = b"stxt", crate_path = crate)]
47pub struct SimpleTextSampleEntry<'a> {
48 pub sample_entry: PlainTextSampleEntry,
50 pub content_encoding: Utf8String,
55 pub mime_format: Utf8String,
58 #[iso_box(nested_box(collect))]
60 pub btrt: Option<BitRateBox>,
61 #[iso_box(nested_box(collect))]
63 pub txtc: Option<TextConfigBox>,
64 #[iso_box(nested_box(collect_unknown))]
66 pub unknown_boxes: Vec<UnknownBox<'a>>,
67}