scuffle_av1/
boxes.rs

1//! ISO base media file format boxes for AV1.
2//!
3//! <https://aomediacodec.github.io/av1-isobmff>
4
5use isobmff::boxes::VisualSampleEntry;
6use isobmff::{IsoBox, UnknownBox};
7
8use crate::AV1CodecConfigurationRecord;
9
10/// AV1 Sample Entry
11///
12/// <https://aomediacodec.github.io/av1-isobmff/#av1sampleentry-section>
13#[derive(IsoBox, Debug, PartialEq, Eq)]
14#[iso_box(box_type = b"av01")]
15pub struct AV1SampleEntry<'a> {
16    /// The visual sample entry fields that this box inherits.
17    pub sample_entry: VisualSampleEntry,
18    /// The AV1 codec configuration box contained in this box.
19    #[iso_box(nested_box)]
20    pub av1c: AV1CodecConfigurationBox<'a>,
21    /// Other boxes contained in this box.
22    #[iso_box(nested_box(collect_unknown))]
23    pub sub_boxes: Vec<UnknownBox<'a>>,
24}
25
26/// AV1 Codec Configuration Box
27///
28/// <https://aomediacodec.github.io/av1-isobmff/#av1codecconfigurationbox-section>
29#[derive(IsoBox, Debug, PartialEq, Eq)]
30#[iso_box(box_type = b"av1C")]
31pub struct AV1CodecConfigurationBox<'a> {
32    /// The AV1 codec configuration record.
33    pub av1_config: AV1CodecConfigurationRecord<'a>,
34}
35
36impl<'a> AV1CodecConfigurationBox<'a> {
37    /// Creates a new AV1 codec configuration box.
38    pub fn new(av1_config: AV1CodecConfigurationRecord<'a>) -> Self {
39        Self { av1_config }
40    }
41}