1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82

pub type LU = f32;
pub type LUFS = f32;
pub type Decibels = f32;

/**
 * Broadcast-WAV metadata record.
 * 
 * The `bext` record contains information about the original recording of the 
 * Wave file, including a longish (256 ASCII chars) description field, 
 * originator identification fields, creation calendar date and time, a 
 * sample-accurate recording time field, and a SMPTE UMID. 
 * 
 * For a Wave file to be a complaint "Broadcast-WAV" file, it must contain
 * a `bext` metadata record.
 * 
 * For reference on the structure and use of the BEXT record
 * check out [EBU Tech 3285](https://tech.ebu.ch/docs/tech/tech3285.pdf).
 */
#[derive(Debug)]
pub struct Bext {

    /// 256 ASCII character field with free text.
    pub description: String,

    /// Originating application.
    pub originator: String,

    /// Application-specific UID.
    pub originator_reference: String,

    /// Creation date in format `YYYY-MM-DD`.
    pub origination_date: String,

    /// Creation time in format `HH:MM:SS`.
    pub origination_time: String,

    /// Time of the start of this wave file, expressed as the number of samples
    /// since local midnight.
    pub time_reference: u64,

    /// Bext chunk version.
    /// 
    /// Version 1 contains a UMID, version 2 contains a UMID and 
    /// loudness metadata.
    pub version: u16,

    /// SMPTE 330M UMID
    /// 
    /// 
    /// This field is `None` if the version is less than 1.
    pub umid: Option<[u8; 64]>,

    /// Integrated loudness in LUFS.
    /// 
    /// This field is `None` if the version is less than 2.
    pub loudness_value: Option<LUFS>,

    /// Loudness range in LU.
    /// 
    /// This field is `None` if the version is less than 2.
    pub loudness_range: Option<LU>,

    /// Maximum True Peak Level in decibels True Peak.
    ///
    /// This field is `None` if the version is less than 2.
    pub max_true_peak_level: Option<Decibels>,

    /// Maximum momentary loudness in LUFS.
    ///
    /// This field is `None` if the version is less than 2.
    pub max_momentary_loudness: Option<LUFS>,

    /// Maximum short-term loudness in LUFS.
    /// 
    /// This field is `None` if the version is less than 2.
    pub max_short_term_loudness: Option<LUFS>,
    // 180 bytes of nothing

    /// Coding History.
    pub coding_history: String
}