scuffle_h265/
boxes.rs

1//! ISO base media file format boxes for HEVC/h265.
2//!
3//! ISO/IEC 14496-15 - 8.4
4
5use isobmff::boxes::{MPEG4ExtensionDescriptorsBox, VisualSampleEntry};
6use isobmff::{IsoBox, UnknownBox};
7
8use crate::HEVCDecoderConfigurationRecord;
9
10/// HEVC Configuration Box
11///
12/// ISO/IEC 14496-15 - 8.4.1
13#[derive(IsoBox, Debug, PartialEq, Eq)]
14#[iso_box(box_type = b"hvcC")]
15pub struct HEVCConfigurationBox<'a> {
16    /// The HEVC decoder configuration record contained in this box.
17    pub hevc_config: HEVCDecoderConfigurationRecord<'a>,
18}
19
20impl<'a> HEVCConfigurationBox<'a> {
21    /// Creates a new HEVC configuration box.
22    pub fn new(hevc_config: HEVCDecoderConfigurationRecord<'a>) -> Self {
23        Self { hevc_config }
24    }
25}
26
27/// HEVC Sample Entry
28///
29/// ISO/IEC 14496-15 - 8.4.1
30#[derive(IsoBox, Debug, PartialEq, Eq)]
31#[iso_box(box_type = b"hvc1")]
32pub struct HEVCSampleEntryHvc1<'a> {
33    /// The visual sample entry fields that this box inherits.
34    pub sample_entry: VisualSampleEntry,
35    /// The HEVC configuration box contained in this box.
36    #[iso_box(nested_box)]
37    pub config: HEVCConfigurationBox<'a>,
38    /// The optional MPEG-4 extension descriptors box contained in this box.
39    #[iso_box(nested_box(collect))]
40    pub mpeg4_extension: Option<MPEG4ExtensionDescriptorsBox<'a>>,
41    /// Any other boxes contained in this box.
42    #[iso_box(nested_box(collect_unknown))]
43    pub sub_boxes: Vec<UnknownBox<'a>>,
44}
45
46/// HEVC Sample Entry
47///
48/// ISO/IEC 14496-15 - 8.4.1
49#[derive(IsoBox, Debug, PartialEq, Eq)]
50#[iso_box(box_type = b"hev1")]
51pub struct HEVCSampleEntryHev1<'a> {
52    /// The visual sample entry fields that this box inherits.
53    pub sample_entry: VisualSampleEntry,
54    /// The HEVC configuration box contained in this box.
55    #[iso_box(nested_box)]
56    pub config: HEVCConfigurationBox<'a>,
57    /// The optional MPEG-4 extension descriptors box contained in this box.
58    #[iso_box(nested_box(collect))]
59    pub mpeg4_extension: Option<MPEG4ExtensionDescriptorsBox<'a>>,
60    /// Any other boxes contained in this box.
61    #[iso_box(nested_box(collect_unknown))]
62    pub sub_boxes: Vec<UnknownBox<'a>>,
63}