isobmff/boxes/user_data.rs
1use super::{LoudnessBox, SubTrackBox};
2use crate::{FullBoxHeader, IsoBox, Langauge, UnknownBox, Utf8String};
3
4/// User data box
5///
6/// ISO/IEC 14496-12 - 8.10.1
7#[derive(IsoBox, Debug, PartialEq, Eq)]
8#[iso_box(box_type = b"udta", crate_path = crate)]
9pub struct UserDataBox<'a> {
10 /// The contained [`CopyrightBox`]es. (any quantity)
11 #[iso_box(nested_box(collect))]
12 pub cprt: Vec<CopyrightBox>,
13 /// The contained [`TrackSelectionBox`]. (optional)
14 #[iso_box(nested_box(collect))]
15 pub tsel: Option<TrackSelectionBox>,
16 /// The contained [`KindBox`]es. (any quantity)
17 #[iso_box(nested_box(collect))]
18 pub kind: Vec<KindBox>,
19 /// The contained [`SubTrackBox`]es. (any quantity)
20 #[iso_box(nested_box(collect))]
21 pub strk: Vec<SubTrackBox>,
22 /// The contained [`LoudnessBox`]es. (any quantity)
23 #[iso_box(nested_box(collect))]
24 pub ludt: Vec<LoudnessBox>,
25 /// A list of unknown boxes that were not recognized during deserialization.
26 #[iso_box(nested_box(collect_unknown))]
27 pub unknown_boxes: Vec<UnknownBox<'a>>,
28}
29
30/// Copyright box
31///
32/// ISO/IEC 14496-12 - 8.10.2
33#[derive(IsoBox, Debug, PartialEq, Eq)]
34#[iso_box(box_type = b"cprt", crate_path = crate)]
35pub struct CopyrightBox {
36 /// The full box header.
37 pub full_header: FullBoxHeader,
38 /// Declares the language code for the following text.
39 pub language: Langauge,
40 /// Gives a copyright notice.
41 pub notice: Utf8String,
42}
43
44/// Track selection box
45///
46/// ISO/IEC 14496-12 - 8.10.3
47#[derive(IsoBox, Debug, PartialEq, Eq)]
48#[iso_box(box_type = b"tsel", crate_path = crate)]
49pub struct TrackSelectionBox {
50 /// The full box header.
51 pub full_header: FullBoxHeader,
52 /// An integer that specifies a group or collection of tracks. If this field is 0 (default value)
53 /// or if the [`TrackSelectionBox`] is absent there is no information on whether the track can be used for
54 /// switching during playing or streaming. If this integer is not 0 it shall be the same for tracks that can
55 /// be used for switching between each other. Tracks that belong to the same switch group shall belong
56 /// to the same alternate group. A switch group may have only one member.
57 pub switch_group: i32,
58 /// A list, to the end of the box, of attributes. The attributes in this list should be used
59 /// as descriptions of tracks or differentiation criteria for tracks in the same alternate or switch
60 /// group. Each differentiating attribute is associated with a pointer to the field or information that
61 /// distinguishes the track.
62 #[iso_box(repeated)]
63 pub attribute_list: Vec<[u8; 4]>,
64}
65
66/// Track kind box
67///
68/// ISO/IEC 14496-12 - 8.10.4
69#[derive(IsoBox, Debug, PartialEq, Eq)]
70#[iso_box(box_type = b"kind", crate_path = crate)]
71pub struct KindBox {
72 /// The full box header.
73 pub full_header: FullBoxHeader,
74 /// Declares either the identifier of the kind, if no value follows, or the identifier of the naming
75 /// scheme for the following value.
76 pub scheme_uri: Utf8String,
77 /// A name from the declared scheme.
78 pub value: Utf8String,
79}