1use isobmff::boxes::{AudioSampleEntry, SampleEntry, VisualSampleEntry};
6use isobmff::{FullBoxHeader, IsoBox};
7use scuffle_bytes_util::BytesCow;
8use scuffle_bytes_util::zero_copy::U24Be;
9
10use crate::object_description::ESDescriptor;
11
12#[derive(IsoBox, Debug, PartialEq, Eq)]
16#[iso_box(box_type = b"iods")]
17pub struct ObjectDescriptorBox<'a> {
18 pub header: FullBoxHeader,
20 pub od: BytesCow<'a>,
24}
25
26#[derive(IsoBox, Debug, PartialEq, Eq)]
32#[iso_box(box_type = b"mp4v")]
33pub struct MP4VisualSampleEntry<'a> {
34 pub sample_entry: VisualSampleEntry,
36 #[iso_box(nested_box)]
38 pub es: ESDBox<'a>,
39}
40
41#[derive(IsoBox, Debug, PartialEq, Eq)]
45#[iso_box(box_type = b"mp4a")]
46pub struct MP4AudioSampleEntry<'a> {
47 pub sample_entry: AudioSampleEntry,
49 #[iso_box(nested_box)]
51 pub es: ESDBox<'a>,
52}
53
54#[derive(IsoBox, Debug, PartialEq, Eq)]
58#[iso_box(box_type = b"mp4s")]
59pub struct MpegSampleEntry<'a> {
60 pub sample_entry: SampleEntry,
62 #[iso_box(nested_box)]
64 pub es: ESDBox<'a>,
65}
66
67#[derive(IsoBox, Debug, PartialEq, Eq)]
71#[iso_box(box_type = b"m4ae")]
72pub struct MP4AudioEnhancementSampleEntry<'a> {
73 pub sample_entry: AudioSampleEntry,
75 #[iso_box(nested_box)]
77 pub es: ESDBox<'a>,
78}
79
80#[derive(IsoBox, Debug, PartialEq, Eq)]
84#[iso_box(box_type = b"esds")]
85pub struct ESDBox<'a> {
86 pub header: FullBoxHeader,
88 pub es: ESDescriptor<'a>,
92}
93
94impl<'a> ESDBox<'a> {
95 pub fn new(es: ESDescriptor<'a>) -> Self {
97 Self {
98 header: FullBoxHeader {
99 version: 0,
100 flags: U24Be(0),
101 },
102 es,
103 }
104 }
105}