bwavfile/
bext.rs

1pub type LU = f32;
2#[allow(clippy::upper_case_acronyms)]
3pub type LUFS = f32;
4pub type Decibels = f32;
5
6///  Broadcast-WAV metadata record.
7///
8///  The `bext` record contains information about the original recording of the
9///  Wave file, including a longish (256 ASCII chars) description field,
10///  originator identification fields, creation calendar date and time, a
11///  sample-accurate recording time field, and a SMPTE UMID.
12///
13///  For a Wave file to be a complaint "Broadcast-WAV" file, it must contain
14///  a `bext` metadata record.
15///
16/// ## Resources
17/// - [EBU Tech 3285](https://tech.ebu.ch/docs/tech/tech3285.pdf) "Specification of the Broadcast Wave Format (BWF)"
18/// - [EBU Tech R098](https://tech.ebu.ch/docs/r/r098.pdf) (1999) "Format for the <CodingHistory> field in Broadcast Wave Format files, BWF"
19/// - [EBU Tech R099](https://tech.ebu.ch/docs/r/r099.pdf) (October 2011) "‘Unique’ Source Identifier (USID) for use in the
20///   <OriginatorReference> field of the Broadcast Wave Format"
21
22#[derive(Debug)]
23pub struct Bext {
24    /// 0..256 ASCII character field with free text.
25    pub description: String,
26
27    /// 0..32 ASCII character Originating application.
28    pub originator: String,
29
30    /// 0..32 ASCII character application-specific UID or EBU R099-formatted UID.
31    pub originator_reference: String,
32
33    /// Creation date in format `YYYY-MM-DD`.
34    pub origination_date: String,
35
36    /// Creation time in format `HH:MM:SS`.
37    pub origination_time: String,
38
39    /// Start timestamp of this wave file, in number of samples
40    /// since local midnight.
41    pub time_reference: u64,
42
43    /// Bext chunk version.
44    ///
45    /// Version 1 contains a UMID, version 2 contains a UMID and
46    /// loudness metadata.
47    pub version: u16,
48
49    /// SMPTE 330M UMID
50    ///
51    /// This field is `None` if the version is less than 1.
52    pub umid: Option<[u8; 64]>,
53
54    /// Integrated loudness in LUFS.
55    ///
56    /// This field is `None` if the version is less than 2.
57    pub loudness_value: Option<LUFS>,
58
59    /// Loudness range in LU.
60    ///
61    /// This field is `None` if the version is less than 2.
62    pub loudness_range: Option<LU>,
63
64    /// Maximum True Peak Level in decibels True Peak.
65    ///
66    /// This field is `None` if the version is less than 2.
67    pub max_true_peak_level: Option<Decibels>,
68
69    /// Maximum momentary loudness in LUFS.
70    ///
71    /// This field is `None` if the version is less than 2.
72    pub max_momentary_loudness: Option<LUFS>,
73
74    /// Maximum short-term loudness in LUFS.
75    ///
76    /// This field is `None` if the version is less than 2.
77    pub max_short_term_loudness: Option<LUFS>,
78    // 180 bytes of nothing
79    /// Coding History.
80    pub coding_history: String,
81}